fix: support Windows drive letters in transcript fallback regex - #2310
fix: support Windows drive letters in transcript fallback regex#2310faisalhussain-devs wants to merge 4 commits into
Conversation
igorls
left a comment
There was a problem hiding this comment.
Thanks for the clear write-up and for including a real regression test — the issue described the fix and this matches it precisely.
CI is green across all nine jobs, including Windows. I also checked the regex against the path shapes that seemed most likely to break:
POSIX (regression) -> wing_mempalace unchanged
Windows drive letter -> wing_code_blm_blm_cadastral_returns_tools fixed
lowercase drive -> wing_lowercase_drive works
two letters (not a drive) -> wing_sessions unchanged
no prefix at all -> wing_sessions unchanged
The alternation ordering is what makes this safe: - is tried first, so every POSIX-encoded folder takes exactly the path it took before and the new branch is only reachable for a single leading letter followed by --. Nothing else can start matching by accident. Merged against current develop the full suite passes here as well.
Two small things before this goes in:
- Please add a
CHANGELOG.mdentry under## [Unreleased]->### Bug Fixes, referencing the issue number. The house style is a bolded one-line summary followed by the mechanism — the surrounding entries are the pattern to copy. - The branch is 4 commits behind
develop, which has moved a few times today. A merge or rebase fromdevelopwill be needed before this can go in.
One observation rather than a change request: the fallback only triggers when cwd is missing from the transcript JSONL, so as the issue notes this is the second line of defence rather than the common path. That is the right place to fix it — just worth knowing the blast radius is smaller than the "100% of checkpoints in wing_sessions" symptom suggests for sessions that do carry cwd.
Nice catch on the test that was encoding the POSIX assumption while being named for Windows.
What does this PR do?
Closes #2304
This PR updates the
_wing_from_transcript_pathfallback regex to gracefully handle Windows-encoded paths (e.g.,D--Code...) generated by Claude Code.Previously, the regex strictly required a leading dash (
/\.claude/projects/-([^/]+)), causing Windows drive letters to miss the match and silently fall back towing_sessions. The regex has been updated to(?:-|[a-zA-Z]--)to support both POSIX hyphens and Windows drive letter prefixes.How to test
I have added a dedicated Windows test fixture in
tests/test_hooks_cli.pyusing the exact failing path provided in the issue report.You can verify the fix by running:
uv run pytest tests/test_hooks_cli.py::test_stop_hook_derives_wing_from_transcript_path_windows -vChecklist
pre-commit(Ruff).uv run pytest tests/ -v).