Repository navigation
fix(path_guard): normalize to_rel_path to POSIX forward slashes (#214) - #228
Conversation
|
Reviewed against One blocking thing first, and I am sorry to lead with it.
The good news is you do not need a Windows runner to pin it. Two more to change, both small.
Two questions, no action needed unless the answer is interesting.
One nit while you are in there: your changelog bullet sits directly above The |
… update docstring
|
@Paul-Kyle Thanks for the detailed review and the catch on the Windows test runner gap! I’ve updated the branch with all the requested fixes:
On the two discussion points:
Ran the full unit suite, changelog structure tests, and ruff locally — all 55 tests pass. Whenever you have a moment to recheck the head, let me know if anything else is needed! |
|
Rechecked at
One thing left, and it is the docstring rather than the code. Keep the behaviour exactly as you have it: now that the signature is The paragraph below it did not follow, though, and it is now wrong twice over:
Something like this covers it:
Word it however you like — that is the shape, not a required sentence. And That is the whole list. If you would rather be done with this one, say so and I will make the docstring change myself after merging — you have turned this around twice, the second time in under an hour, and I am not going to spend your evening on a paragraph. |
|
@Paul-Kyle You're absolutely right about I also updated the docstring exactly as you suggested so it accurately reflects the current behavior and type constraints. Thanks again for the incredibly thorough reviews and for catching that docstring inconsistency. Let me know if you need anything else from my end to get this merged! |
|
Merged — thank you, and thank you especially for the Two things you should hear from me rather than find in the history — the same slip in both places, where the last round's replacements were appended without removing the text they superseded:
Neither breaks anything — behaviour is exactly what your tests pin, which is also why CI stayed green: #214 closes with this. Thanks for taking the awkward one — a platform bug none of us can exercise natively in CI is exactly what sits open for months otherwise. |
Closes #214
Problem
to_rel_path()inpalinode.core.path_guardpreviously relied onos.path.relpath()without normalizing directory separators to POSIX format (/). On Windows, this resulted in backslash-separated relative paths (decisions\foo.md) propagating across API responses (rel_path), MCP tool outputs, and downstream consumers.Additionally, two call sites (
palinode/core/store.pyassociative search andpalinode/consolidation/layer_split.py) performed manual string strippingconfig.memory_dir + "/", which failed to match on Windows due to separator mismatch.Changes
POSIX Path Normalization (
palinode/core/path_guard.py):not os.path.isabs(file_path)) using.replace("\\", "/").base_diror on different Windows drives are returned untouched as absolute paths.os.pardir + os.sepandos.pardir + "/".Eliminated Hardcoded String Stripping:
palinode/core/store.py: Replaced manual string strip insearch_associativewith canonicalto_rel_path(fp).palinode/consolidation/layer_split.py: Replaced manual string strip withto_rel_path(results["identity"]).Test Suite Modernization & Pinning:
tests/test_to_rel_path.pyandtests/test_mcp.py: Replacedos.path.join(...)assertions with explicit POSIX literals ("decisions/foo.md","insights/bar.md", etc.) to prevent test masking on Windows.tests/test_rel_path_api_parity.py: Normalized absolutefile_pathassertion check for cross-platform compatibility.Changelog:
## Unreleased>### Fixedindocs/CHANGELOG.md.Verification
pytest tests/test_to_rel_path.py tests/test_rel_path_api_parity.py tests/test_mcp.py tests/test_search_associative_snippet.py -v(54 passed)pytest tests/test_changelog_structure.py tests/test_changelog_unreleased_refs.py tests/test_no_issue_refs_user_surface.py -v(36 passed)ruff check palinode/ tests/ scripts/(All checks passed)bandit -r palinode/ -ll(No issues identified)