Skip to content

fix(fix-plan): preserve Windows backslashes in hook_integrity_check paths - #376

Merged
DrumRobot merged 1 commit into
next-fixfrom
fix/hook-integrity-windows-path
Aug 26, 2026
Merged

fix(fix-plan): preserve Windows backslashes in hook_integrity_check paths#376
DrumRobot merged 1 commit into
next-fixfrom
fix/hook-integrity-windows-path

Conversation

@daegunjhy

Copy link
Copy Markdown
Contributor

Summary

shlex.split() in posix mode (the default) treats backslash as an escape character, so any Windows path passed through resolve_script_operand lost every backslash (C:\Users\me\hook.sh -> C:UsersMehook.sh), making os.path.exists() fail and the script report a real, existing hook as MISSING.

Fix: use posix=False on win32, where shlex keeps backslashes literal; the existing strip('"')/strip("'") calls already handle the quoting difference that mode introduces.

Discovered as a pre-existing, unrelated CI-parity failure blocking a separate PR's push — test_installed_schema_is_audited was silently broken by this bug already (its own fixture uses a real Windows tmp_path), but nothing had isolated it to resolve_script_operand specifically until now.

Test plan

  • Added test_resolve_preserves_windows_backslashes — pins the win32 branch explicitly via monkeypatch.setattr(mod.sys, "platform", "win32"), deterministic on any CI platform
  • Added test_resolve_posix_path_unaffected_by_win32_branch — confirms ordinary POSIX-style paths and interpreter/flag skipping still resolve correctly under posix=False
  • Full pytest suite: 96 passed, 4 skipped (was 93 passed / 1 failed / 4 skipped before this fix)
  • Full bats suite (24/24) unaffected

🤖 Generated with Claude Code

…aths

shlex.split() in posix mode (the default) treats backslash as an escape
character, so any Windows path passed through resolve_script_operand lost
every backslash (C:\Users\me\hook.sh -> C:UsersMehook.sh), making
os.path.exists() fail and the script report a real, existing hook as
MISSING.

Use posix=False on win32, where shlex keeps backslashes literal; the
existing strip('"')/strip("'") calls already handle the quoting
difference that mode introduces.

Discovered as a pre-existing, unrelated CI-parity failure blocking an
unrelated PR's push -- test_installed_schema_is_audited was silently
broken by this bug already (its own fixture uses a real Windows tmp_path)
but nothing had isolated it to this function until now. Added 2 targeted
regression tests pinning the win32 branch explicitly via monkeypatch so
this reproduces deterministically on any CI platform, not just Windows.
@daegunjhy
daegunjhy marked this pull request as ready for review August 26, 2026 08:18
@DrumRobot
DrumRobot merged commit 444d9a9 into next-fix Aug 26, 2026
2 checks passed
@DrumRobot
DrumRobot deleted the fix/hook-integrity-windows-path branch August 26, 2026 08:23
DrumRobot added a commit that referenced this pull request Aug 27, 2026
… gh pr merge (#381)

gh pr checks right before merging only confirms CI freshness. It says
nothing about whether the PR itself was already merged/closed in the
gap between an AskUserQuestion approval and the actual merge call --
the user (or another process) can act on the same PR concurrently.

Discovered this session: merged PR #376 in exactly this gap after the
user had already merged it themselves; gh pr merge was rejected rather
than double-merging, but the near-miss showed the existing rule only
guards CI staleness, not merge-state staleness.

Co-authored-by: DrumRobot <drumrobot43@gmail.com>
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.

2 participants