Skip to content

Promote develop to main: Match Guard Self-Test Fixtures Across Path Separators for Windows - #2463

Merged
ptr727 merged 1 commit into
mainfrom
develop
Oct 7, 2026
Merged

ptr727 merged 1 commit into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

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

)

## 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]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 00:57
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8e55bff1-45fc-4352-831b-2a560c5ad945
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.47%. Comparing base (c3cbe63) to head (e93b673).
⚠️ Report is 317 commits behind head on main.

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           
Flag Coverage Δ
python-3.13 58.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ptr727
ptr727 merged commit fbc7f99 into main Oct 7, 2026
13 checks passed
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.

Guard Self-Test Fails on Windows, Blocking Every Native Install

2 participants