Files
graphify/tests
Dennis Cornwell 8f09326e02 fix: don't resolve symlinks when relativizing manifest/cache keys (#777)
`_to_relative_for_storage` (detect.py) and `_relativize_source_files_in`
(cache.py) called `.resolve()` on the file key before `relative_to(root)`,
so an in-root symlink — e.g. `alias.py -> sub/target.py` — was stored
under the resolved target's path (`sub/target.py`) instead of `alias.py`.

`detect()` emits unresolved keys (from `os.walk`), so on the next
incremental run the `alias.py` key missed the manifest lookup → that file
re-extracted on every run. Not a correctness break, but a redundant
full-extract-per-symlink regression.

Switch to `os.path.relpath` against a resolved root only. The key itself
stays symbolic, so symlinks round-trip under their own name. Preserve the
prior out-of-root semantics by falling back to the absolute key when the
computed relative path escapes root (`..` prefix).

Same fix applied to `cache.py` for consistency — lower-impact there since
cache lookup is content-hashed, not key-matched.

Adds two regression tests covering the in-root symlink round-trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:29:44 -04:00
..