fix(cache): standardize AST symbol cache paths using pathlib across OS - #5
Conversation
- Refactor ASTSymbolIndexer to standardize all cache paths using pathlib.Path - Add _canonical_key to normalize relative forward-slash POSIX paths - Refactor _determine_namespace to use pathlib.Path.parts and as_posix - Normalize path resolution in index_file, get_tier_payload, read_ast_node, and get_file_dependencies - Standardize project_dir in EngrimAdapter and storage_path in QdrantCodeIntelAdapter - Resolve merge conflict markers in run_self_test - Add test suite in tests/test_symbol_cache_paths.py verifying cross-platform parity - Add test optional dependency with pytest in pyproject.toml
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @Jaswanth1902, I have completed the cross-platform standardization using Submitted the Pull Request for review! |
🛡️ Antigravity 5-Persona Council Review: APPROVED (Score: 98/100)@ius-sharma Incredible work on standardizing cross-platform AST symbol cache paths!
Local verification:
Thank you for this high-impact contribution! |
|
@Jaswanth1902 are you going to merge this ?? |
|
@ius-sharma Yes! PR #5 has just been merged into All local tests, AST verifications, and cross-platform fixtures passed cleanly. Issue #2 is resolved. Really appreciate your speed, clean code hygiene, and thorough test matrix! 🚀 |
🎯 Problem Statement
Closes #2
File system paths on Windows use backslashes (
\) and case-insensitive matching, while Linux and macOS use forward slashes (/). Previous raw string manipulations caused cache misses and path inconsistencies when Cartograph ran on different operating systems.🛠️ Scope of Work Completed
cartograph/:replace('\\', '/'), string splits) with standardpathlib.Path.resolve()andpathlib.Path.as_posix()._canonical_key()helper onASTSymbolIndexerto guarantee deterministic relative POSIX keys across cache dictionaries (symbol_index,raw_cache,file_abstracts,file_dependencies,file_adjacency)._determine_namespace()usingPath.partsandas_posix().EngrimAdapterandQdrantCodeIntelAdapter.cartograph/server.py.tests/test_symbol_cache_paths.pycovering 9 cross-platform test cases (namespace isolation, cache key parity, tier payloads,read_ast_nodesymbol extraction, relational dependencies, temporal graphs, directory traversal, and JSON-RPC MCP handlers)..github/workflows/test.ymlrunning tests onubuntu-latest,windows-latest, andmacos-latestacross Python 3.10, 3.11, and 3.12.🧪 Verification
python cartograph/server.py --testpassed locally on Windows.pytest -v tests/passed (9/9 tests green).pathlib.Pathstandard methods.