Repository navigation
feat(hooks): golangci-lint pre-commit criterion (cutover B) - #65
Conversation
pre-commit-gate.sh gains a Go-lint criterion: a git commit staging a *.go
change whose touched MODULE is not golangci-lint-clean is BLOCKED (exit 2).
Closes the gap the P10 VM-CLI cutover exposed - its 21 orphaned dead symbols
slipped through because the prior gate ran go test + the F11 gate but never
the linter; golangci-lint's unused is exactly what catches that class.
- pre-commit-gate.sh: new assert_go_lint + go_modules_touched - the CONFIGURED
golangci-lint run per touched module (never --fix / --enable-only),
GOWORK=off for candy/plugin-* candies, whole-MODULE analysis (unused needs
whole-package), fail-OPEN when golangci-lint is absent or times out (the
pr-validator remains the real gate). Tier-independent; a docs/CHANGELOG
commit stages no *.go so the linter never runs.
- gate_test.py: 3 new cases (65 total, 0 failures) - unused symbol -> BLOCK,
clean module -> ALLOW, docs-only in a Go repo -> ALLOW. BLOCK/ALLOW cases
guard on golangci-lint being installed (the gate fails-OPEN without it).
- CLAUDE.md: the Hooks doctrine PreToolUse-gates enumeration gains the criterion.
- plugins gitlink -> the doctrine half (agents + go-quality skills).
Gate (hook-script change class - parse + execute the changed script live):
python3 .claude/hooks/gate_test.py = 65 cases 0 failures; bash -n clean; live
throwaway-repo tests confirmed BLOCK on func dead(){} / ALLOW clean / ALLOW
docs-only. The cutover's own commits stage no *.go, so no self-block.
Assisted-by: Claude (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
pr-validator — APPROVED ✅Change class: hook / test-script ( Independent re-validation (I re-ran every gate myself):
Hook-behavior accuracy — Checklist: 0 security/anti-tampering (additive, STRENGTHENS the gate — T4 self-modifying-security satisfied: strengthens + explicit P10 justification) · 1 description complete w/ pasted evidence · 2 change-class gate matches (R7/R10, no fraud) · 3 tier justified · 4 R0 skills honored · 5 R1 zero-warnings · 6 R2 no split (doctrine half already merged, producer→consumer order) · 7 R3 no dup (owned doc-split surfaces) · 8 R4 no ad-hoc (named constant) · 9 R5 sweep complete · 10 R6/R8/R9 N/A · 11 R10 coverage (tests fail without the criterion) · 12 RDD/ADE/SDD N/A (zero Decision: APPROVED. The change is a purely additive, gate-STRENGTHENING pre-commit backstop with correct fail-open semantics, a named timeout, complete R5 doctrine lockstep across all owned surfaces, and check coverage that fails without it. Proceeding to finalize the merge-time CalVer, post the required status, squash-merge, and tag. Assisted-by: Claude (analysed on a live system) |
Rename the placeholder CHANGELOG entry to the merge-time CalVer and align its H1 heading (pr-validator, PR #65). Assisted-by: Claude (documentation reviewed)
pr-validator — merge handoff (validation PASSED ✅)The required status The
Assisted-by: Claude (analysed on a live system) |
Version-stamp commit by the fresh pr-validator: renames the placeholder CHANGELOG to the merge-time CalVer and rewrites its H1 to match. Squashed into the single landing commit at merge. Assisted-by: Claude (fully tested and validated)
The superproject leg of the VM extra-port-forward auto-allocation feature (#65 — the R2 immediate-next from the live 16443 host-port collision between the concurrent check-k3s-vm and check-k8s-deploy-cluster beds). Orchestrator allocation + VmDeployState persistence + resolved renderers + resolved deployVMForwards (k3s kubeconfig rewrite) + the k3s-vm bed conversion to auto:6443. - candy/plugin-vm/vm_util_copies.go: resolveVmPortForwards seam + pure resolvePortForwards core (auto → reuse-persisted-else-allocate; fixed → passthrough; shared occupied set). - candy/plugin-vm/vm_create_orchestrate.go: orchestrator resolves forwards beside ssh, persists VmDeployState.PortForwards keyed by the deploy domain identity, sets rt.ExtraPortForwards. - candy/plugin-vm/libvirt_yaml_bridge.go: buildDefaultInterface renders resolved rt.ExtraPortForwards only (R5 delete of the direct spec read). - charly/k3s_post.go + deploy_add_shared.go + deploy_target_external.go: deployVMForwards keys the port-forward ledger by the DEPLOY/domain identity (the exact orchestrator persist key) while the ENTITY artifactKey names the shared per-VM cache/context; resolveDeployForwards fails loud on an unresolved auto: (R1/R4). (The deploy-vs-entity key mismatch was the defect the first R10 gate caught + this cutover fixed.) - charly.yml: k3s-vm port_forwards: ["auto:6443"]; both hardcoded K3S_KUBECONFIG_SERVER bed overrides deleted; R5 sweep of the 16443 bed-description prose. - candy/k3s-server/charly.yml: K3S_KUBECONFIG_SERVER env_accept doc — optional override only. - sdk gitlink → 3968a3b (go.mod require v0.2026195.22); plugins gitlink → c707e80. Independently validated by a fresh pr-validator: coordinates exact; charly + plugin-vm gofmt/vet/go-test (incl. resolvePortForwards 6 cases + buildDefaultInterface + resolveDeployForwards teeth) / golangci-lint-0; fresh binary rebuilt from the head; R5 grep clean; placement CORRECT. R10 corroborated on the concurrent disposable pair (both ok:true, fresh rebuild): the disk logs show the auto-allocated port + kubeconfig rewrite + k8s probes green for check-k8s-deploy-cluster (a deploy != entity), behaviorally proving the two-identity fix executed live. Not a schema-version bump. Assisted-by: Claude (fully tested and validated)
…name audit (no divergence) Thematic docs batch #27 (Documentation-only; documentation reviewed tier). Fix 1 — status-context name audit: NO divergence found. Verified live branch-protection on charly/sdk/plugins all require charly/pr-validator; a claim-keyed grep found the docs already name charly/pr-validator in every surface. A prior cutover (2026.195.1811) swept the rename. Fix 1 edits no files; recorded for the RCA trail. Fix 2 — CHANGELOG H1 placeholder/heading sweep (5 files fixed: 4 super + 1 plugins): - 2026.193.0607.md H1 0142→0607 - 2026.195.1415.md H1 1400→1415 - 2026.195.1432.md H1 0900→1432 - 2026.195.2253.md H1 9999→2253 - plugins/CHANGELOG/2026.195.2150.md H1 9999→2150 (leg 1, plugins PR #65, merged d1b5b2e) B2 two-leg landing: leg 1 (plugins #65) merged to plugins main as d1b5b2e; leg 2 (this PR) bumps the plugins gitlink 93b3010→d1b5b2e and lands the 4 super H1 fixes + this narrative entry. The plugins H1 fix LANDED as leg 1 — not deferred. R5 grep self-test: claude-validation outside CHANGELOG = 0 (super+plugins+sdk). Merge-time CalVer 2026.196.0606 finalized by the fresh pr-validator (filename + H1 rewrite of the placeholder 2026.196.9999.md). Assisted-by: Claude (documentation reviewed)
…k/buildkit onto spec #55 step 3-III (final B2 leg): charly core + build plugins repoint the build-vocabulary value-type containers buildkit.{DistroConfig,BuilderConfig,BuilderMap,WrapDistroDef,DistroTagChain} → spec.X (+ DistroDef→spec.ResolvedDistro / FormatDef→spec.Format / BuilderDef→spec.Builder), dropping the now-unused sdk/buildkit import where no behaviour symbol remains. Import-purity: charly files importing sdk/buildkit 51 → 42. InitConfig stays in buildkit (init-composition policy → #65/#71). Consumes merged spec v0.2026210.2052 + sdk v0.2026210.2103. Runtime-neutral: the repointed types are type aliases in sdk/buildkit (DistroConfig = spec.DistroConfig, …), so the rename produces byte-identical compiled code — gated by check-pod-overlay 13/13 + check-builder-vm 10/10 on a fresh rebuild. Assisted-by: Claude Code Anthropic Claude Opus 4.8 (fully tested and validated)
The openclaw/selkies family pin chain landed (distro-cachyos #65: 505-candy graph at 0 warnings / 0 errors, tag v2026.247.1647). Advance the box/cachyos submodule to the post-merge distro main b14e4157 — the cachyos import re-vendor (policy B: umbrella mirrors this gitlink). Co-authored-by: atrawog <[email protected]>
Summary
Cutover B —
golangci-lintbecomes a pre-commit criterion.pre-commit-gate.shnow BLOCKS agit committhat stages a*.gochange whose touched MODULE is notgolangci-lint-clean. This is the recurrence-prevention for the exact gap the P10 VM-CLI cutover exposed: its 21 orphaned dead symbols slipped through because the prior gate rango test+ the F11 gate but never the linter, andgolangci-lint'sunusedis precisely what catches that class.Changes
.claude/hooks/pre-commit-gate.sh— newassert_go_lint(repo)+go_modules_touched(repo): finds each Go MODULE (a dir withgo.mod) that has a*.gofile in the commit (staged + the late-staged-a/-i/-oset) and runs the CONFIGUREDgolangci-lint runin each — never--fix(it corrupts the tree per go-quality) nor--enable-only(it breaks the cross-linter dedup).GOWORK=offforcandy/plugin-*candies (they lint standalone as they build). Whole-MODULE analysis becauseunusedneeds whole-package. Fail-OPEN whengolangci-lintis absent or times out (180s) — thepr-validatorremains the real gate. Runs tier-independently (before the tier checks); a docs/CHANGELOG commit stages no*.goso the linter never runs..claude/hooks/gate_test.py— 3 new cases (65 total, 0 failures): unused symbol → BLOCK; lint-clean module → ALLOW; docs-only change in a Go repo → ALLOW. The BLOCK/ALLOW cases guard ongolangci-lintbeing installed (the gate fails-OPEN without it); the docs-only case is tool-free.CLAUDE.md— the "Hooks doctrine" PreToolUse-gates enumeration gains the criterion (R5 — kept in lockstep with the plugins agents-skill doctrine, docs(hooks): golangci-lint pre-commit criterion in the hooks doctrine (cutover B) marketplace#30, whose merge this gitlink bump carries).Change class + tier
Hook / test-script change → the R10 gate for this class is "parse + execute the changed script live." Done:
python3 .claude/hooks/gate_test.py→ 65 cases, 0 failures (the 3 new Go-lint cases included).bash -n .claude/hooks/pre-commit-gate.sh→ clean.func dead(){}→ BLOCK (func dead is unused); a lint-clean module → ALLOW; a docs-only commit in a Go repo → ALLOW (no*.gostaged, linter skipped).Tier: analysed on a live system — the changed hook script executed live with pasted output; no bed applies to a commit hook. The cutover's own commits stage no
*.go, so the new criterion does not self-block.Verification the doctrine matches the code
The plugins doctrine half (opencharly/marketplace#30) describes the criterion; its validator cross-checked the doctrine text against this actual hook. R5: the two authoritative hooks-doctrine surfaces (CLAUDE.md here + the agents skill in plugins) are updated in lockstep.
Assisted-by: Claude (analysed on a live system)
https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif