Skip to content

fix: resolve sources inside raw/sources dotfolders#547

Merged
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:pr/resolver-raw-source-dotfolders
Jul 15, 2026
Merged

fix: resolve sources inside raw/sources dotfolders#547
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:pr/resolver-raw-source-dotfolders

Conversation

@AndrewDongminYoo

Copy link
Copy Markdown
Contributor

Problem

When opening a Knowledge-tab entity, sources: entries that point at a file inside a dot-prefixed folder under raw/sources (e.g. .claude, .codex) render as a dashed "Source not found" card in the frontmatter panel — even though the file exists on disk and its non-hidden siblings resolve fine.

Concrete repro: an entity with

sources:
  - ".claude/projects/-Users-me--claude/memory/MEMORY.md"
  - "agentic-coding-toolkit/README.md"   # resolves

The .claude/... card shows ⚠️; the sibling under a normal folder resolves.

Root cause

The resolver path index (projectPathIndex) is built in refreshProjectFileTree from a single full-project listDirectory(projectRoot) scan, which defaults to includeHidden: false. entry_is_visible (fs.rs) then drops every dot-prefixed entry at each level, so raw/sources/.claude/** never enters the index. resolveSourceName looks the path up in that index, misses, and the SourceCard renders as unresolved.

This is the same class of bug already fixed for the Raw Sources tree and chat file tools (c70da6a, a126829), which scan raw/sources with includeHidden: true. The resolver index was simply never given the same treatment.

Fix

  • In refreshProjectFileTree, additionally rescan raw/sources with includeHidden: true (best-effort — a project without sources still gets a full index) and merge it into the tree passed to the resolver index. The full-project scan stays includeHidden: false, so internal dotfolders (.git, .llm-wiki) are still kept out of the index.
  • Guard buildProjectPathIndexFromTree against duplicate paths so the overlapping scans don't inflate the filesByName buckets.

related: references live under wiki/ (never hidden) and are unaffected.

Tests

  • project-file-tree-refresh.test.ts: new test asserting a raw/sources/.claude/... file lands in the index; updated the existing call-signature expectations for the added hidden scan.
  • wiki-page-resolver.test.ts: dedup test for merged overlapping trees, and a resolver test using the real .claude/projects/.../MEMORY.md ref shape.

All existing tests pass; tsc clean.

The resolver path index was built from a single full-project scan with
`includeHidden` off, so dot-prefixed folders (`.claude`, `.codex`) under
`raw/sources` never entered the index. Any `sources:` entry backed by a
file in such a folder — e.g. `.claude/projects/.../MEMORY.md` — resolved
to null and rendered as a "Source not found" card in the frontmatter
panel, even though the file existed on disk.

Rescan `raw/sources` with `includeHidden` (best-effort) and merge it into
the index, mirroring the existing dotfolder handling in the Raw Sources
tree and chat file tools. Guard the index builder against duplicate paths
so the overlapping scans don't inflate the `filesByName` buckets.
@nashsu
nashsu merged commit fb274de into nashsu:main Jul 15, 2026
3 checks passed
@AndrewDongminYoo
AndrewDongminYoo deleted the pr/resolver-raw-source-dotfolders branch July 15, 2026 06:15
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