Skip to content

Resolve unit-test Git dependencies through PATH - #2162

Merged
Tyrie Vella (tyrielv) merged 3 commits into
microsoft:masterfrom
tyrielv:tyrielv/unit-test-git-path
Nov 10, 2026
Merged

Tyrie Vella (tyrielv) merged 3 commits into
microsoft:masterfrom
tyrielv:tyrielv/unit-test-git-path

Conversation

@tyrielv

@tyrielv Tyrie Vella (tyrielv) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem and Context

Several unit tests require Git at C:\Program Files\Git\cmd\git.exe.
Release agents provide Git through PATH, but that executable is not at the fixed location.
The authentication and worktree configuration tests fail, while other Git-dependent tests skip.

Changes

  • Add shared, test-only Git discovery that searches PATH in order and returns an absolute executable path.
  • Handle quoted directories with spaces or semicolons. Ignore empty entries instead of searching the current directory.
  • Use the helper in authentication, credential, retry configuration, worktree configuration, and Git process tests.
  • Preserve the existing failure and skip policies when Git is absent from PATH.
  • Report missing Git consistently across authentication integration tests.
  • Keep metadata-only worktree tests on a mock Git path.
  • Keep real Git in the worktree ID unit tests so these tests reject reads of the shared configuration ID.
  • Add unit tests for search order, quoted paths, empty entries, relative paths, and absent Git. These tests use temporary files.

Production Git discovery and native hook executable tests remain unchanged.

A follow-up PR #2163 will examine moving some tests from the unit test suite to the functional test suite due to such dependencies.

Find Git through PATH instead of a fixed system installation directory.
Share the resolver across the Git-dependent test fixtures.
Preserve missing-Git failure and skip policies.
Keep metadata-only worktree tests on a mock Git path.

Add filesystem-only tests for search order, quoted directories, empty
entries, relative paths, and absent Git.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Keep semicolons inside quoted PATH directories.
Add a filesystem-only regression case for that directory shape.
Compare resolved Windows paths without case sensitivity.
Use one Git prerequisite guard across authentication test entry points.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@KeithIsSleeping

Copy link
Copy Markdown

[KeithBot]: ⚠️ 1 issue · iteration 1 (f50985a)

  1. 🟡 Medium Worktree id tests can no longer catch reads of the shared config's id

Approach: Right layer: a test-only PATH resolver replaces every fixed Git path in the unit suite; the product's registry lookup can't see PATH-only Git and is null under MockPlatform.

Validation

  • ❌ Worktree id mutants: head misses 2
  • ✅ Changed fixtures 249/249 at source
  • ✅ Full unit suite 1737/1748 at source
  • ✅ Git only at non-standard PATH: 249/249
  • ✅ No Git on PATH: fail/skip policy kept
  • ✅ FindGitOnPath adversarial PATH probes
  • ✅ PR CI run 42870238961 green

🤖 KeithBot · claude-opus-5.5, gpt-6.1-sol, gemini-4-argon + approach review · reply on a thread to dispute

Resolve Git through PATH in both tests that reject the shared config ID.
Keep all three enlistment constructions on the real Git executable.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@KeithIsSleeping

Copy link
Copy Markdown

[KeithBot]: ✅ Resolved · iteration 2 (7adbf80)

  • Worktree id tests can no longer catch reads of the shared config's id: fixed
  • New changes since iteration 1: no new issues

Validation

  • ✅ Head build with mutant harness
  • ✅ Worktree id mutants at 7adbf80
  • ✅ Id tests with only MinGit 2.56 on PATH
  • ✅ Id tests with no Git on PATH
  • ✅ Config-planting test inventory
  • ✅ CI unit tests, run 42912180288

Approving.

🤖 KeithBot · recheck by claude-opus-5.5 · reply on a thread to dispute

@tyrielv
Tyrie Vella (tyrielv) merged commit 4d06e07 into microsoft:master Nov 10, 2026
35 checks passed
This was referenced Nov 10, 2026
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.

2 participants