Repository navigation
Give fixture git identity per command; no test writes git config identity - #2813
Merged
Merged
Conversation
…tity A fixture that runs `git config user.name ...` writes whatever repository git resolves. When GIT_DIR leaks in (git bisect run from a linked worktree, a hook), that is the caller's repository: on 10-23 source_revision_fixture stamped "Citation fixture" and commit.gpgsign=false into the shared agent-comms .git/config, and test_debt_ratchet stamped "Ratchet test", which 106 real commits then carried. The conftest GIT_* scrub guards the environment, not the writer. tests/fixture_git.py declares the fixture identity once (user.name, user.email, commit.gpgsign) and derives two forms: IDENTITY, the -c arguments for one git command, and ENVIRONMENT, the same settings through git's GIT_CONFIG_COUNT channel for a git the code under test starts. - test_debt_ratchet, test_carry: config writes deleted; the Repository runner passes IDENTITY on every command. - source_revision_fixture: config writes deleted; SourceRepository overrides Repo._run, the one git subprocess, to carry IDENTITY, and git_input passes it too. - test_checkpoint_command: config writes deleted; the checkpoint command commits through its own git, so an autouse fixture sets ENVIRONMENT with monkeypatch. - test_proof_build, test_checkout_submodules, test_order_progress, test_installed_merge, test_phase_evidence: their hand-copied -c identities fold into IDENTITY on the runner. Proof: with GIT_DIR pointed at a scratch bare repository, origin/main's fixtures wrote user.name, user.email and commit.gpgsign into it; these write none. The touched tests pass with HOME set to an empty directory, so no global identity stands in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Test fixtures wrote git identity with
git config, which writes whatever repository git resolves. When GIT_DIR leaked in (git bisect runfrom a linked worktree, or a hook), that was the shared agent-comms.git/config. On 10-23 this put "Citation fixture" pluscommit.gpgsign=falsethere, and "Ratchet test" too, which 106 real commits then carried. The conftest GIT_* scrub guards the environment, not the writer. This fixes the writer: no test writes identity or signing config any more.The owner:
tests/fixture_git.pydeclares the fixture identity once (user.name,user.email,commit.gpgsign). It derives two forms from that:IDENTITY: the-carguments for one git command.ENVIRONMENT: the same settings through git'sGIT_CONFIG_COUNTchannel, for the git that code under test starts.Sites fixed
tests/guards/test_debt_ratchet.py: twoconfig user.*writes deleted. The runner passes IDENTITY on every command, and the per-commit-c commit.gpgsign=falsefolded into it.tests/source_revision_fixture.py:config user.name,user.emailandcommit.gpgsigndeleted.SourceRepositoryoverridesRepo._run, the one git subprocess, to carry IDENTITY, which coverscommit-treeand the tests that commit throughsource.git.git_inputpasses IDENTITY too.tests/test_carry.py: twoconfig user.*writes deleted; the runner passes IDENTITY.tests/test_checkpoint_command.py: twoconfig user.*writes deleted. The checkpoint command commits through its own git (cli_commands.py:1889), so an autouse fixture sets ENVIRONMENT with monkeypatch.-c user.name=...identities folded into IDENTITY on the runner intest_proof_build,test_checkout_submodules,test_order_progress,test_installed_mergeandtest_phase_evidence.Proof
user.name=Ratchet test,user.email=ratchet@example.invalidandcommit.gpgsign=falsein it.user.*orgpgsignkey.-p no:xdistand HOME set to an empty directory, so no global identity can stand in.source_revision_fixturepassed.test_install_announcements::test_failed_rehearsal_does_not_publish_to_the_source_busfailed only because the empty HOME had no.local. It passes with the real HOME.test_clean_changed_lines_cannot_be_offset_with_a_deletioncases (FrozenFieldWrite and BannedVocabulary, under src/agent_comms and src/toad) fail withassert 0 == 1, and fail identically with origin/main's copy of the file. That red is already on main, and no open PR touches the ratchet.Left alone: these sites already pass identity per command, so they cannot leak. They are not folded here because open PRs touch the same files:
test_bus(#2795),test_install_rehearsal(#2556),test_storage_rules(#2801),test_storage_violations(#2469),test_unowned_checkout_work(#2801, #2469) andtest_change_report(#2792).🤖 Generated with Claude Code