Repository navigation
Match Guard Self-Test Fixtures Across Path Separators for Windows - #2461
Conversation
The primary-checkout fixtures key fake checkouts by POSIX strings, and the rule's relative join runs them through os.path.normpath, which is ntpath on Windows and rewrites / to \. From Python 3.13, ntpath.isabs also reads a rooted path with no drive as relative, so absolute values take the join too. The exact-string fixture lookup then missed, the rule failed open, and the self-test failed, which made every native Windows install refuse. The fixture lookups now read every \ as / in both the key and the queried directory. Only the separator is folded, so a case still fails where the rule stops collapsing "..". The rule itself is unchanged. A new install-suite case runs the self-test with the guard's own os.path swapped for ntpath, so a POSIX CI host catches the regression. Refs #2458 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2461 +/- ##
========================================
Coverage 58.47% 58.47%
========================================
Files 16 16
Lines 8062 8062
========================================
Hits 4714 4714
Misses 3348 3348
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Native Windows verification remains pending, and the test coverage documentation needs adjustment.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes Windows path-separator mismatches in guard self-test fixtures and adds ntpath regression coverage.
Changes:
- Normalizes fixture lookups across
/and\. - Adds Windows path-semantics coverage to
test_install.py.
| File | Summary |
|---|---|
host-setup/agent-safety/claude/test_install.py |
Adds Windows emulation coverage; docstring wording should accurately describe the skipped native case. |
host-setup/agent-safety/claude/gh-write-guard.py |
Normalizes fixture directory separators. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The emulation test stubs out the one self-test case that spawns git, and its docstring now says so, and names --selftest run with the host's own paths as the only coverage of that case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A recorded local strict-review pass covers head |
|
Native Windows verification of 83c2f77 on Python 3.13.15: |
…eparators for Windows (#2463) ## Summary Promotes #2461 to `main`. The guard's self-test failed natively on Windows, which made every Windows install refuse. Its primary-checkout fixtures are POSIX-spelled, and `ntpath` rewrote the separators. The fixture lookups now fold separators only, and a new install-suite case runs the self-test under `ntpath`, so a POSIX CI host catches a regression. The rule itself is unchanged. Verified natively on Windows with Python 3.13.15: the self-test passes, and `test_install.py` runs to completion with no failure at the hook self-test step. Its 11 remaining failures predate this change and are filed as #2462. The Git Bash path gap in the rule is filed as #2460. Closes #2458 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Summary
On a native Windows host,
gh-write-guard.py --selftestfailed 17 primary-checkout cases, and the installer runs that self-test before replacing any hook, so every Windows install refused (#2458)./primary. The rule's relative join runs a resolved value throughos.path.normpath, which isntpathon Windows and rewrites/to\. From Python 3.13,ntpath.isabs("/primary")is false, so absolute values take the join too. The exact-string fixture lookup then missed, and the rule failed open.\as/in both the key and the queried directory. Only the separator is folded, so collapsing..stays the rule's job. The rule itself is unchanged.test_install.pycase runs the self-test with the guard's ownos.pathswapped forntpath, so a POSIX CI host catches this regression.Verification
normpathremoved from_join_relative, the native self-test fails 2 cases and the ntpath test fails, so the fold does not hide the rule's own normalization.--selftestpasses andtest_install.pypasses (137 tests, 1 skipped). ruff and the prose gate are clean, and pyright reports no error beyond the develop baseline.The older Git Bash gap in the rule itself, where a drive-prefixed
/c/...spelling resolves wrongly and the rule fails open, is filed separately as #2460.Refs #2458
🤖 Generated with Claude Code