Repository navigation
fix(slug): fold the Windows drive letter on the Python side too (#268) - #282
Merged
Merged
Conversation
`scripts/lib-slug.sh` has folded a leading drive letter to lower case unconditionally since #263. `pipeline/slug.py` did not fold at all — it is a transcription of Claude Code's own JXA routine, which never sees a raw drive letter because the host normalises first. On Windows `resolve-paths.sh` hands both sides the native Win32 form with an UPPER-case drive, so bash computed `c--Users-…` and Python computed `C--Users-…`, and `extract.py` located the session directory by the Python spelling. NTFS resolves a case-only difference, so nothing failed and nothing reported a difference. The exposure is that it stops being benign the moment anything compares the two slugs as strings rather than using them as paths — which is precisely what #263 turned out to be, in git rather than in the filesystem. The direction is not a free choice (#263's PR): Git for Windows ships cygpath, so the working majority's on-disk stores already carry the lower-case spelling, and folding the other way would fix one reporter while renaming every other store. The fold is anchored at position 0, matching bash's `?:*` case, so an embedded `X:` mid-path is left alone. It runs before the slug characters and before `path_hash`, mirroring bash capturing `_orig` after its own fold — so the over-long-path branch agrees too. `tests/test_slug_parity.py` existed to keep these two implementations identical and was doing its job for every step except the one where they drifted. It now spans both cases and all three shapes (`C:\…`, `c:/…`, `/c/…`), pins the direction so the two cannot agree on the wrong case, and guards against the fold overreaching into an ordinary mid-path colon. Two pre-existing tests in `tests/test_path_resolution.py` hardcoded the old upper-case slug as expected — stale fixtures never updated when bash's fold shipped in #263. Corrected. Closes #268 Co-Authored-By: Max <noreply>
…hird copy Four ubuntu legs went red while macOS and Windows passed. `_make_real_session` re-implemented the slug inline — `re.sub(r'[^a-zA-Z0-9]', '-', project_dir)`, with no drive-letter fold — so it created `.../projects/D--Users-dev-project` while `_session_dir` now looks up `d--Users-dev-project`. On a case-sensitive filesystem that is a miss; on macOS and Windows it resolves, which is why the suite was green everywhere the fix was written and developed. The case was the symptom. The defect is that this was a *third* implementation of `session_dir_slug` — bash, Python, and one hand-rolled in a test helper — which is the exact drift `tests/test_slug_parity.py` exists to prevent, sitting in the test suite where the parity guard cannot see it. Patching the literal to lower case would have restored green and left the next divergence free to happen the same way. The helper now calls `session_dir_slug`, so the fixture path and the lookup path are the same string by construction and cannot drift again. Verified platform-independently rather than by re-running on a machine that cannot show the failure: for all three fixture paths the helper's slug now equals the directory `_session_dir` resolves, and the old regex differed in every one. Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/lib-slug.shhas folded a leading drive letter to lower caseunconditionally since #263.
pipeline/slug.pydid not fold at all — it is atranscription of Claude Code's own JXA routine, which never sees a raw drive
letter because the host normalises first. On Windows
resolve-paths.shhandsboth sides the native Win32 form with an UPPER-case drive, so bash computed
c--Users-…and Python computedC--Users-…, andextract.pylocated thesession directory by the Python spelling.
NTFS resolves a case-only difference, so nothing failed and nothing reported a
difference. The exposure is that it stops being benign the moment anything
compares the two slugs as strings rather than using them as paths — which is
precisely what #263 turned out to be, in git rather than in the filesystem.
The direction is not a free choice (#263's PR): Git for Windows ships cygpath,
so the working majority's on-disk stores already carry the lower-case spelling,
and folding the other way would fix one reporter while renaming every other
store. The fold is anchored at position 0, matching bash's
?:*case, so anembedded
X:mid-path is left alone. It runs before the slug characters andbefore
path_hash, mirroring bash capturing_origafter its own fold — sothe over-long-path branch agrees too.
tests/test_slug_parity.pyexisted to keep these two implementationsidentical and was doing its job for every step except the one where they
drifted. It now spans both cases and all three shapes (
C:\…,c:/…,/c/…),pins the direction so the two cannot agree on the wrong case, and guards
against the fold overreaching into an ordinary mid-path colon.
Two pre-existing tests in
tests/test_path_resolution.pyhardcoded the oldupper-case slug as expected — stale fixtures never updated when bash's fold
shipped in #263. Corrected.
Closes #268
Co-Authored-By: Max