ci: the whole seam gate is toothless — set -e is suspended inside seam(), so every stage but the last is unable to fail a run #871
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#871
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while working #867 (its step 3 asks whether the
ciseam stage was actually failing on the vendored-harness drift). The answer is no, and the reason is not specific to that stage.The defect
scripts/seam-smoke.shruns its whole body through one function and captures the result like this:The comment states the opposite of what bash does.
set -eis suspended for any command executed as anifcondition, and for any non-final element of a pipeline — and that suspension propagates into a called function's body.seam()is both. So no failing command insideseam()aborts it; every later stage runs anyway; andseam()returns the exit status of its last command only.Minimal repro, exactly the shape of the real line:
falseneither abortedfnor reddened the run.What this means in practice
seam()'s stages in order: toolchain, Factory core drift, TypeScript install, OpenAPI generated-client contract, the mermaid/theming contracts, both languages' builds, vets, tests and linters, and finally thebrokermodule's( cd broker; go build; go vet; go test; golangci-lint run ./... ).Because errexit is suspended,
ci's verdict is the status of that final subshell — which, errexit being suspended there too, is the status of its own last command,golangci-lint run ./.... Every other stage in the gate has been advisory output. A broken OpenAPI contract, a redgo test, a failedpnpm install, a drifted vendored harness: all of them print their failure into the log and the run goes green.This is the same class of fault as #868 (a seam that passes against nothing) but at the gate itself, and it silently weakens every "door stays shut" discipline layered into this script — each of those stages was added because something rotted unnoticed, and none of them could actually shut a door.
It also means the healer's
write_verdictpath has effectively never fired for a non-final-stage fault, so thestage=line it keys incident signatures on has only ever been able to say the last stage.Confirmed hiding behind it right now
check-harness-drift.shexits 1 today (#867,6620f7cahand-edited two vendored files).cihas been green throughout.What else is behind it is not yet known: nobody has seen an errexit-enforced run of this script. Enumerating that is part of this ticket — the fix cannot land blind, because restoring the gate turns every currently-hidden failure into a red
mainat once and stalls the swarm.The fix (proven shape, not yet landed)
Re-arming
set -einside the subshell does NOT work — the suspension survives it:What does work is taking the pipeline out of the condition entirely and reading the failure from an
ERRtrap, keepingpipefailso the pipeline reportsseam's status rather thantee's:faborts at the failing command, the trap fires, the script exits non-zero, andwrite_verdictstill gets the real failing stage off the teed log (which is why the log is read for the stage name rather than a variable — that part of the design is fine and unchanged).Acceptance
scripts/seam-smoke.shis completed and every stage that fails is listed on this ticket — the honest inventory of what the gate has been hiding.seam-smoke.shfails on a non-final stage failure, proven by an offline test that injects a failing stage (there is no test for this today — that absence is why the comment could assert the opposite of the behaviour for months).write_verdictstill writes the correctstage=for a non-final-stage failure.ready-for-session: the inventory run needsnix developand a real toolchain, and the re-arming decision is a judgement about when to letmaingo red — not swarm-sandbox work.Refs: #867 (the drift the gate failed to catch), #868 (a seam proving nothing, at the route layer), ADR 0100.
The inventory — first pass, run on
mainat974962bfRan the seam locally under
nix develop, each stage isolated so one failure cannot hide the next. Fourteen stages:All eleven Go and broker stages are genuinely green, which is consistent with the diagnosis: the gate's real verdict has been
golangci-lint run ./...inbroker/, and that has been passing.RED 1 —
pnpm -r run build: the TypeScript type gate has been broken since 2026-08-25Both files are tracked, both landed with
d9eabfe8(#834, 2026-08-25), andcihas been green on every push since.DEFAULT_TARGETSis exported (scripts/check-mermaid.mjs:141) — the failure is that the app'svue-tscproject has no declaration path for a plain.mjsunderscripts/, so one import resolves to a shape without the member and the other is an implicitany. Notepnpm -r run testPASSES: vitest does not typecheck, so the tests these files contain genuinely run and genuinely pass. It is the type gate that is down, which is exactly the kind of rot the stage exists to catch.RED 2 —
pnpm run lint: one real error, and a much larger reporting problem22,585 errors across 16 files. 15 of those 16 files are git-ignored local build artefacts —
.claude/worktrees/…/mermaid.min.js,app/dist-electron/,app/dist-package/,app/.dev/payload/,test-results/…/trace/*.js— which a fresh CI checkout would not have. So this stage is very likely GREEN on the runner today, and I am not claiming otherwise.The one tracked source file that genuinely fails:
Landed with
d1c78cfd(#822, 2026-08-25). One line, trivially fixable.Worth its own note either way:
pnpm run lintwalking intodist-electron/,test-results/and.claude/worktrees/at all means the eslint ignore config does not track.gitignore. On a developer machine that turns a real lint run into 22k lines of noise around a single genuine error, which is its own reason nobody runs it by hand.What this changes about the fix order
Smaller than feared — two tracked-source failures, both from 2026-08-25, both narrow. That makes re-arming the gate a realistic near-term move rather than a long excavation:
app/tests/unit/mermaidDocs.test.ts+slicesYaml.test.tssovue-tscpasses (a.d.tsfor the twoscripts/*.mjshelpers, or move the helpers into a typed workspace package).wrapperatbackupReplicationMatrix.test.ts:526.pnpm run lintshould honour.gitignore— separate from re-arming, but it will bite the first person who runs the gate locally.ERR-trap fix and its offline test.Caveats on this pass
nix develop, not thematou-workstationrunner. Go 1.23.8 / node 22.16.0 / pnpm 9.15.9 there.ts:lintverdict is confounded by a dirty working tree, as described. A clean-checkout re-run is still owed before step 4.pnpm installran first, which is the only ordering dependency in the script.Ruled by agent under ADR 0174 — veto anytime.
scripts/tests/has ever run in ci — the seam does not reference a single one #873waiting, oldest 23h; ci, healer, triage, resume-asks and broker-deploy are all starved #878The inventory — an errexit-enforced run of every stage (AC1)
Run 2026-08-26 on
matou-workstationinsidenix develop. Method: each stage's own commands re-run in a freshbash -c 'set -euo pipefail; …'child process — a new process is the one shape the errexit suspension cannot leak into (( set -e; … )does not work, as the ticket says; a childbash -cdoes), and running each stage in its own child means the sweep continues past a failure instead of stopping at the first, so the inventory is complete rather than first-red-only.21 stages. 18 green, 3 red.
check-harness-drift.sh)scripts/tests/*.shsweep (#873)pnpm installcheck:client#pnpm -r run build(tsc)pnpm -r run test(vitest)pnpm run lint(eslint)build/vet/test/golangci-lint./...build/vet/test/golangci-lintThe one confirmed-hiding item in the ticket body is stale, in the good direction. Factory core drift is green: #867's hand-edited vendored files were fixed by the
FACTORY_REFbump in974962bf, which landed after this ticket was filed. Nothing is hiding behind that stage now.The three, and what each one was
1.
pnpm -r run build— two TypeScript errors. Both are the same shape: a repo-root.mjschecker imported by a seam test, whose declaration file did not keep up.TS2305— #798 addedDEFAULT_TARGETStoscripts/check-mermaid.mjsand toapp/tests/unit/mermaidDocs.test.ts, but not toscripts/check-mermaid.d.mts.TS7016— #834'sscripts/check-slices-yaml.mjsshipped with no declaration file at all, soapp/tests/unit/slicesYaml.test.tsimported an implicitanyunderstrict.Fixed:
DEFAULT_TARGETSdeclared, andscripts/check-slices-yaml.d.mtswritten to matchcheck-mermaid.d.mts's shape.2.
pnpm run lint— 5,699 errors, and only ONE of them is source. 5,698 come from lintingapp/dist-electron/(packaged main+preload bundles) andtest-results/…/report/trace/(a rehearsal drive's Playwright trace viewer — thousands of minified vendor lines). Both are gitignored, but eslint's flat config does not read.gitignore, and the flatignoreslist had**/dist/**without**/dist-electron/**ortest-results/**. So the lint stage's verdict depended on whether the checkout happened to have driven or packaged once — a stage that is red on a working machine and green on a fresh clone. Both ignored now, same class as the**/dist/**already there.The 1 real error is genuine and fixed: an unused
wrapperbinding indashboard/tests/unit/backupReplicationMatrix.test.ts:526(the mount itself is load-bearing — it is what makesclient.readsreach 1 — so the call stays, only the dead binding goes).3.
scripts/tests/rehearsal-rented-target-test.sh— readsREHEARSAL_KEEP_RED_DROPLETfrom the AMBIENT shell. Case 4 ("a matching IP is deleted by its id") assumes keep-on-red is off; cases 7/8 set it explicitly per-invocation. But it is a standing export on the workstation's rehearsal executor, so it is in the environment of any shell on that host — including this session, and including the host-modecirunner. The test was therefore red on the one host it most needs to pass on and green everywhere else. The test now unsets it: a test's preconditions belong to the test, never to whoever's shell it runs in.Note this stage already had teeth before today's fix (#873 made it
return 1rather than lean onset -e), so this one was not hidden by #871 — it was hidden bycinot having run since 05:41 (see the residue below).AC2 — none deferred
All three are fixed in
96f425ca, not filed. None needed an owner ticket.A second defect, found by the test rather than the inventory
write_verdictcould not survive its own errexit.errs="$(grep -hiE …|grep -v|tail -12)"exits 1 when nothing matches,pipefailhands that to the command substitution, and the assignment failing under a now-liveset -ekilled the writer before it wrote anything. So exactly the quiet failures that most need a verdict — a stage that dies without printing an error-ish line — would have produced none, and the run's exit code would have been flattened to grep's1instead of the stage's real code.This was latent in the old shape too (
write_verdictwas called from anif-body, where errexit is live), it just could never be reached, because the only stage that could fail was the last one and it always printed something. My test caught it on the first green attempt: the injected stage exits 3 silently, and the assertionexit=3failed with1. Every capture inwrite_verdictis|| true-guarded now.AC3/AC4 — the proof
scripts/tests/seam-errexit-test.sh, 10 checks, red before the fix withFAIL: a failing non-final stage did not redden the run (exit 0) — the gate is toothless.It injects a failing stage into the real script: only
seam()'s body is swapped (for a synthetic ALPHA/BETA/GAMMA), so the errexit preamble,stage(),write_verdict()and the runner block under test are the committed file verbatim, and the swap asserts it actually took. It proves:seam()stops AT the failing command — neither the rest of that stage nor any later stage runs;write_verdictwritesstage=INJECTED-STAGE-BETA, the failing stage, not the last one;if/while/until seam,seam …&&/||,! seamare all asserted absent, and the ERR trap asserted present. The defect was one line under a comment asserting the inverse of it, so the shape itself is pinned.It lives in
scripts/tests/, so #873's sweep runs it from the nextcionward.And the whole thing end to end: a full errexit-enforced run of
scripts/seam-smoke.sh— 12 stages, exit 0,seam smoke OK, no verdict file left behind. Re-run again after rebasing onto #868/#753, and the Go half again after #875 landed.The fix
Exactly the ticket's proposed shape, with
local ec=$?as the trap's first statement:GOTCHAS #93 carries the rule, both footguns (the harness's, and
write_verdict's), and the inventory.Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: one commit, revertible; every claim above is reproducible with
bash scripts/tests/seam-errexit-test.shandnix develop -c bash scripts/seam-smoke.sh.Residue — and it is not small
cihas not fired since34c0863aat 05:41 today. Eleven main pushes have produced zero runs, including this fix. I applied the remedy the workflow's own header documents (touch.forgejo/workflows/ci.ymland push,c45adc47) — it did not work. APOST .../actions/workflows/ci.yml/dispatchesreturns204and produces no run either, while Forgejo servesci.ymlatmain(200) and hasc45adc47as the branch head. Scheduled workflows (triage,resume,watchdog) keep running normally, so the instance and the runner are alive; it is this workflow's push and dispatch events that go nowhere.So the gate is armed but not firing. From
main's point of view those are the same outcome, which is why I am naming it here rather than letting a green ticket imply a working gate. Filed as its own ticket.Close report
Landed:
96f425ca(the fix) andc45adc47(the ci re-registration attempt), onmain.What changed
scripts/seam-smoke.shwrite_verdict's captures|| true-guarded; the #873 stage's now-stale "#871 suspends errexit" comment correctedscripts/tests/seam-errexit-test.shscripts/check-mermaid.d.mtsDEFAULT_TARGETSdeclared (#798's miss)scripts/check-slices-yaml.d.mtsdashboard/tests/unit/backupReplicationMatrix.test.tswrapperbindingeslint.config.mjsdist-electron/+test-results/build outputscripts/tests/rehearsal-rented-target-test.shREHEARSAL_KEEP_RED_DROPLETdocs/GOTCHAS.mdSTATUS.mdAcceptance
974962bffixed it after this ticket was filed.scripts/tests/seam-errexit-test.sh: red before (a failing non-final stage did not redden the run (exit 0) — the gate is toothless), 10 checks green after. Swept by #873's stage, so it runs incifrom now on.write_verdictwritesstage=INJECTED-STAGE-BETAfor a non-final failure, asserted; plus theexit=code is the failing stage's own (3), not a flattened 1.Proof
bash scripts/tests/seam-errexit-test.sh→seam-errexit: 10 checks passednix develop -c bash scripts/seam-smoke.sh→ 12 stages, exit 0,seam smoke OK, no verdict file. Run twice (before and after rebasing onto #868/#753), plus the Go half again after #875 landed.BETA-CONTINUED-PAST-ITS-OWN-FAILURE→ GAMMA →seam smoke OK, exit 0.Two things this session found that the ticket did not ask for
write_verdictcould not survive its own errexit — a no-matchgrepunderpipefailkilled the writer before it wrote anything, so a quiet failure would have produced no verdict and a flattened exit code. Latent under the old shape, fatal under the new one. Caught by the new test, not by inspection.cihas not fired at all since 05:41 today — eleven pushes, zero runs; the documented re-registration touch failed, andworkflow_dispatchreturns 204 and produces nothing while scheduled workflows keep running. Filed as #880 (bug,priority,ready-for-session), with the full ruling-out. This fix has therefore not been verified byciitself — only locally, twice, end to end. That is the honest limit of what this session can claim, and #880 is the ticket that closes it.Ruled by agent under ADR 0174 — veto anytime.
waiting, oldest 23h; ci, healer, triage, resume-asks and broker-deploy are all starved #878stack-config+community-dataendpoints, andstackExportwired in production #1429as unknown as, six TS7006 errors in the dashboard build #1795