Kernel: an unknown merge state defers
Merged
DO
5d ago+56+56+01234567890123456789-9-9-0123456789
Closes the third gap of the epic "Epic: nine gaps in the Kernel, found in review": mergeable was read only when it was false, so a merge state GitHub had not worked out yet converged, was approved, and admitted a review Run.
Stacks on "Kernel: a Pause stops approvals and merges, not only Runs" (#67), and will be rebased onto main once that merges.
What changes
kernel/derive.py: only an exacttrueis mergeable and only an exactfalseis a conflict. Anything else (null, a missing key, a malformed value such as"UNKNOWN") is unreadable: no State is derived, and the Decision defers with reasonmergeable_unreadable, as an unreadable Pause or capacity reading does.- The order is pinned: the merge state is read after a merged, closed, held, draft or queued item, each of which keeps its own State and reason. GitHub reports a null merge state on merged and closed pull requests, so read first it would leave them deferring for ever.
test_an_unknown_mergeable_is_read_after_what_needs_no_mergeholds this, with a mutant that reads the merge state first. tests/test_decide.py:test_an_unknown_mergeable_never_convergesloses@pending, leavesNotYetHeld, and now asserts both sides of the boundary: a deferral with an unknown merge state, andissue_approvalorenqueuewith a known one. Newtest_an_unknown_mergeable_admits_nothingshows no review Run is admitted either. Newtest_only_true_or_false_is_a_known_merge_statecovers a missing key,"UNKNOWN","true"and1. Newtest_a_conflict_goes_back_to_the_authorpins the conflict rule, which nothing tested before.tools/mutants.py: "an unknown merge state is read as mergeable", "only a null merge state is unknown", "a conflict is not sent back to the author" and "the merge state is read before a merged, closed, held, draft or queued item". 26 of 26 killed.- Documents: "not held yet" is gone from lesson L-07. The design's §3.3 row for
mergeablenames null, and §4.6 has the case of a merge state GitHub has not worked out yet.
Acceptance criteria (from "Kernel: an unknown merge state defers")
-
test_an_unknown_mergeable_never_convergespasses with@pendingremoved: an unknown merge state is unreadable, and the Decision isdefer. - The mutant for it is killed.
- No document says
not held yetbeside this test.
Left open, on purpose
- A missing
mergeabledefers rather than crashing, as a missing Pause does. The facts schema already rejects it, so no counter-example is added. - A merge state that never resolves defers with attention
none, so nobody is told. That is the story "When waiting becomes the Maintainer's to see". - The simulator does not inject a null merge state.
sim/world.pyis shared with four other stories in the epic.
Checks and reviews
make verifyandpython3 -m tools.mutantspass on agit archive HEADcopy, which avoids the nested worktrees of "Verify passes in a checkout that holds other worktrees" (#64).- The new tests were run before the rule and failed as expected; the conflict test passed throughout, because it pins existing behaviour. The order mutant survived every test until the order test was added.
- The second model family's read is the Gemini code review and the other bot reviewers on this pull request, as the Maintainer directed. Not merged or enqueued; the Maintainer merges.
Closes #31
🤖 Generated with Claude Code