Skip to content

fix(test): isolate git trust and review output tests from the host (light-tested) - #2653

Open
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/git-trust-utils-test-isolation
Open

fix(test): isolate git trust and review output tests from the host (light-tested)#2653
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/git-trust-utils-test-isolation

Conversation

@1688mengdie

Copy link
Copy Markdown

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

  • src/crates/services/services-integrations/src/git/trust.rs: reports_a_plain_directory_as_not_a_repository pins GIT_CEILING_DIRECTORIES at the tempdir parent and injects the controlled env via the existing inspect_repository_trust_with_env entry point.
  • src/crates/services/services-integrations/src/git/utils.rs: repository_root_ignores_an_invalid_lexical_git_marker asserts an invalid lexical .git marker is never adopted as a repository root and keeps the strict Err when no repository ancestor exists.
  • Commit: 3feef58 — fix(test): isolate git trust and review output tests from the host

Zero production diff; both suites are test-only hardening.

Testing

  • cargo check --locked -p bitfun-services-integrations --jobs 4 → exit 0
  • cargo test --locked -p bitfun-services-integrations --features git --lib --jobs 4 trust → 19 passed, 0 failed
  • cargo test --locked -p bitfun-services-integrations --features git --lib --jobs 4 review_git_output → 3 passed, 0 failed (the crate has default = [] and its git module tree is behind the git feature gate, so the feature flag is required)

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).

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.
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.

[Bug]: git trust and review output tests can escape the test tempdir through the host environment

1 participant