Skip to content

fix(hooks): isolate fixture git context before push - #308

Merged
Mathis (echobt) merged 2 commits into
mainfrom
codex/fix-hook-git-isolation
Sep 21, 2026
Merged

Mathis (echobt) merged 2 commits into
mainfrom
codex/fix-hook-git-isolation

Conversation

@echobt

@echobt Mathis (echobt) commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem and behavior

Pushing from a linked worktree runs the pre-push tests with Git's repository environment. A fixture calling git init could then set the shared repository to bare and stage fixture files in the worktree being pushed. Subsequent repository operations failed even though the push succeeded.

The pre-push hook clears Git's repository-local environment before running its existing checks. A regression performs a real push to a local remote, exercises the hook with a fixture-creating test runner, and verifies that the fixture has its own repository while the original configuration and staged changes remain intact.

Validation

  • Regression fails before the fix and passes afterward
  • Ruff format/lint, mypy, and all 1,076 offline tests
  • Repository and deployment contract checks
  • Wheel/source distribution build and 132 tests from the source archive

Public contract

  • Public APIs, frozen specifications, and signature domains remain unchanged
  • No credentials, challenge content, or production image changes

Review

Draft pending required CI and review checks. Greptile findings, if present, must be resolved on the current revision.

Risk

The change is limited to development tooling. The pre-commit hook retains its Git index context, including partial commits. No runtime migration or release is required.

RetriggerConfidence Score: 5/5

Safe to merge: the linked-worktree push flow preserves the checkout while allowing fixture repositories to initialize independently.

What we checked:

  • Before isolation, the fixture path was not a repository and the linked checkout was mutated. T-Rex
  • Created an isolated local main repository, linked worktree, bare remote, fixture operation, and a real pre-push hook. T-Rex
  • After isolation, the fixture became its own repository with fixture.txt staged; the linked worktree retained only its original staged pending.txt, its index was preserved, and the push completed. T-Rex
  • Ran the focused regression test, which passed and verifies fixture initialization, unchanged main-repository configuration, preserved linked-worktree index, fixture staging, and the pushed ref. T-Rex
  • The existing test asserts the same safety properties: fixture .git exists, main config remains unchanged, the linked index is unchanged, the fixture index contains fixture.txt, and the pushed ref matches HEAD. T-Rex
Summary

The pre-push hook clears inherited Git repository context before its offline checks run, preventing fixture repositories created during those checks from changing the linked worktree being pushed. The added regression test verifies that staged changes, repository configuration, fixture state, and the pushed ref remain correct.

Reviews (1) · Last reviewed commit: "Merge branch 'main' into codex/fix-hook-..."

@echobt
Mathis (echobt) marked this pull request as ready for review September 21, 2026 18:33
@echobt
Mathis (echobt) merged commit 89b9760 into main Sep 21, 2026
6 checks passed
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