Skip to content

feat(sources): per-source chunk budget (SourceConnector.maxChunks) - #18

Merged
thatswiftdev merged 2 commits into
mainfrom
wt/ingest-chunk-cap
Oct 23, 2026
Merged

thatswiftdev merged 2 commits into
mainfrom
wt/ingest-chunk-cap

Conversation

@thatswiftdev

Copy link
Copy Markdown
Contributor

ingest() caps every source at MAX_CHUNKS_PER_SOURCE (10,000), and nothing could override it. A symbol doc carries one chunk per symbol. The Lionidas repo now produces 16,533 chunks, and the repo walk is alphabetical. So server/ used up the budget, and shared/, most of web/, cli/ and scripts/ never reached the index. Those docs were listed in skipped, but nothing noticed. Lionidas found this because its repoConnector: symbol chunks test went red.

What changes

  • SourceConnector.maxChunks?: a per-source budget, which ingest() uses in place of the constant.
  • RepoSourceConfig.maxChunks?, passed through by repoConnector.
  • The default is unchanged (10,000), and so is the behaviour for every connector that doesn't set it.

Verification

  • tsc --noEmit is clean. vitest: 48 files, 280 passed (277 + 3 new), 5 skipped.
  • New tests in test/ingest-chunk-budget.test.ts:
    • default cap: document 10,001 is skipped;
    • a connector budget can lower or raise the cap;
    • the repo pass-through drops the later directory at the cap.
  • Mutation-checked: making ingest ignore the connector budget turns 2 tests red, and dropping the repo pass-through turns 1 red.

Independent of #17: either can merge first.

ingest() capped every source at MAX_CHUNKS_PER_SOURCE (10,000) with no
override. Symbol docs carry one chunk per symbol, so the Lionidas repo
(16.5k chunks) silently lost its later top-level dirs (shared/, web/,
cli/ ...) to the alphabetical walk. The connector can now carry its own
budget; RepoSourceConfig.maxChunks passes it through repoConnector.
The default is unchanged.
@thatswiftdev
thatswiftdev merged commit 58f0ce4 into main Oct 23, 2026
1 check passed
@thatswiftdev
thatswiftdev deleted the wt/ingest-chunk-cap branch October 23, 2026 02:34
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.

1 participant