Skip to content

fix(rag): index explicitly configured directory symlinks - #23

Merged
ipiton merged 2 commits into
ipiton:mainfrom
glockbender:codex/index-directory-symlinks
Nov 17, 2026
Merged

ipiton merged 2 commits into
ipiton:mainfrom
glockbender:codex/index-directory-symlinks

Conversation

@glockbender

@glockbender glockbender commented Nov 14, 2026 •

Copy link
Copy Markdown

Replacing an indexed directory such as docs with a symbolic link to the same files currently makes discovery return no documents. Indexing then silently prunes their previous records. os.Stat follows the configured link, but filepath.WalkDir does not traverse it.

Walk the explicitly configured directory through fs.WalkDir(os.DirFS(...), ".", ...) and map entries back to their logical configured paths. Document IDs and exclusions remain stable. Nested directory links remain untraversed to avoid cycles; the individual-file path is unchanged.

Validation: regression tests fail on the unmodified base and pass with this fix. They cover relative/absolute configured links, retained search results after replacement, newly added files, logical excludes, nested external links, and cycles. Local make test vet eval and go test -race ./internal/rag passed. Two independent code reviews and a documentation consistency review found no introduced issues. All five Linux/macOS checks passed in fork CI.

This PR is independent of #21 (discovery failures) and #22 (Ollama model selection).

An additional local live-model regression run combined this fix with #21 and #22: 74 documents / 1,436 vector chunks stayed unchanged after replacing the configured directories with links, and all 50 bilingual queries retained identical ranked paths. The private corpus is not included in this PR.

Updated against upstream 0.18.0 by merging main, preserving the published branch history. The feature patch is unchanged; the changelog conflict is resolved. The linked fork checks passed on this updated head.

@ipiton

ipiton commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Thanks — real bug, minimal fix; os.DirFS + logical path mapping keeps IDs and excludes stable, and nested links stay untraversed. Verified on top of current main (0.18.0): gofmt, vet, go test -race ./... and make eval pass. Only docs/CHANGELOG.md conflicts after 0.18.0 — please rebase and I'll merge.

@ipiton
ipiton merged commit f9f0902 into ipiton:main Nov 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants