Repository navigation
fix(pre-push): the body is reconciled against the head the push PUBLISHES (#744) - #746
Conversation
…SHES (#744) The body/diff reconciliation and the org linter both judged the body's head claim against the CHECKOUT's HEAD — while a push of a branch other than the checked-out one publishes THAT branch's commit. The body was therefore checked against a tree the push does not publish: a body that described the pushed branch was BLOCKED, and a body that described the checkout was let through. - scripts/check-pr-body-diff.mjs: gains `--head <rev>` (default `HEAD`), and every arm that reads the tree — the diff, the file table, the evidence, the record claims, the reader-independence count — reads that ONE head. - hooks/pre-push: resolves the published refs ONCE — the branch AND the commit the push publishes — and names that commit to the reconciliation and to the org linter alike. The checked-out tree stays the fallback for a push that publishes no single branch (a tag, a deletion, several branches, a hand-run hook), which is the tree it always read. - scripts/check-pr-body-gate.mjs: the fixture's second branch moves onto a DIFFERENT tree, so the two branches can be told apart, and two new FIRED arms discriminate — a body about the checkout is BLOCKED when the push publishes another branch, and a body about the published branch passes. Three new mutations, and the two the old invocations moved to, keep every arm able to fail. - CHANGELOG/2026.300.1647.md: the merged record's claim that the reconciler compares the body against `origin/main...HEAD` is corrected — it no longer does. Closes #744 Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
Review — PASSWhat the PR doesThe change resolves the refs a push publishes ONCE (in Verified against the diff
CommentsNo comments were provided ( Non-blocking observations
No correctness, security, scope, or cleanliness defects were found in the diff; the change is coherent, tested, and internally consistent with the body. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
fix(pre-push): the body is reconciled against the head the push PUBLISHES
Summary
Head
3f84384fa114a9cafa97e9f13da14fe868e03197— 4 files changed, 297 insertions(+), 61 deletions(-).The pre-push gate reconciled the PR body against the diff of the CHECKOUT's
HEAD, and the org's body linter judged the body's own head claim against that same checkout. A push of a branch other than the checked-out one publishes THAT branch's commit —git push origin otherpublishesother's sha while the checkout still sits onmain— so both readers judged the body against a tree the push does not publish: a body that described the pushed branch was BLOCKED, and a body that described the checkout was let through. That is the defect #744 filed; it was separable from the hook's argument contract, so it lands in its own PR, and this is it.The fix resolves the published refs ONCE — the branch AND the commit the push publishes — and names that commit to BOTH readers of the body's head claim. The checked-out tree stays the fallback for a push that publishes no single branch (a tag, a deletion, several branches at once, or a hand-run hook): the tree it always read.
scripts/check-pr-body-diff.mjs--head <rev>(defaultHEAD), and every arm that reads the tree — the diff, the file table, the pasted evidence, the rewritten record's claims, the reader-independent count — reads that ONE head.hooks/pre-pushscripts/check-pr-body-gate.mjsCHANGELOG/2026.300.1647.mdorigin/main...HEAD— corrected in the same cutover, because a record that states the old thing is a claim the tree does not support.Closes #744
How tested
The gate that owns this change is the umbrella's own:
bash scripts/self-test.shand./charly/bin/charly task verify, plus the hook's own gatenode scripts/check-pr-body-gate.mjsin its green mode and in its--self-testmode, the reconciler's own--self-test, and the body's cap check. Every command below was run on the committed tree this PR publishes; the RED proofs were run against the MERGED tree under this change's own gate, so the coverage fails without the change.The change-class gate, on that same tree:
The hook's own gate, in its green mode — the two arms this change adds are the last two:
The same gate in the mode that MUTATES the hook to prove each arm can fail — the three new mutations are the ones this change adds, and the two moved invocations are re-keyed so they can still fail:
The reconciler's own self-test — the last case is the one this change adds, and the fourth mutation is the one that names the defect:
The body's cap check — the two readers read the SAME number from the one shipped cap:
The RED proof — the MERGED tree under this change's gate. The merged hook and the merged reconciler are put in place and the same gate is run against them, so every arm this change adds fails without the change:
The RED proof — the NEW hook with the OLD reconciler. The reconciler is the half that READS the tree, and the old one IGNORES an unknown flag: its argument parser looks up only
--repo,--bodyand--base, so passing--headto it is not a fix but a silent no-op. This is the arm that proves both halves are needed:The two halves, in the tree being pushed. The hook resolves the published refs once and names that one commit to both readers; the reconciler reads the tree through that one head:
Rulebook compliance
AGENTS.mdwas read before the change.headRef, and the gate ASSERTS the contract instead of re-deriving it.git statuswas clean before the commit and the tree carries nothing beyond it; the push is a branch push — no force-push, no amend after the push, no hook bypass, no direct push tomain.--self-testmode mutates the hook fourteen ways and each mutation is caught../charly/bin/charly version→2026.300.1028; this change touches no Go source and adds no runtime dependency, so no rebuild is owed.bash scripts/self-test.shand./charly/bin/charly task verify— run on the committed tree this PR publishes: 42 steps, 0 failed, 0 skipped, 0 warnings.Change classification
bash scripts/self-test.shand./charly/bin/charly task verify, plusnode scripts/check-pr-body-gate.mjsandnode scripts/check-pr-body-gate.mjs --self-test,node scripts/check-pr-body-diff.mjs --self-testandnode scripts/check-pr-body-cap.mjs— all on the committed tree, all green, zero warnings.fully tested and validated— the change-class gate passed on the final tree, and the changed paths were executed live.HEAD— survives nowhere in the code, and the record that stated it now says it in the past tense and names the fix. The positive sweep: every tree read in the reconciler goes through the one head.Filed issues
None. Both findings this change's own gate raised were introduced by this change's own first cut, so both are fixed here rather than filed: the first because the fixture could not tell the two branches apart, the second because the linter was still reading the checkout's head. The one finding that was genuinely separable — the reconciler's own diff base — was filed as #744 and is what this PR closes.
Agent:
pin666-removed-row· sessionses_8efb271d-f2c0-47d3-85e3-2a1e00b11ae0Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)