fix(test): isolate git trust and review output tests from the host (light-tested) - #2653
Open
1688mengdie wants to merge 1 commit into
Open
fix(test): isolate git trust and review output tests from the host (light-tested)#26531688mengdie wants to merge 1 commit into
1688mengdie wants to merge 1 commit into
Conversation
The plain-directory trust test ran git without pinning the search ceiling and the review output tests did not guard against ancestor-repository probes, so a host environment with an enclosing git repository (or git walking upward past the tempdir) changes which directory is adopted as the repository root. The trust test now pins GIT_CEILING_DIRECTORIES at the tempdir parent and feeds a controlled env through the existing inspect_repository_trust_with_env entry point; the invalid lexical .git marker test asserts the marker is never adopted as a repository root and keeps the strict Err when no repository ancestor exists. Test: cargo test --locked -p bitfun-services-integrations --features git --lib --jobs 4 trust (19 passed, 0 failed) + review_git_output (3 passed, 0 failed) AI: This change was assisted by AI and lightly tested.
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.
Closes #2652
Summary
The plain-directory trust test ran git without pinning the search ceiling and the review output tests did not guard against ancestor-repository probes, so a host environment with an enclosing git repository (or git walking upward past the tempdir) changes which directory is adopted as the repository root.
The trust test now pins GIT_CEILING_DIRECTORIES at the tempdir parent and feeds a controlled env through the existing inspect_repository_trust_with_env entry point; the invalid lexical .git marker test asserts the marker is never adopted as a repository root and keeps the strict Err when no repository ancestor exists. (No historical red entries for these suites in our CI ledger; this is a defensive host-environment isolation for host-sensitive suites.)
Changes
Zero production diff; both suites are test-only hardening.
Testing
Environment
Hosts whose tempdir sits inside or above a git checkout (developer machines, some CI images); baseline 32f2427. These suites are not in the remote CI gate (remote only runs file_watch_contracts for this crate) and the local runs above are the verification face; disclosed as defensive host-environment isolation.
AI-assisted change, reviewed and verified as described above (light-tested locally).