Repository navigation
fix(tests): use /dev/null as the empty global git config on Windows too - #8746
andrew05060414 wants to merge 3 commits into
Conversation
…tform Git for Windows 2.56 rejects GIT_CONFIG_GLOBAL=NUL with "fatal: unable to access 'NUL': Invalid argument". The test fixture env and the preload's git config guard both set it on win32, so every fixture repository and the guard's first check failed on that git. Git for Windows maps /dev/null to its null device, and a git that did not would read the path as a missing file, which is also an empty config. One exported constant now feeds the fixture env, the guard and the oracle, and a new case runs the installed git with the fixture env.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
|
Merge-manager review: correct as is. One wording nit for a later touch: the comment in |
…dows git config, test network guard) (#8870) Lane R5 of the 2026-11-17 triage round: read zh-CN and ko-KR schtasks status words in the Windows checked stop (#8863), use /dev/null as the empty global git config on Windows (#8746), and refuse real network egress from the test process (#8848). Co-authored-by: andrew05060414 <wsy1731095638@gmail.com>
Summary
Problem. On Windows with Git for Windows 2.56, a large block of the test suite fails on every branch for reasons unrelated to the code under test. The shared test git environment (
tests/helpers/git-fixture.ts) and the preload's.git/configguard (tests/helpers/git-config-guard.ts) setGIT_CONFIG_GLOBAL=NULon win32, and git 2.56 refuses that value outright:So every fixture repository fails to initialise, and the guard reports "git could not parse the checkout's common .git/config" on the first case of every file. Contributors on Windows currently work around it by pointing
OCX_GIT_CONFIG_GUARD_CHECKOUTat a directory with no.git, which also switches the guard off.After this PR. The empty global config is
/dev/nullon every platform, exported once asEMPTY_GLOBAL_GIT_CONFIGand used by the fixture env, the guard, and the isolation test's oracle env. Linux and macOS behaviour is unchanged (they already used/dev/null).Why
/dev/nullis safe on Windows. Git for Windows maps/dev/nullto its null device (verified on 2.56 from a native Bun spawn, not only from Git Bash). A Git for Windows build that did not map it would see a missing file, which git treats as an empty global config — the intent either way. Probed on 2.56 from Bun:NUL→ exit 128;/dev/null,nul→ exit 0.Details.
tests/helpers/git-fixture.ts: new exportedEMPTY_GLOBAL_GIT_CONFIG = "/dev/null"with the reason in a comment;fixtureGitEnvuses it.tests/helpers/git-config-guard.ts: imports the constant instead of its ownNULbranch.tests/ci-workflows/test-git-isolation.test.ts: oracle env and the env assertion use the constant; a new case runs the installed git withfixtureGitEnv()(git config --global --list) and requires exit 0 with empty stderr, so a git that rejects the value fails loudly instead of failing dozens of unrelated cases.devlog/_plan/261113_test_git_env_isolation/010_phase1.md: the one line describing the old per-platform value.Verification
Windows 11, Git for Windows 2.56.0.windows.1, Bun 1.4.4. Same 12 files on clean
upstream/dev(873ec9b) and on this branch, run withbun scripts/test.ts <files>and without theOCX_GIT_CONFIG_GUARD_CHECKOUTworkaround: every file that importstests/helpers/git-fixture.tsor the guard (ci-workflows/{build-release-changelog,ci-gui-typecheck-gate,ci-review-lanes,ci-test-lane,release-version-sources,repo-hygiene,repo-import-resolution,structure-ssot,test-git-isolation,test-runner},gui/platform-dialog-guard,test-layout-tooling).upstream/devThe 2 remaining failures also fail on
upstream/devand are not caused by the null-device value:test-runner > changed-mode uses the shared merge base…hits the 5 s timeout insidecommitFixtureon this Windows host, andtest-git-isolation > test preload > fails the case after which the guarded checkout's config changednow reaches the guard correctly (it reportsuser.name changed) but the probe output on Windows does not contain the(pass) leaves the config aloneline the assertion looks for. Both are left for a separate change.bun run typecheck— no type errors.bun run structure:check— passed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.