Repository navigation
fix(harness): charly_worktree_remove must not report a removal it never performed (#410) - #426
Conversation
…er performed (#410) `pi.exec` RESOLVES on a non-zero exit: pi 1.0.4's `exec` delegates to `execCommand`, whose promise resolves `{stdout, stderr, code, killed}` in EVERY branch, its own internal catch included. The `catch`-gated `--force` retry was therefore unreachable dead code, and a removal git had refused printed success — measured: ONE `worktree remove` call in the exec log while the worktree was still registered in `git worktree list`. - drive every recovery step from the observed RESULT (`code`/`stderr`), never a rejection; - a refused removal FAILS (`isError: true`) instead of printing success; - report the OBSERVED effect (`removed`), so what it says happened is what happened; - replace the ancestry test `git branch --merged origin/main` — blind to the org's squash landing, so every landed `feat/` branch leaked — with a squash-true patch-id proof (`git cherry`, `- <sha>`), and KEEP an unlanded branch, saying so instead of claiming it was removed. The gate that owns this surface read the extension's TEXT and stayed green through all of it: `scripts/check-pi-gates.mjs` now also LOADS the shipped module (Node type-stripping, stand-ins for its only runtime bare import and for `ExtensionAPI`, whose `exec` mirrors the proven real contract) and FIRES the gate and the tool against real git repositories. The gate now prints 8 PASS lines — 1 aggregated static reading (properties 1-5) plus 7 FIRED assertions; all 18 self-test mutations are caught. Against origin/main's extension the static reading still PASSES and 5 of the 7 fired assertions go RED (the other two, the gate's BLOCK decision and the SOUL re-injection, pass there too — that wiring was sound). No assertion was weakened: the static reading is unchanged and all 12 original mutations still go red. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code/config ( Comment thread: 0 comments — nothing to disposition. Blocks
Note (non-blocking)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — no injected instructions, secrets, exfiltration, dependency/pin changes, or guardrail weakening; the diff strengthens both the extension gate and its check script. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
Cluster C8's
opencharly/opencharly#410.scripts/check-pi-gates.mjsasserted the pi gateextension by matching its text, so the surface was "asserted by nothing" that could see
behaviour. This change fixes the defect the text could not see and gives the surface the gate
that can.
The defect (root cause, proven from the shipped pi runtime, not inferred).
charly-gates.tswrapped its
git worktree removeintry { … } catch { … --force … }.pi.execnever rejects:pi 1.0.4's
execdelegates toexecCommand, whose promise resolves{stdout, stderr, code, killed}in every branch, its own internal catch included. So the--forceretry was unreachabledead code and a removal git had refused printed success.
The fix. Every recovery step is driven by the observed result (
code/stderr), never arejection; a refused removal returns
isError: trueinstead of a success string; the reportcarries the observed effect (
removed). The branch arm replaces the retired ancestry testgit branch --merged origin/main— blind to the org's squash landing, so every landedfeat/branch leaked — with a squash-true patch-id proof (
git cherry->- <sha>) and-D, and anunlanded branch is kept and named as kept. The legacy ancestry path is deleted, not left
beside the new one.
The gate.
scripts/check-pi-gates.mjsnow also loads the shipped module (Node's nativetype-stripping, a stand-in for its only runtime bare import
typebox, and anExtensionAPIstub whose
execmirrors the proven real contract) and fires the gate and the tool againstreal git repositories. No assertion was weakened: the aggregated static reading is unchanged and
all 12 pre-existing mutations still go red.
How tested
The change-class gate is
scripts/check-pi-gates.mjs— the file this diff edits. The umbrellacarries no per-repo workflow beyond
tag-on-merge.yml(discovered, not assumed:gh api repos/opencharly/opencharly/contents/.github/workflows --jq '.[].name'->tag-on-merge.yml), so the gate that owns this change class IS thescripts/check-*.mjsfamily.Every command below was executed on head
f128afda5d4881ec9c7d6d1cb95a72b91b47182f; the gate is charly-free, so its transcript iswarning-free — zero
WARNINGlines.The self-test output is pasted in full — all 18 mutation lines, then the unmutated-copy check
and the terminal line. The earlier revision of this body pasted only the last 7 lines while
claiming 18; that mismatch was mine and it is corrected here rather than re-counted:
That is 12 pre-existing mutations plus the 6 added here, i.e. the 18 the count refers to.
R7 — the new coverage FAILS without the change. The same gate, run with
--rootagainst acopy of the merge-base extension (sha
91e61db7228ef42f813d39a08d4d51e61efefbbb), keeps thestatic reading green — the old gate was blind — and turns 5 of the 7 fired assertions RED:
The two fired assertions that stay green there (the gate's BLOCK decision and the SOUL
re-injection) are correct: that wiring was already sound; they are pinned so a future
weakening is caught, and the two
--self-testmutations that keep every static assertion greenwhile breaking them show they are not decorative.
The sibling harness surfaces are unchanged and still green on this head:
The R5 sweep, with its command and output pasted:
Exactly two hits, both explanatory comments written by this change; the executed mechanism is
gone from the extension. The third hit is the
--self-testmutation that restores the retiredcommand verbatim, which is why the mutation proves the assertion is live.
Host-condition notice in the supplementary hook transcript — RCA, not a dismissal. The
clone-level pre-commit hook (
hooks/pre-commit, installed viacore.hooksPath=hooks) was run onthis head and exited 0, printing
pre-commit: OK; it runstask policy-b,task self-test, thisfile and the four sibling
check-*.mjsgates. Its two charly-driven steps emit the dev-buildnotice, which a previous revision of this body disposed of with a parking phrase. That is
corrected here with the RCA the org already settled, read from the emitting code rather than
asserted:
charly/charly/plugin_loader.go:warnSkippedFHSPlugins()(:452-465) printsit once per process; it is called from
bakedPluginDirs()at:490underif !packagedInstall().when the running binary is not at
/usr/binor/usr/local/binAND/usr/lib/charly/pluginsholds
*.providers— both true here (command -v charly->/usr/bin/charly, but theworktree binary is not FHS-installed;
ls /usr/lib/charly/plugins/*.providers | wc -l-> 10)../charly/bin/charly versionprints2026.280.1725on stdout and the notice on stderr,exit 0. No file this PR touches is read.
UNAVAILABLE).
opencharly/.github#172records the achievable route as "a host without theFHS
charlypackage, or a run from an installedcharlybinary". On this host the installedbinary is too old for this tree's schema, so it cannot run the gate at all:
/usr/bin/charly version->2026.268.1917, and/usr/bin/charly task policy-b->charly: error: command "task": load project: …/charly/charly.yml:doc0: node check-kubevirt-vm-vmi: cue decode: cpu: cannot use value {cores:2} (type struct) as int,exit 1. The worktree-local build is therefore REQUIRED here (R9), and a charly-driven
transcript cannot be warning-free on this host.
opencharly/charly#801(CLOSED, NOT_PLANNED — operatordisposition: "leave it, disclose, don't land … every worktree-produced gate transcript carries
the notice with a one-line disclosure") and
opencharly/.github#172(CLOSED, refuted: "Norulebook or org-variable change is made or sought"; the residual B5-wording question is
operator-owned). No new issue is filed because both homes are already adjudicated, and filing
a third would be a duplicate of a settled matter.
CHARLY_PLUGIN_ONLY=1silences it, and BOTH adjudications rule thatout:
.github#172calls it "a resolution switch / masking, not a fix", andcharly#801statesit "is not to be used as a log filter to silence it". Using it would be the R4 workaround
this evidence contract exists to catch, so the notice is disclosed instead of hidden.
RDD spike (the cluster's named unknown, run FIRST). The ledger asks: load each harness
config and FIRE its gate, not merely parse it. Spike (
/tmp/hb-spike/spike.mjs, thrown away):mkdtemp a scratch root, copy the REAL
.claude/hooks/gates + the REAL extension +SOUL.md,write a 6-line
typeboxstand-in, import under Node 26 type-stripping, drive the handlers with astub
ExtensionAPI. It LOADS and FIRES, and it confirmed this defect before the fix — the toolprinted
Worktree …/.worktrees/spike-dirty and branch feat/spike-dirty removed.while thedirectory survived and the exec log held exactly ONE
worktree removecall, no escalation. Itsown narrow copy of
.claude/hooks/(two.shfiles, no siblinggitcmd.py) is what produced aModuleNotFoundErrorthat made the gate fail closed; the shipped gate copies the directorywhole. That mechanism is what this change ships.
Rulebook compliance
git-workflow,strict-policyandagentsloaded before the firstaction, and
git-workflow's pre-validator self-audit reference re-read at the push step.home: (a) the first commit was blocked by
pre-commit: charly binary missing— the sessionworktree had no
charly/materialized; fixed by materializing with--referenceand buildingthe worktree-local binary (R9), no bypass; (b) the spike's
ModuleNotFoundErrorwas its ownnarrow copy set, fixed by copying
.claude/hooks/whole; (c) my first commit message carriedunmeasured counts (it said six original mutations and "20/20"), measured and corrected to 18/12
while still unpushed; (d) the host-condition notice, above, with its emitting code, its
measured condition, its measured independence, its unavailable named alternative, and the two
closed adjudications that carry it. The owning gate's transcript is warning-free.
polarities (squash-merged and unmerged) and both removal outcomes (removed and refused) are
fixed and asserted here; no follow-up PR and no unowned deferral. The host-condition notice is
routed to its named, already-adjudicated homes rather than parked.
replacing them, because they prove a DIFFERENT claim (the static ones still catch a renamed
path or a dropped hook; firing catches a wrong contract). One load-and-fire helper serves all
seven fired assertions and one shared mutation list serves all 18. No third issue is filed for
a matter two closed issues already own.
step is driven by the observed exit code and a refusal fails loudly.
CHARLY_PLUGIN_ONLY=1isNOT used to silence the notice, per both adjudications. Where the RDD probe could not reach a
state with real git, the guard was not shipped as an unreachable branch — the effect became
asserted data with a reachable fixture on both polarities.
description:is corrected in the same commit so the prose cannot advertise a removalcapability it does not have.
git branch --merged origin/mainis gone from the shipped extension, with the claim-keyed grep and its output.
git status --shortclean after the commit; no force-push, no historyrewrite, no hook bypass. The one blocked commit attempt was resolved with the remedy the gate
itself names (
git commit -F <file>), never--no-verify; the branch was amended only whilestill unpushed.
coverage fails without the change (5 RED on the merge-base extension).
.claude/hooks/gate scripts and realgitin real repositories; no mock of git and no mock of the gates. The only stand-ins are theharness API itself, and
ExtensionAPI.execdeliberately mirrors the contract read out of theshipped pi binary and its upstream source rather than a convenient one.
detailsand text are the artifactunder test; the assertions read
details.removed,details.branchStateand the text.charly/scripts/bootstrap-charly.shproduced (2026.280.1725), never a shared install — andthe installed
/usr/bin/charlyis measurably incompatible with this tree, above.and its umbrella gate script; no runtime, image, pin or gitlink change), so the owning gate is
the
scripts/check-*.mjsfamily plus the changed path executed live — both pasted above.charly task verifyis not the gate here.Change classification
Non-
.md, code/config change class:git diff --stat $(git merge-base origin/main HEAD)..HEADlists
.pi/extensions/charly-gates.tsandscripts/check-pi-gates.mjsonly (2 files, 348insertions, 24 deletions).
documentation reviewedis therefore forbidden. R10 gate: thescripts/check-*.mjsfamily owning this change class, on the final committed tree, plus thechanged path executed live. Attribution tier: fully tested and validated — the change-class
gate passed on the final tree with zero findings, the changed path was executed live, and the
gate's own transcript carries zero warnings.
Closes #410.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)