CI / ci (push) Canceled after 0s
Port classis full-test.sh (071966e) as Museion's one-command verify loop: run/start/status/summary over detached xcodebuild, per-run pinned xcresult bundles with atomic run-dir allocation (#33/#179), xcresulttool-authoritative counts (#31/#178), zero-match filters fail (#31/#134), --serialized rerun is the record (#30/#147), per- test timeouts + wedge observability (#134). Default scope: MuseionTests. install-hooks.sh + pre-push: no push while any run is live, lint gate scoped to the push's Swift files (bare swiftlint . exits 2 on main — spike/ + one tests file), autofix-rewrite guard. New-ref pushes lint the merge-base delta vs refs/remotes/origin/main and fail closed on unscopable history; a full-ref spelling defeats refs/tags shadowing. scripts/test-full-test.sh: 23-check acceptance rig with an executed-count guard. Four finish-audit rounds; every guard flip-verified both directions. Suite 692/692 through the rail itself. Closes #190
8.0 KiB
8.0 KiB
Port classis full-test.sh as the Museion verify rail + pre-push hook
Date: 2026-11-17 Type: issue Reference: AlexKucera/Museion#190
Goal
One command verifies a branch: port classis's scripts/full-test.sh (source commit 071966e) to Museion with the same CLI (run / start / status / summary), encoding the suite learnings (#33/#179 bundle race, #31/#178 xcresult authority, #31/#134 vacuous green, #30/#147 serialized rerun, #134 wedge family, #177 detached pattern), plus the hook pair (install-hooks.sh + pre-push lint gate, no-push-while-live, autofix-tree guard). The 2026-11-16 retro measured this loop at 29% of all session terminal calls.
What Was Done
scripts/full-test.sh— classis port adapted to Museion: scheme Museion,Museion.xcodeprojat root,-destination 'platform=macOS', default test selection-only-testing:MuseionTests(dropped the moment the caller forwards their own-only-testing— union semantics would make a finer filter a no-op), no default parallel flags (--workers Nopts in,--serializedis the #30/#147 rerun hatch), header maps every encoded behavior to its Museion issue numbers.scripts/install-hooks.sh— idempotentgit config core.hooksPath scripts/hooks, with a trust note (versioned hooks = repo content executes at push).scripts/hooks/pre-push— (1) blocks push while ANY full-test run is live (scans all run dirs, not justcurrent); (2) lint gate scoped to the PUSH's Swift files; (3) autofix guard: a swiftformat pass that rewrites files after verification fails the push.scripts/test-full-test.sh— in-tree pre-push acceptance rig: disposable bare+clone, real hook + real lint tools, 23 checks over every push shape, with an executed-count guard on the verdict.- DOX: root AGENTS.md commands +
scripts/Child DOX Index row; MuseionTests/AGENTS.md Verification names the rail;.gitignore+=_build/. - Finish-audit (4 rounds × 3 reviewers) — accepted fixes: merge-base delta gating for new-ref pushes, delete-ref skip,
--schemepath guard, fail-closed on unscopable history, fullrefs/remotes/origin/mainspelling (anti-tag-shadow), rig's vacuous first check + count guard.
Verification (step-2 gates, 2026-11-17)
./scripts/full-test.sh run— 692 executed / 692 passed / 0 failed / 0 skipped, exit 0 (run twice through the rail itself)../scripts/test-full-test.sh— 23/23, exit 0; all four hook guards flip-verified in both directions this session.swiftformat .— 0/141 files formatted, exit 0.swiftlint lint --quiet— exit 2 from pre-existing error-severity findings (59 inspike/, 1 inMuseionTests/PolishSeamTests.swift:34); this diff touches zero Swift — outside the seam, named here per the finish-up exception.node .gitnexus/run.cjs detect-changes— 3 files, 22 doc symbols, 0 affected processes, risk low (index-relative; the untracked scripts carry no indexed symbols).
Decisions & Rationale
| Decision | Rationale |
|---|---|
| Pre-push lint gate scoped to the pushed diff's Swift files | Bare swiftlint . exits 2 on main (spike/ + one tests file) — a repo-wide gate would block every push forever. The gate guards the push's own files; no Swift in the push → nothing to gate. |
New-ref pushes lint the merge-base delta vs refs/remotes/origin/main; no resolvable base fails closed |
Whole-tree lint on a new branch hits the same pre-existing violations (always-block); a silent skip is a vacuous pass — the #31/#134 class. Orphan-history/missing-ref pushes refuse loudly. |
Hardcoded refs/remotes/origin/main, not $1-derived |
Ponytail + security converged: $1 (remote name or URL) breaks bootstrap pushes to new remotes, URL-direct pushes, and master-default remotes — and buys nothing on a single-remote repo. Full-ref spelling also defeats refs/tags/origin/main shadowing (git resolves short refs through refs/tags/ first). |
Vacuity gate on passed + failed == 0 (skipped ≠ executed) |
A filter matching only skipped tests has zero executed tests; per AC3 that must fail, and "0 passed / 0 failed / N skipped" with exit 0 is a vacuous green. |
No scripts/AGENTS.md child doc |
Contracts live in each script's header + root AGENTS.md index row; four files don't warrant a new doc layer. |
| Classis port fidelity kept (CLI flags, FT_BASE_DIR, allocator walk vs mktemp, status-branch structure) | Upstream alignment: classis bug fixes keep flowing into this copy; deviations were only made where Museion's reality differs (single bundle, default unit-scope filter). |
Rig verdict = executed-count guard (n_checks == 23), never the banner |
The repo's own #31 rule; a deleted/dead check fails loudly (flip-proven: disabling one check yields "22/23 executed"). |
Gotchas & Fixes
| Problem | Root Cause | Fix |
|---|---|---|
swiftlint --quiet | tail -3; echo $? reported exit 0 while swiftlint exits 2 |
Pipe reports the LAST command's exit — the pager's, not the gate's | Run gates bare or read $? from the un-piped command; caught the hook's repo-wide gate shipping unpassable this way |
| Rig's first check never executed ("22/22" was 23 checks with one dead) | check called at line 30, defined at line 33 — bash defines functions incrementally; set -uo without -e swallows the 127 |
Hoisted fails=0/check() above the first call + executed-count guard; all three round-4 reviewers reproduced it |
| First push of any new branch was unconditionally blocked | Zero-sha remote ref took the whole-tree ls-tree path → spike/'s 59 error-severity violations | Merge-base delta vs refs/remotes/origin/main |
Delete pushes printed fatal: bad object 000… |
git diff $rsha $zero-sha on ref deletions |
[[ "$lsha" == "$zero" ]] && continue before the diff |
A reviewer staged a stale pre-push into the index |
Read-only ban violated via git add while checking an exec bit |
git restore --staged + explicit re-verification of git status after every fanout; later goals said "check modes with ls -l" |
| Rig bootstrap broke after the fail-closed fix | The rig's bare repo starts empty — its own first push is a new-ref create with no default ref | Bootstrap seeded with --no-verify BEFORE hook activation (a fresh remote's first push is --no-verify by definition) |
| Orphan fixture push sailed through | git rm -qrf . in the orphan branch deleted the hook itself |
git checkout main -- scripts … to keep the hook in the orphan tree |
Files Changed
| File | Change Summary |
|---|---|
scripts/full-test.sh |
new — detached, xcresult-authoritative verify rail (567-line classis port, Museion-adapted) |
scripts/install-hooks.sh |
new — core.hooksPath installer with trust note |
scripts/hooks/pre-push |
new — live-run scan + push-scoped lint gate + autofix guard |
scripts/test-full-test.sh |
new — 23-check pre-push acceptance rig with executed-count guard |
AGENTS.md |
commands section (rail/summary/install/rig), scripts/ Child DOX Index row |
MuseionTests/AGENTS.md |
Verification names the rail as the sanctioned verify path |
.gitignore |
_build/ (run dirs, logs, bundles) |
Open Items & Next Steps
./scripts/install-hooks.shonce per clone (core.hooksPath is local config)- Pre-existing lint debt:
spike/(59 error-severity) +MuseionTests/PolishSeamTests.swift:34keep bareswiftlint .red on main — tuning.swiftlint.yml(classis-style disables or excludes) is a separate ticket - Deferred port: classis's 25KB
test-full-test.shstub harness for the RUNNER itself (this session pinned the hook only; the rail's ACs were verified via one-off scratch harnesses) - Rejected-with-rationale (audit record): versioned-hooks/formatter-config/forgeable-verdict/symlink/OSC/pidfile-DoS family (repo-write already = code-exec via Swift tests; same-uid ceiling), mktemp-vs-allocator (upstream fidelity),
base==lshaharden (no-new-content push is a correct pass)
Log written by write-log skill