fix(indexer): emit exact file paths for the root component instead of a glob - #70
Closed
MrSampson wants to merge 1 commit into
Closed
fix(indexer): emit exact file paths for the root component instead of a glob#70MrSampson wants to merge 1 commit into
MrSampson wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… a glob deriveComponents() emitted paths: ["./**"] for the root-level component (files with no directory, e.g. README.md). src/core/glob.ts's pathMatchesGlob strips a leading "./" before matching, so "./**" normalizes to "**" and matches every file in the repo. src/wiki/wiki.ts's owns()/globPrefix() do not strip it, so "./**" matches nothing there. The same glob was silently interpreted two different ways by two consumers. Root-level files are a small, known set once symbols are indexed, so list them exactly instead of globbing. Both consumers already handle a glob-char-free path correctly via their exact-match fast paths, so no changes were needed in glob.ts or wiki.ts.
MrSampson
force-pushed
the
fix-root-component-glob
branch
from
August 22, 2026 19:21
06e452a to
7484e08
Compare
Contributor
Author
|
Closing — main has already absorbed this exact fix (identical logic, same root cause, referencing the same issue #34) via a separate sync from the fork this PR was cut from. Confirmed on current main:
Nothing in this PR adds anything main doesn't already have. Sorry for the noise — I diagnosed this independently before checking whether it had already landed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deriveComponents()insrc/extractors/indexer.tsemitspaths: [dir + "/**"]for every component derived from the directory layout. For the root-level component (dir === ".", holding files with no directory —README.md,package.json, etc.), this producespaths: ["./**"].Two downstream path matchers read that glob inconsistently:
src/core/glob.ts'snorm()strips a leading./before matching, so"./**"normalizes to"**", which matches every file in the repo, not just root-level ones.src/wiki/wiki.ts'sglobPrefix()/owns()do not strip the leading./:globPrefix("./**")returns"./", andowns()then checksf.startsWith("./")against a real file path like"README.md"— which is never true. So the wiki's root component page currently owns nothing.So the same
"./**"glob simultaneously over-matches in one consumer and under-matches in another, depending on which one reads it.Fix
Root-level files are a small, static set — list them exactly instead of globbing:
pathMatchesGlob's exact-match fast path andowns()'s exact/prefix check already handle a glob-char-free path correctly, so no changes were needed toglob.tsorwiki.ts— confined to the one producer.Test plan
test/indexer.test.ts: a fixture repo with a root-level file and asrc/file — asserts the root component'spathsis an exact file list with no glob characters, and that a non-root component is unaffected (still gets a directory glob).test/wiki.test.ts: constructs the fixed shape directly (paths: ["README.md"]) and confirmsassemblePack's existingowns()/globPrefix()machinery already handles it correctly — proving the practical downstream fix without needing any change inwiki.tsitself.team-route-contract.test.ts, a doctor schema version-string assertion, independently confirmed to fail identically on unmodifiedmain).npm run typecheckclean.