Repository navigation
fix(hooks): the commit gate decides by change class, and each leg runs once (opencharly/opencharly#602, #645, #498) - #660
Conversation
…s once (#602, #645, #498) The umbrella's pre-commit hook ran its charly-backed pair TWICE per commit - once in the binary branch and once under the banner - and decided what to run with a `needs_charly` flag that only the NO-BINARY branch consulted, so the binary-present branch ran BOTH legs on a diff that could violate neither. Worse, the no-binary branch FELL THROUGH to a `run_charly` with an EMPTY binary, so a fresh session worktree - which AGENTS.md Part II #2 mandates for every session, and which has no binary of its own - could not commit AT ALL: the hook died on a command-not-found. Measured, and filed as #602, #645 and #498. What changes: * The gate is DECIDED, and the decision lives in ONE place: hooks/pre-commit-gate.sh. It reads the staged diff of the INDEX THE COMMIT CARRIES (git builds a temporary index for a path-limited commit, so the hook captures GIT_INDEX_FILE before it scrubs the git vars and hands that index to the gate), and runs the pin check only when that diff moves a gitlink. That is EXACT, not a heuristic: every value the pin check compares is an index entry, and a checkout's HEAD can only disagree with the index when the diff moved it - so a commit that moves no gitlink cannot violate it. The checkout DRIFT the same verb also sees stays where the rulebook puts it: `charly task verify` (AGENTS.md Part II #1). * The two legs each run EXACTLY ONCE. The duplication cannot come back: scripts/check-pre-commit-gate.mjs asserts the hook calls the gate exactly once and invokes neither leg itself, and a mutation arm turns the gate red if a second call appears. * The missing binary fails LOUD only when the change class needs the pin check, and names the fix. A docs-only commit in a fresh worktree now PASSES - the path that could not commit at all. The main-clone binary fallback is DELETED (R9: the binary equals the source; a different source's build cannot load the project in a linked worktree). * The self-test set moves out of the TEXT of the `self-test` task and into scripts/self-test.sh, so the task and the commit gate call ONE owner and cannot drift (R2). The builders' --self-tests need no binary, no project and no submodule: all five pass standalone in 3.4 s (2026-10-24), which is why they are the CHEAP leg that runs on every commit. Proof, on this tree: OLD hook (origin/main), measured: 1m29.152s, and the pin check ran TWICE. NEW hook, same tree, same commit class (no gitlink moved): 4.66s, the pin check SKIPPED visibly. NEW hook, a commit that DOES move a gitlink: the pin check runs ONCE (29 s measured 2026-10-24 over the umbrella's whole pin set), not twice. The new fixture is RED on the old tree (the gate file is absent) and, in the hybrid (old hook + new gate), RED on six specific obligations: the hook calls the gate zero times, takes both legs back, never captures GIT_INDEX_FILE, never hands it to the gate, and keeps only 11 node gates. Its own --self-test mode mutates the gate seven ways and every mutation is caught; the unmutated copy is GREEN. Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
|
STATUS The commit gate's change-class decision is pushed and open for review: #660. Head. What is done. The gate's DECISION and its two legs live in ONE owner ( The proof, on the committed tree. What is next. The fresh Next update due: on the validator's verdict, or when the next round's commit is pushed — whichever comes first. Agent: charly Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated) |
Review — PASSWhat the PR does (re-derived from the diff)The change splits the umbrella's commit gate into a decision owner ( I checked each file line by line:
TestsThe fixture is the kind that fails without the change: the body's own transcripts show it RED on the old tree (gate missing) and RED on the hybrid (old hook + new gate: gate-call count 0, hook still invoking both legs, no index capture, 11 node gates). The mutation arms cover exactly the regressions the PR claims to prevent (change class ignored, pin check duplicated, silent missing binary, self-test skipped, main-clone fallback, hook calling the gate twice, hook reclaiming the pin check). The body's pasted counts (8 PASS lines = 1 static + 7 fired; 7 mutation arms + GREEN) match the code's output shape. Security / scopeNo secrets, no injection surface (the index path is always quoted, Non-blocking observations (do not change the verdict)
CommentsThe comment thread is empty (0 comments); nothing to disposition. VerdictThe change does what the body claims, the body's evidence is internally consistent and reproduced by the diff, the coverage fails without the change, legacy paths are removed, and no security or scope problem is present. The one imprecision in the "EXACT" wording is disclosed and rulebook-aligned. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS Disposition of the two non-blocking observations from the Observation 1 — the "EXACT" claim. CONFIRMED, and a defect, not a wording slip.The review read the claim as "not strictly true for the checkout audit" and called it a Mechanism. Missed control. The gate's own fixture asserted the class as written, so it could never Blast radius. The fast commit gate skipped the pin check for manifest-only and path-set-only Root fix. The class is derived from the verb's read-set, the rule lives ONCE The checkout-drift half is unchanged and stays where the rulebook puts it — Observation 2 — the coverage trade-off. Deliberate, unchanged by the follow-up, and now visible.The review asked the maintainer to consciously accept that the commit gate no longer audits Nothing about the trade-off is expanded by the follow-up, so no new maintainer acceptance is State
Next update: when the follow-up PR is open, with its head. Agent: charly Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (analysed on a live system) |
Summary
What this closes. Three umbrella issues, all about the umbrella's own commit gate:
linked worktree, so every docs-only worktree commit dies in the hook.
charly task, and the worktree has neither an initialized charly submodule nor a bootstrapped binary #498 — a fresh session worktree cannot commit an umbrella change atall.
The change: the gate is DECIDED, and the decision has ONE owner.
hooks/pre-commit-gate.shdecides by CHANGE CLASS:
--self-tests — is cheap(3.4 s measured 2026-10-24), and needs no binary, no project and no submodule, so it runs
on every commit;
only when the staged diff moves a gitlink.
The change class is EXACT, not a heuristic. Every value the pin check compares is an
INDEX entry, and a checkout's HEAD can only disagree with the index when the diff moved it
— so a commit that moves no gitlink cannot violate it. The checkout DRIFT the same verb
also sees (a checkout dirty, or at another commit, caused by no commit) stays where the
rulebook puts it:
charly task verify(AGENTS.md Part II #1).Three defects die with the old code.
branch and once under the banner. The gate is called ONCE now, and the fixture asserts
that count, with a mutation arm that turns the gate red if a second call comes back.
needs_charlyflag — only the NO-BINARY branch consulted it, so thebinary-present branch ran BOTH legs on a diff that could violate neither; and the
no-binary branch fell THROUGH to a
run_charlywith an EMPTY binary, so the hook diedon a command-not-found. The no-binary path now fails LOUD only when the change class
needs the pin check, and a docs-only commit in a fresh worktree PASSES.
linked worktree it cannot load the project at all (R9: the binary equals the source).
The self-test set has one owner too. It used to exist only as the TEXT of the
self-testtask, so the commit gate could reach it only throughcharly task self-test—which needs the binary and a loadable project, and therefore could not run at all in a
fresh session worktree. It now lives in
scripts/self-test.sh, and the task and the gateboth call that file, so the set of judged builders is declared once (R2).
One precision the old hook lacked. Git sets
GIT_INDEX_FILEto a TEMPORARY index for apath-limited commit (
git commit <path>), and that temporary index — not the repository'sown — is the set of paths the commit carries. The old hook scrubbed
GIT_INDEX_FILEbeforecomputing the class, so a path-limited commit was judged on a SUPERSET of itself. The new
hook captures the index before the scrub and hands it to the gate, which reads the staged
diff from it.
charly.ymlself-testtask calls the script;verifyruns the script and the new gate, plus the new gate's self-test modehooks/pre-commithooks/pre-commit-gate.shscripts/check-pre-commit-gate.mjsscripts/self-test.shHow tested
The head and the base — the committed tree this body describes:
The worktree-local binary (R9 — binary equals source), never a shared install:
The gate, run live on the committed tree — the real builders' own self-tests, and the
skip the change class produces, printed by the gate itself:
The gate's own assertion, run live — static readings over the shipped text, and the gate
FIRED in a scratch git repository with a recording charly, so the counts are what the gate
actually did and not what its text says it does:
The coverage that fails without the change — the same fixture against the OLD tree
(taken from
origin/main), which has no gate to fire, and against the HYBRID, which pairsthe old hook with the new gate and satisfies none of the obligations the new hook carries:
The wall clock, before and after, on this tree — the same commit class (a commit that
moves no gitlink), the same tree, the same builders:
The OLD hook ran the pin check twice on a commit that moves no gitlink at all. The NEW hook
skips it — visibly — on the same commit class, and runs it ONCE (29 s measured 2026-10-24)
when a gitlink does move.
The umbrella's own gate, on the committed tree — every step, the whole plan:
The R5 claim-keyed sweep — each removed mechanism, named by its own token, against
hooks/, and then against the whole tree so that every surviving hit is classified ratherthan assumed away:
The four greps against
hooks/return exit 1: theneeds_charlyflag, therun_charlyfall-through, the
git-common-dirmain-clone lookup and the hook's owntask self-testinvocation are all absent from the hook. The
task pin-checktoken now lives in ONE file,hooks/pre-commit-gate.sh, and the fixture asserts the gate invokes it exactly once. Therepo-wide
needs_charlysweep returns the CHANGELOG's own history of the old mechanism(three files, each a record of what that mechanism was) and this change's fixture prose,
which names the mechanism it replaced so the assertion can name it too. History belongs in
CHANGELOG/and is not rewritten; the fixture's line is what keeps the mechanism fromcoming back.
Rulebook compliance
/charly-internals:git-workflow(the branch, the commit, the PR body, the push) and/charly-internals:strict-policywith/charly-internals:root-cause-analyzer(theanalysis that produced this change).
check-readme-measurements.mjsraised three findings against the NEW files in thischange (undated counts of a collection that grows), and all three are FIXED here: the
counts are gone and the wall clocks carry the day they were measured. The three defects
in the OLD hook were filed as umbrella pre-commit: the main-clone binary fallback cannot load the project from a linked worktree, so every docs-only worktree commit dies in the hook #602, the umbrella's pre-commit hook runs its charly-backed assertions TWICE per commit — the pin-check audit is the slowest leg, and it is duplicated #645 and A fresh session worktree cannot commit an umbrella change: the pre-commit hook runs
charly task, and the worktree has neither an initialized charly submodule nor a bootstrapped binary #498 and are FIXEDhere, in this change, by the diff below. The path-limited-commit imprecision the old
hook carried is FIXED here. Nothing is filed away, and no finding raised on this PR is
filed: a finding raised on the PR is fixed or rebutted on the thread.
hooks/pre-commit-gate.showns the change-classdecision and both legs, and
scripts/self-test.showns the self-test set that the taskand the gate both call, so the two callers cannot drift.
hand-rolled substitute. The skip is VISIBLE and names the command that would run it
anyway, and the missing binary fails LOUD with the fix, rather than a silent pass over a
check that never ran.
and every comment in the two shell files says what the code does.
tokens still appear in the tree.
git statuswas stated before the branch was cut and before the commit; thework is in the session worktree at
.worktrees/precommit/opencharly/on branchfeat/pre-commit-change-class, branched off freshorigin/main7359f159b0bcf68a3bb27fc18555e02a3675ba30. No force-push, no amend after the push, nodirect push to
main, no hook bypass, and no other session's branch, worktree or filetouched. No submodule was edited: the umbrella records gitlinks only, and this diff moves
no gitlink.
the umbrella's whole plan, all pasted above), and this change's own coverage fails
without the change: the fixture is RED on the old tree and RED on the hybrid, and each of
its seven mutation arms is RED on the mutated copy while the unmutated copy is GREEN.
change and in the umbrella's plan above; nothing was mocked. The fixture's fired
assertions use a RECORDING charly, and what they judge is the gate's DECISION — how many
times it invokes a leg, whether the skip is visible, whether the missing binary is loud
— not the verb's verdict, which the live runs above exercise.
install, and the main-clone fallback that used to break that rule is deleted.
steps and no warning:
charly task verify(33 steps, 0 failed) plus the changed gate'sown
--self-test(7 arms, each RED on its mutation). Nodisposable: truetarget isaffected: this change touches no build, no deploy and no bed, and the umbrella declares
no candy or box.
origin/main; every tracked submodule checkout stays at its gitlink.coordination records are posted on the threads it touches, and each resolved issue is
closed with an explicit RESOLVED record when this PR lands — a
Closeskeyword does notclose an issue by itself, which is measured on chore(pins): the umbrella's consumer leg of the ellipsis cutover — two gitlinks to their producers' merged mains, and the gate prints the product's own token #654.
Change classification
One gate's own decision. The diff carries the umbrella's own commit gate: the hook, the
gate it delegates to, the gate's own assertion, the self-test set the gate runs, and the
manifest's two references to them. No submodule content, no Go source, no schema, no
gitlink, no pin, no deploy and no bed.
The gates that own this class are the changed gate's own
--self-test(the coverage thischange adds) and the umbrella's
charly task verify(the aggregate gate, which runs thatself-test and the new fixture among its 33 steps) — both run on the committed tree above,
and the changed path itself ran live.
On the attribution tier. The tier is
fully tested and validated: the change-classgate passed on the final tree with zero warnings, the changed path ran live, and the
before/after measurement above is retained in this body.
Filed issues
explicit RESOLVED record when this PR lands, not by a keyword) — the main-clone binary
fallback cannot load the project from a linked worktree, so every docs-only worktree
commit died in the hook.
pre-commit hook runs its charly-backed assertions TWICE per commit.
charly task, and the worktree has neither an initialized charly submodule nor a bootstrapped binary #498 (CLAIMed; discharged by this diff) — a fresh sessionworktree cannot commit an umbrella change.
No new issue was filed by this change: every finding this change's scope touched is fixed
in it.
Agent: charly
Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)