Repository navigation
Conversation
) ## Summary On a native Windows host, `gh-write-guard.py --selftest` failed 17 primary-checkout cases, and the installer runs that self-test before replacing any hook, so every Windows install refused (#2458). - The fixtures key fake checkouts by POSIX strings such as `/primary`. The rule's relative join runs a resolved value through `os.path.normpath`, which is `ntpath` on 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. - The fixture lookups now read every `\` 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. - A new `test_install.py` case runs the self-test with the guard's own `os.path` swapped for `ntpath`, so a POSIX CI host catches this regression. ## Verification - The new test fails without the fix (3 cases on 3.12, 14 on 3.13) and passes with it on both versions. - Mutation check: with `normpath` removed 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. - On Linux, `--selftest` passes and `test_install.py` passes (137 tests, 1 skipped). ruff and the prose gate are clean, and pyright reports no error beyond the develop baseline. - **Not yet run natively on Windows.** Emulation reproduces 14 of the 17 native failures, and a native run of this branch decides the other three. This PR waits on that run before it merges. 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](https://claude.com/claude-code) --------- 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 @@
## main #2463 +/- ##
=======================================
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
🟢 Approval recommended
No unresolved review comments; the Windows fixture fix has regression coverage.
Review effort: Lite
Findings: None
What changed in this PR
Fixes Windows path-separator handling in guard self-test fixtures and adds regression coverage.
Changes:
- Normalizes separators for fixture lookups.
- Adds an
ntpath-based self-test case.
| File | Summary |
|---|---|
host-setup/agent-safety/claude/test_install.py |
Tests the self-test under Windows path semantics. |
host-setup/agent-safety/claude/gh-write-guard.py |
Adds separator-insensitive fixture lookups. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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, andntpathrewrote the separators. The fixture lookups now fold separators only, and a new install-suite case runs the self-test underntpath, 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.pyruns 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