Skip to content

fix(gate): strip git hook-env overrides; fixture/.cargo routing; tsx fallback for fresh worktrees - #809

Merged
danshapiro merged 2 commits into
mainfrom
fix/pre-push-hook-env
Sep 19, 2026
Merged

danshapiro merged 2 commits into
mainfrom
fix/pre-push-hook-env

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Three gate fixes discovered while pushing the codex flake fix (each verified live):

  1. GIT_DIR leak corrupted the shared repo (critical). git push from a linked worktree exports GIT_DIR=<worktree-gitdir> into the pre-push hook; unstripped it leaked through cargo test into every test-side git child. freshell-server's git-touching tests then resolved against the SHARED repository instead of their tempdirs: git init re-initialized the main checkout's config (writing core.bare=true, colliding on config.lock across 96 parallel tests), and one test's add/commit landed a rogue init commit on main's HEAD. Reproduced solo with the captured GIT_DIR value (exact panic + config damage); damage repaired locally. The hook now unsets the git env overrides before any lane runs — its own git calls use cwd discovery, which is equivalent in a worktree.

  2. Routing gaps. The trigger grep and the CI changes-filter both missed test/fixtures/ (cross-crate rust-test infrastructure — a fixture-only PR would skip cargo test everywhere) and the trigger missed .cargo/. Both now route in; fixtures and .cargo/ widen to the workspace lane.

  3. tsx resolution fallback. Fresh worktrees have no node_modules, so the rust test lane silently skipped on every worktree push (feat(gate): targeted cargo test lane at push time + required rust-gate CI check #803's own worktree masked this). tsx now also resolves from the owning checkout via the git common dir; hermetic hook tests no longer depend on the worktree's install state (a stub tsx delegates to the owning checkout's real one).

Verification: 26/26 hermetic routing tests (red/green on both fixes — polluted-GIT_DIR and fixture-routing cases fail pre-fix), typecheck green, this branch's own push exercised the typecheck-only path.

t added 2 commits September 19, 2026 15:11
…llback for fresh worktrees

- The gate's trigger and the CI changes-filter both missed test/fixtures/
  (cross-crate rust-test infrastructure — a fixture-only PR would skip
  cargo test everywhere) and the trigger missed .cargo/ (the plan routed
  it workspace but the trigger never fired). Both now route in; fixtures
  and .cargo/ widen to the workspace lane.
- tsx resolution now falls back to the owning checkout (derived from the
  git common dir), so fresh worktrees without node_modules still run the
  rust test lane instead of silently skipping (#803's own worktree had
  node_modules and masked this).
- Hermetic hook tests no longer depend on the worktree's install state:
  a stub tsx in the fixture repo delegates to the owning checkout's real
  tsx.
… corrupted the shared repo

git exports GIT_DIR/GIT_PREFIX (the pushing worktree's gitdir) into the
pre-push hook. Unstripped, they leak through cargo test into every
test-side git child: freshell-server's git-touching tests then resolved
against the SHARED repository instead of their tempdirs — 'git init'
re-initialized the main checkout's config (observed writing
core.bare=true and colliding on config.lock across 96 parallel tests),
and one test's add/commit landed on main's HEAD. Reproduced solo with
GIT_DIR=<worktree-gitdir> (exact panic) and repaired the damage twice.

The hook's own git calls use cwd discovery (equivalent in a worktree), so
unsetting the overrides is behavior-neutral for routing. Hermetic red:
a polluted GIT_DIR broke the hook's routing git calls pre-fix.
@danshapiro
danshapiro merged commit 9bdc8f6 into main Sep 19, 2026
3 checks passed
@danshapiro
danshapiro deleted the fix/pre-push-hook-env branch September 20, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant