Repository navigation
fix(hooks): make pre-commit ZERO-ALIASES gate merge-commit-aware - #132
Conversation
A behind-branch `git merge` stages, relative to HEAD (the FIRST parent), everything the incoming branch brought in — including main's gofmt-REALIGNED (not new) alias survivors in charly/*_aliases.go. The raw staged-diff scan treated those as branch-added and BLOCKED any behind-branch merge that pulled them in, so a merge could not complete through the gate. The alias gate now reads MERGE_HEAD and flags an alias file/line only when it is a GENUINE addition — present in the merge result but in NEITHER parent (a new alias, or one invented while resolving a conflict). A real new alias the branch introduces is still caught; a survivor merged in from an incoming parent (already vetted on its own landing) is not. Normal (non-merge) commits are byte-for-byte unchanged (merge_parent_shas returns [] off a merge). gate_test.py gains three cases: a merge-of-realigned-aliases commit PASSES, a merge-in new alias FILE survivor PASSES, and a genuinely-new-alias-in-a-merge commit still BLOCKS. Full suite: 35 cases, 0 failures. Old-vs-new witness confirms the two ALLOW cases BLOCK on the pre-fix gate (tests are load-bearing). Assisted-by: Claude (fully tested and validated)
pr-validator — APPROVED ✅Change class: hook / workflow scripts A fresh, independent re-derivation (no author claim trusted). This PR touches the ZERO-ALIASES Checklist
Architecture per-item trace: no staged R10 — gate executed live by the validator (independent of the author)Check-coverage independently proven load-bearing (new cases run against the OLD
|
Version-stamp commit (folded by the squash-merge): rename the placeholder CHANGELOG to the merge-time CalVer and align its H1. Assisted-by: Claude (fully tested and validated)
docs#11 merged as 50b3e54 and tagged v2026.217.1305: the generated catalog caught up with plugins#129/#130/#132 and this branch's own landing projection. Its 67 pages only exist on that merge, so this branch's docs gitlink and DOCS_REF both advance 979abad -> 50b3e54. DOCS_REF appears TWICE in candy/docs-site/charly.yml on purpose — as the clone layer's cache key and as the literal stdout matcher for the docs-site-pinned-commit check, because a check step's substitution does not resolve a candy var: and would SKIP the step instead. Both places track the gitlink; `task docs:pin` asserts all three agree. Verified on the committed object after this commit: gitlink == DOCS_REF == 50b3e54, and the check-docs bed re-runs cold against the new pin. Assisted-by: Claude Code deepseek-v4-flash:0731-cloud (fully tested and validated)
…ports (#599) * feat(deps): spec v0.2026256.653 — the plugin build lock queues and reports Bumps `github.com/opencharly/spec` v0.2026254.1930 -> v0.2026256.653 (spec #132, merged). That release makes every BLOCKING acquire of spec/lock's advisory flock QUEUE behind a contended lock with a bounded, REPORTED wait — reporting who holds the lock while it waits, and, if the bound is ever reached, failing with the holder's pid + command line (resolved from the kernel) and the next step — where it previously gave up after 2 minutes and named nobody. Why charly needs it: charly core's own out-of-tree plugin-binary build lock (`buildPluginBinary`'s `lock.AcquireFileLock(bin+".lock", true)`) is a blocking acquire of exactly that primitive. Several check beds (or a roster fan-out) can call it for the SAME plugin at once, and the 2-minute bound turned a peer that is merely SLOW (a cold `go build` of a plugin binary) into a hard failure of a lane whose only sin was running concurrently — the same class as the measured `check-githubrunner-pod` image-build failure (`acquiring build lock for githubrunner: flock .../image-<sha8>.lock: lock held by another process for > 2m0s`, run 2026.255.2310) that spec #132 fixes. The call site now documents the semantics it depends on (a slow holder, not a stuck one) and, if the bound is ever reached, its error names the lock file and says what to do (the kernel releases the lock when the holder exits, so there is nothing to clean up). Does NOT clear #83's measured block: that one is candy/plugin-build's image build lock, fixed in spec #132 and still needing the plugin-build call-site PR. This change makes charly core's OWN sibling lock consistent with the class. * docs(plugin): the pin lives in go.mod, not "below" — and record the live lock proof R1/R5: the comment claimed the spec pin was "pinned below", but the pin is the `github.com/opencharly/spec` require in charly/go.mod; the comment now says so. (Rebuilt via `task build:binary` — `bin/charly version` reports 2026.256.0659.) * docs(evidence): one tier, and it is the honest one The review is right: the classification said `fully tested and validated` while the footer said `analysed on a live system`. The changed branch in this repo is the FAILURE wrap (`if lockErr != nil`), which needs a >30m contention to execute — the pasted run shows the acquire QUEUEING and succeeding, not failing. One tier now, the lower one, consistent with the footer. (Re-trigger commit; no code change.) --------- Co-authored-by: atrawog <[email protected]>
Summary
The
pre-commit-gate.shZERO-ALIASES check had no merge-commit handling. A behind-branchgit mergestages, relative to HEAD (the FIRST parent), everything the incoming branch brought in — includingmain's gofmt-REALIGNED (not new) alias survivors incharly/*_aliases.go. The raw staged-diff scan treated those realigned survivors as branch-added and BLOCKED the merge, so a behind-branch merge could not complete through the gate. This is a systemic R1 defect: it blocks every behind-branch merge that pulls realigned alias survivors in.Root cause (R1)
alias_gateinspectsgit diff --cached(index vs HEAD). During a merge commit, HEAD is only the FIRST parent, so lines/files contributed by the incoming parent look freshly "added". Alias lines thatmainmerely gofmt-realigned trip both the grouped-alias-line check and (for a new alias file added onmain) the new-alias-file check.Fix
The alias gate now reads
MERGE_HEAD(merge_parent_shas) and flags an alias file/line only when it is a genuine addition — present in the merge result but in NEITHER parent (a new alias, or one invented while resolving a conflict). A survivor merged in from an incoming parent (already vetted on its own landing) is suppressed for both the new-alias-file check and the grouped/explicit alias-line check. Off a merge,merge_parent_shasreturns[]and behaviour is byte-for-byte unchanged.Change class
Hook / workflow scripts (
.claude/hooks/pre-commit-gate.sh,.claude/hooks/gate_test.py). Per the R10 matrix: execute the changed script live. No bed run (there is no runtime container surface).R10 evidence (gate executed live)
bash -n pre-commit-gate.sh→ OK.python3 -m py_compile gate_test.py→ OK.Full suite — 35 cases, 0 failures, including the three new merge cases:
Check-coverage (tests are load-bearing)
Old-vs-new witness (the OLD gate =
origin/main:.claude/hooks/pre-commit-gate.sh, SHAdcded01):Cases 1 & 3 BLOCK on the pre-fix gate (the bug) and ALLOW on the fixed gate; Case 2 proves the fix does not over-suppress (a genuine new alias in a merge is still caught). Every new test would FAIL without the fix.
R0–R10 checklist
Confidence
Assisted-by: Claude (fully tested and validated)— hook-script class, gate executed live, suite green, check-coverage proven load-bearing.Assisted-by: Claude (fully tested and validated)