fix(gate): strip git hook-env overrides; fixture/.cargo routing; tsx fallback for fresh worktrees - #809
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three gate fixes discovered while pushing the codex flake fix (each verified live):
GIT_DIR leak corrupted the shared repo (critical).
git pushfrom a linked worktree exportsGIT_DIR=<worktree-gitdir>into the pre-push hook; unstripped it leaked throughcargo testinto every test-side git child. freshell-server's git-touching tests then resolved against the SHARED repository instead of their tempdirs:git initre-initialized the main checkout's config (writingcore.bare=true, colliding onconfig.lockacross 96 parallel tests), and one test's add/commit landed a rogueinitcommit on main's HEAD. Reproduced solo with the capturedGIT_DIRvalue (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.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.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.