Repository navigation
fix(rooms): read a candidate with its own room's round, or with none (#293) - #311
Merged
Merged
Conversation
…293) A candidate whose round_id named another room's round was listed with that round's number, and one whose round was gone vanished from the listing. Every reader that orders candidates by round took the borrowed number at face value. - The candidate listing joins its round only within the same room; otherwise round_number is NULL, the existing "round not recorded" shape the numeric readers already skip. - Whoever writes a round record decides with the function its validator uses: the checkpoint with checkpoint_eligible, the delta watermark with last_completed_round, the repair guard with _repair_parent_tree_problem and _newer_completed, branch-from with _branch_tree_problem. A cold round beside a damaged candidate no longer freezes as recovery_required, and a branch base the record would reject is refused before any workspace is removed. - A completed candidate with no recorded round makes its member's order unknown, so neither the guard nor the record accepts a repair there. - Loading a candidate's artifact also requires its round to exist in the same room. - room compare reports a candidate outside the room's rounds as damaged. - room candidates prints an unreadable candidate on its own line, lists the rest and exits 1; the TUI shows it as unreadable in that pane only (never cached) while the room's other panes refresh, and its cache key carries the round binding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #293.
Problem
RoomStore._list_candidatesjoinedcandidatestoroundsonround_idalone:round_idnamed another room's round was listed with that round's number;Every reader working from those rows (repair parent order, branch/continued parents, feedback evidence, the delta watermark, the conversation and provenance validators) took the borrowed number at face value. The artifact path refused only one of the four damage shapes.
Change
Read model.
LEFT JOIN rounds r ON r.id = c.round_id AND r.room_id = c.room_id: the candidate stays listed and itsround_numberis NULL, the existing "round not recorded" shape the numeric readers already skip.One rule per fact. Whoever writes a round record now decides with the function its validator reads it with:
_checkpoint)checkpoint_eligiblerun_roundlast_completed_round_repair_parent_problem)_repair_parent_tree_problem+_newer_completedpreflight_round, andrun_roundbefore_cleanup_workspaces)_branch_tree_problemBefore this, a NULL or renumbered candidate made a cold round's checkpoint disagree with its record, and the round froze as
recovery_requiredbefore any provider ran. A branch base the record would reject was only refused after the room's workspaces had been removed._continued_parentskeeps its own code: it emits only an exact previous-round match orNone, which its validator always accepts.Unknown order. A completed candidate with no recorded round makes its member's order unknown. Neither the repair guard nor the repair record accepts a parent for that member.
Artifact binding. Loading a candidate also requires its round to exist in the same room (
RoomStore.round_room_id). All four shapes are now refused on the artifact path: row repointed, dangling, round moved, round deleted.Surfaces.
room compareadds adamagedentry for a candidate outside the room's rounds. The entry shape and JSON fields are unchanged.room candidatesprints an unreadable candidate on its own line, lists the rest, and exits 1.RoomErrorfrom the candidate's own row or artifact as "unreadable" in that pane only, never cached, while the room's other panes refresh. Store failures still degrade the whole room. The candidate cache key now carriesround_idand the round's room.Tests
tests/test_room_round_binding.py(new, 15) uses a realRoomStoredamaged by SQL. It covers:tests/test_tui.py(+5): unreadable pane with other panes refreshing; uncached re-read and recovery; round moved or vanished; candidate repointed to another round; row read failure; Diff→Output after a bad patch.round_number=argument. The frozen prompt golden, frozen room fixtures and persisted-contract pins pass unmodified.Each new guard was removed one at a time (19 mutations); every removal fails a test. Full hermetic suite clean locally; ruff clean. Codex design review: 2 rounds NEEDS-FIX, then an unprimed SHIP. Implementation review: round 1 NEEDS-FIX (all fixed), round 2 SHIP.
🤖 Generated with Claude Code