You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pre-push gate runs under git's exported GIT_DIR, so it fails tests that CI passes (and vice versa) #141
test-integrityTest/eval integrity: mutation sweep, invariant pinning, assertion strengthverified-on-mainReviewed against current main and the described break no longer exists - nothing to build, close it
.githooks/pre-push runs bun run gate, and git exports its own environment to hooks — GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE, GIT_PREFIX. Every test in the suite therefore runs against this repository when invoked by the hook, and against nothing when invoked by hand or by CI.
Measured on fix/capture-trigger-2x:
invocation
test/init.test.ts
bun test ./test/init.test.ts
6 pass / 0 fail
GIT_DIR=<repo>/.git bun test ./test/init.test.ts
4 pass / 2 fail
Failing: memory_init > writes script pattern memories + an init stamp and init internals > gitRootOf/gitHead degrade on non-git dirs — the second one asserts a temp dir is not a git repo, which GIT_DIR makes false. The repo-scoped capture test (#116) and a serve-host replay also time out under the hook for the same class of reason.
Net effect: the gate's verdict under a hook is not the verdict of the same code path, so it both blocks good pushes and (worse) trains you to reach for SKIP_GATE=1. A local gate you have to override is a local gate you stop believing.
Fix
Implemented in scripts/merge-gate.ts on fix/capture-trigger-2x: build a scrubbed env (drop every GIT_* key) and pass it to every spawned step, logging the count so the scrub is visible rather than magical. Re-running the full gate with GIT_DIR and GIT_WORK_TREE exported is green: 521 unit / 11 e2e / 0 fail.
Follow-up worth deciding
Should the gate scrub more than GIT_*? Anything ambient that changes test behaviour (proxy vars, XDG_*, OPENCODE_*) belongs in the same category. The principle: the gate runs in a defined environment, or its result is not comparable across machines.
A test that changes outcome when an environment variable is added is a test with an implicit dependency. Worth a sweep: run the suite under a few hostile-but-realistic envs and see what else flips.
scripts/merge-gate.ts:18-36 builds a scrubbed env, drops every GIT_* key before spawning each step, and logs the count so the scrub is visible rather than magical:
if(/^GIT_/.test(k)){/* drop */}...if(scrubbed)console.log(`(scrubbed ${scrubbed} GIT_* variables — running under a git hook)`);
Landed in 9e5d3db ("fix(gate): scrub GIT_* so the pre-push hook measures what CI measures").
The follow-up you raised is still open and undecided: should the scrub widen beyond GIT_* — proxy vars, XDG_*, OPENCODE_* — on the principle that the gate runs in a defined environment, or its result is not comparable across machines? Same for your suggested sweep ("run the suite under a few hostile-but-realistic envs and see what else flips"). Both are un-built.
Since #72 is already about making the sweep a standing pre-release gate, that is the natural home for the env-hardening decision rather than keeping this ticket open for it.
Severity triage 2026-10-30 — reviewed against main @ 525ed89 (v0.14.24). Labeled verified-on-main: the behavior this ticket describes no longer exists, so there is nothing to build. Full-suite baseline at that commit: 722 pass / 12 skip / 0 fail. Closing is your call; the evidence is here so the claim is checkable rather than asserted.
Closing on the verified-on-main call. The fix is in main: scripts/merge-gate.ts scrubs every GIT_* variable from the environment before running the suite, and its comment records the measurement from this ticket (test/init.test.ts 6/6 green -> 2 failures on GIT_DIR alone).
test-integrityTest/eval integrity: mutation sweep, invariant pinning, assertion strengthverified-on-mainReviewed against current main and the described break no longer exists - nothing to build, close it
Activity
abogartz commentedon Oct 30, 2026
Fixed — the gate scrubs git's environment
scripts/merge-gate.ts:18-36builds a scrubbed env, drops everyGIT_*key before spawning each step, and logs the count so the scrub is visible rather than magical:Landed in
9e5d3db("fix(gate): scrub GIT_* so the pre-push hook measures what CI measures").The follow-up you raised is still open and undecided: should the scrub widen beyond
GIT_*— proxy vars,XDG_*,OPENCODE_*— on the principle that the gate runs in a defined environment, or its result is not comparable across machines? Same for your suggested sweep ("run the suite under a few hostile-but-realistic envs and see what else flips"). Both are un-built.Since #72 is already about making the sweep a standing pre-release gate, that is the natural home for the env-hardening decision rather than keeping this ticket open for it.
Severity triage 2026-10-30 — reviewed against
main@525ed89(v0.14.24). Labeledverified-on-main: the behavior this ticket describes no longer exists, so there is nothing to build. Full-suite baseline at that commit: 722 pass / 12 skip / 0 fail. Closing is your call; the evidence is here so the claim is checkable rather than asserted.abogartz commentedon Nov 2, 2026
Closing on the verified-on-main call. The fix is in main: scripts/merge-gate.ts scrubs every GIT_* variable from the environment before running the suite, and its comment records the measurement from this ticket (test/init.test.ts 6/6 green -> 2 failures on GIT_DIR alone).