Visitar URL original
fix(tests): use /dev/null as the empty global git config on Windows too by andrew05060414 · Pull Request #8746 · lidge-jun/opencodex · GitHub
Skip to content

fix(tests): use /dev/null as the empty global git config on Windows too - #8746

Draft
andrew05060414 wants to merge 2 commits into
lidge-jun:devfrom
andrew05060414:fix/windows-git-null-config
Draft

andrew05060414 wants to merge 2 commits into
lidge-jun:devfrom
andrew05060414:fix/windows-git-null-config

Conversation

@andrew05060414

@andrew05060414 andrew05060414 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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/config guard (tests/helpers/git-config-guard.ts) set GIT_CONFIG_GLOBAL=NUL on win32, and git 2.56 refuses that value outright:

$ GIT_CONFIG_GLOBAL=NUL git config --global --list
fatal: unable to access 'NUL': Invalid argument

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_CHECKOUT at a directory with no .git, which also switches the guard off.

After this PR. The empty global config is /dev/null on every platform, exported once as EMPTY_GLOBAL_GIT_CONFIG and 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/null is safe on Windows. Git for Windows maps /dev/null to 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 exported EMPTY_GLOBAL_GIT_CONFIG = "/dev/null" with the reason in a comment; fixtureGitEnv uses it.
  • tests/helpers/git-config-guard.ts: imports the constant instead of its own NUL branch.
  • tests/ci-workflows/test-git-isolation.test.ts: oracle env and the env assertion use the constant; a new case runs the installed git with fixtureGitEnv() (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 with bun scripts/test.ts <files> and without the OCX_GIT_CONFIG_GUARD_CHECKOUT workaround: every file that imports tests/helpers/git-fixture.ts or 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).

pass fail skip
upstream/dev 232 37 66
this branch 275 2 66

The 2 remaining failures also fail on upstream/dev and are not caused by the null-device value: test-runner > changed-mode uses the shared merge base… hits the 5 s timeout inside commitFixture on this Windows host, and test-git-isolation > test preload > fails the case after which the guarded checkout's config changed now reaches the guard correctly (it reports user.name changed) but the probe output on Windows does not contain the (pass) leaves the config alone line the assertion looks for. Both are left for a separate change.

  • bun run typecheck — no type errors.
  • bun run structure:check — passed.
  • Full suite not run locally: several worktrees on this machine share the CPU and the full run times out under that contention; the full run is left to CI. Linux/macOS behaviour is unchanged by construction (same literal as before).

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (test-only change; one devlog line updated)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (no runtime code touched)

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.

…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.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

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

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant