Repository navigation
Conversation
Git hooks and bisect can export repository selectors that redirect fixture Git commands into the caller's repository. Fixture setup can then overwrite local config and refs. Share the server's existing selector rule with common test setup and the upstream fixture harnesses. Use a throwaway repository to verify that replay workspace setup leaves its config and refs intact, and register the regression with CI. User story: I can run tests from a Git hook or bisect without changing the repository that launched them.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
pingdotgg#38804 landed the test-run cleanup with a second copy of the repository selector filter under shared/testing. Resolve onto main's setup files and keep one filter in @t3tools/shared/gitEnvironment that the server, the test setup and the replay fixture all import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything. What was run on On both commits: create an isolated global Git config; initialize a disposable repository with one Sentinel commit; add a linked worktree on feature; stage change.txt; install a pre-commit hook that runs vp test run src/orchestration-v2/testkit/OrchestratorReplayRestartBackgroundNote.integration.test.ts from apps/server; commit Developer change. Record inherited GIT_DIR and GIT_INDEX_FILE, compare local config and refs, hash the index immediately before and after the hook command, and run git status in the caller's main checkout. Both commits completed successfully: config unchanged, main unchanged, feature pointing to Developer change, index unchanged during the hook, and git status exit 0. How: Manual Linux CLI reproduction in separate checkouts, using real linked-worktree pre-commit hooks and fresh synthetic caller repositories. Captures render recorded CLI output; videos preserve stdout timing at 1x. No live application data was used. Artifacts uploaded through ghdrop; checkouts and scratch data removed. Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened. |
Problem
Running tests from
git bisect runor a git hook can change the repository that started them. Git exportsGIT_DIRand related variables to the command it runs. The test fixtures inherit them, so a fixture'sgit init,git configandgit commitact on the calling repository instead of the fixture's own. We hit this during a bisect: the config that all our worktrees share gainedcore.bare = trueand the fixtures' test[user]identity, and we had to remove both by hand.The server already clears these variables for its own git commands (#35119, #35764). The test fixtures and harnesses don't.
Change
unsetInheritedRepositoryEnvand its sixGIT_*repository variables) fromVcsProcess.tsto@t3tools/shared/gitEnvironment, unchanged. The server imports it from there, so product behavior doesn't change.@t3tools/shared/testing/gitEnv, which removes those variables fromprocess.env. The common test setup (testing/providerEnv.ts) loads it, so it runs before any fixture in every vitest project, including fixtures added later.testscript to@t3tools/provider-testingso CI runs the new test. The package had no tests before.Scope
A bug fix in test setup, with no product behavior change. No issue: the new test shows the bug, and the fix moves one existing function and loads it in test setup.
Verification
packages/provider-testing/src/replayWorkspace.test.ts: it makes a throwaway repository and runs the replay workspace fixture in a subprocess with all six variables pointing at it.mainit fails: the fixture writesT3 Code Test <t3code-test@example.com>into the throwaway repository's config.vp run check:changed origin/mainpasses: format, lint, knip, typecheck, and 423 tests in the 7 test files beside the changes. On macOS this neededTMPDIR=/private/tmp, because of a/varversus/private/varpath difference that fails the same way onmain.Written with gpt-6.2-sol (Codex) in T3 Code. PR text by Opus 5.5 (Claude Code) in T3 Code.