Conversation
`categorize_memory_dir` matched provider patterns against `str(path)` directly. On Windows the stringified `Path` is backslash-separated (`C:\Users\foo\.claude\projects\bar\memory`), so the forward-slash regexes (`r"/\.claude/projects/[^/]+/memory/?$"`, etc.) never matched and every Windows provider directory silently fell through to "user". The user-visible symptom: `mm init`'s wizard could not auto-detect Claude Code / Codex memory folders for Windows users, so the preset namespace rules from #312 (`claude:{ancestor:1}`, etc.) were never applied to those installs. Fix: normalise separators by replacing `\` with `/` before matching. The regex table, the vocabulary lock (#313), and the Literal type stay untouched — only the input form is normalised. RFC #304 is unaffected. Tests: 7 parametrized cases in test_categorize_memory_dir_accepts_- windows_separators covering one path per provider category, the "user" fallback, mixed separators, UNC paths, and trailing backslash. Raw-string fixtures execute on the Linux CI host without needing a Windows runner. Existing POSIX-path tests in test_init_cmd.py (TestCategorizeMemoryDir / TestDetectProviderDirsRoundtrip) continue to pass. Side effect: the two `test_detect_provider_dirs_*` cases that #714 flagged as "still failing — pending #316" should now pass on Windows once this lands together with the set_home migration. Closes #316. Co-Authored-By: Claude <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
categorize_memory_dir(config.py:1342-1355) matched provider patterns againststr(path)directly. On Windows the stringifiedPathis backslash-separated, so the forward-slash regex table (r"/\.claude/projects/[^/]+/memory/?$", etc.) never matched and every Windows provider directory silently fell through to"user". User-visible symptom:mm init's wizard could not auto-detect Claude Code / Codex memory folders for Windows users, so the preset namespace rules from #312 were never applied.Fix
Input normalisation only — the regex table, the vocabulary lock (#313), the
ProviderCategoryLiteral, and the_CATEGORY_TO_PROVIDERmap all stay untouched. RFC #304 (axis/wire-format) is unaffected.Tests
test_categorize_memory_dir_accepts_windows_separatorscovers 7 parametrized cases:C:\Users\foo\.claude\projects\abc\memoryclaude-memoryC:\Users\foo\.claude\plansclaude-plansC:\Users\foo\.codex\memoriescodexC:\Users\foo\Documents\notesuser(fallback)C:\Users\foo/.claude/plansclaude-plans(mixed sep)C:\Users\foo\.claude\plans\(trailing)claude-plans\\server\share\.codex\memoriescodex(UNC)Raw-string fixtures execute on the Ubuntu CI host without needing a Windows runner — this matches the testing-notes pattern in #316.
Existing POSIX-path tests in
test_init_cmd.py(TestCategorizeMemoryDir,TestDetectProviderDirsRoundtrip) continue to pass — no behaviour change for forward-slash paths.Cascade with #714
PR #714 flagged two
test_detect_provider_dirs_*cases as "still failing — pending #316". With this PR landed alongside theset_homemigration, those two cases should go green on the Windows informational job. Tracked in the next Windows fail-count delta.Test plan
uv run pytest packages/memtomem/tests/test_config_overrides.py -m "not ollama" -q— 35 passed locallyuv run pytest packages/memtomem/tests/test_init_cmd.py -m "not ollama" -k "categorize or provider_dirs"— 12 passed (POSIX regression guard)uv run ruff check+ruff format --checkon the 2 changed files — cleantest_detect_provider_dirs_*plus any cascade from_detect_provider_dirscallers). macOS / Ubuntu pass count unchanged (negative pin).Closes #316.
🤖 Generated with Claude Code