Repository navigation
fix(discover): sanitize the drive-letter colon in encode_project_path - #3043
Closed
albatrossflyon-coder wants to merge 1 commit into
Closed
albatrossflyon-coder wants to merge 1 commit into
albatrossflyon-coder wants to merge 1 commit into
Conversation
Closes rtk-ai#2919. Claude Code replaces ':' with '-' along with '/', '.', '_', '\', and non-ASCII characters when it slugs a project's cwd into its session folder name under ~/.claude/projects/ (verified against several real folders on this machine, e.g. C:\Repos\job-hunter -> C--Repos-job-hunter on disk). encode_project_path's SANITIZED_CHARS never included ':', so on Windows the filter string kept a literal colon right after the drive letter while the real folder name never had one -- the default (no -p, no --all) current-project match was comparing "C:-Users-..." against "C--Users-...", which never matches. Not a case-sensitivity issue as originally titled -- the colon itself was never being sanitized. Confirmed by decoding several of this machine's own real ~/.claude/projects/ folder names against their source paths before writing the fix, then again with the built binary: `rtk discover` on this repo went from "Scanned: 0 sessions" to "Scanned: 30 sessions, 4575 Bash commands" after the fix, no other changes. The existing test_encode_project_path_windows test was actually asserting the buggy output ("C:-Users-foo-bar") -- corrected it to the real expected value and added an end-to-end regression test that exercises the full discover_sessions_in_projects_dir match path against a real Windows-style folder name.
5 tasks
Contributor
Author
|
This looks superseded, closing rather than merging. |
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.
Closes #2919.
Root cause (more precise than the original title)
Not actually a case-sensitivity issue — Claude Code replaces
:with-along with/,.,_,\, and non-ASCII characters when itslugs a project's cwd into its session folder name under
~/.claude/projects/.encode_project_path'sSANITIZED_CHARSneverincluded
:, so on Windows the filter string kept a literal colonright after the drive letter while the real on-disk folder name never
had one.
Verified against several of my own real
~/.claude/projects/foldersbefore writing the fix:
C:\Repos\job-hunterC--Repos-job-hunterG:\Other computers\...\Universal-BrainG--Other-computers-...-Universal-BrainSo the default (no
-p, no--all) filter was comparing"C:-Users-..."against the real"C--Users-..."— never matches,hence
Scanned: 0 sessions, while--all/-p <name>(which don'tgo through this exact comparison) work fine, matching the report.
Fix
Added
:toSANITIZED_CHARS. The existingtest_encode_project_path_windowstest was actually asserting thebuggy output (
"C:-Users-foo-bar") — corrected it, and added anend-to-end regression test exercising the full
discover_sessions_in_projects_dirmatch path.Before / after, live on this machine
Tests
cargo test --bin rtk: 2434 passed, 9 ignored (pre-existing Windows.exe-extension limitation on the#[ignore]d real-binary testselsewhere in this repo, covered by CI on Linux/macOS — unrelated to
this change).
cargo fmt --checkandcargo clippy --all-targets:both clean.
Note on the space-in-username report
The issue thread also mentions a separate symptom with a space in the
Windows username (
C:\Users\Jeff Huang\...). Spaces were already inSANITIZED_CHARSbefore this fix and I couldn't reproduce aspace-specific failure on this machine (no space in my own username),
so I'm not claiming this PR resolves that report too — flagging it in
case it needs separate follow-up.