Summary
_rel() in scripts/pkc_search.py:141 calls path.relative_to(bundle) without resolving bundle. The rg path supplies resolved paths, so on a symlinked root relative_to() raises ValueError and the search crashes.
rel = "/" + path.relative_to(bundle).as_posix() # line 141, no resolve, no guard
Compare _filter_rg_hits() at line 52, which already resolves the root once (bundle_root = bundle.resolve(), line 54). Line 141 was missed.
Reproduce
python3 tests/test_pkc.py on macOS, where /var is a symlink to /private/var:
ERROR: test_titleless_stem_match_is_invisible_on_every_engine
(__main__.TestRipgrepAccelerator)
ValueError: '/private/var/folders/tm/.../tmpz121mui2/features/other.md'
is not in the subpath of '/var/folders/tm/.../tmpz121mui2'
It fails on clean main today: 111 tests run, 1 error. Linux CI has no /var symlink, so CI is green and the defect shipped.
Scope
Any symlinked root reproduces it, not only macOS: a symlinked home or checkout, a Docker bind mount, /tmp on macOS.
research-knowledge-capture#35 is the same defect in rkc_search.py, where the except ValueError branch swallows it and returns a wrong absolute path instead of raising. The two repos should get the same fix.
Suggested fix
Resolve both sides in _rel(), the way _filter_rg_hits() already does.
Found while adding the workflow parse gate in #84.
Summary
_rel()inscripts/pkc_search.py:141callspath.relative_to(bundle)without resolvingbundle. The rg path supplies resolved paths, so on a symlinked rootrelative_to()raisesValueErrorand the search crashes.Compare
_filter_rg_hits()at line 52, which already resolves the root once (bundle_root = bundle.resolve(), line 54). Line 141 was missed.Reproduce
python3 tests/test_pkc.pyon macOS, where/varis a symlink to/private/var:It fails on clean
maintoday: 111 tests run, 1 error. Linux CI has no/varsymlink, so CI is green and the defect shipped.Scope
Any symlinked root reproduces it, not only macOS: a symlinked home or checkout, a Docker bind mount,
/tmpon macOS.research-knowledge-capture#35 is the same defect in
rkc_search.py, where theexcept ValueErrorbranch swallows it and returns a wrong absolute path instead of raising. The two repos should get the same fix.Suggested fix
Resolve both sides in
_rel(), the way_filter_rg_hits()already does.Found while adding the workflow parse gate in #84.