Skip to content

Raise the index file size cap to 500KB, and say when a file is skipped - #53

Merged
nedonatelli merged 1 commit into
mainfrom
fix/index-size-cap
Aug 4, 2026
Merged

Raise the index file size cap to 500KB, and say when a file is skipped#53
nedonatelli merged 1 commit into
mainfrom
fix/index-size-cap

Conversation

@nedonatelli

Copy link
Copy Markdown
Owner

The silence was the defect; the number was secondary.

The silence

if (content.length > MAX_FILE_SIZE) return;

A file over the limit was dropped without a word, so a user whose symbols were
missing from find_references had no way to discover why. Same shape as the
scan truncation in #40, smaller in blast radius.

Raising the limit only moves the cliff. Naming it is what makes falling off it
observable — so this does both, and the logging is the half I would keep if only
one were possible.

Why 100 KB was also too low

This repo's own distribution argues against urgency — p99 is 41 KB and exactly
one file exceeds 100 KB, a test file. The case is other people's repos:
generated TypeScript that users legitimately want indexed (GraphQL types,
protobuf output, OpenAPI clients, large const tables) routinely passes 100 KB.

Meanwhile the pathological files a cap exists to stop — minified bundles,
vendored trees — mostly sit in directories INDEX_EXCLUDE_DIRS already removes,
so the cap was doing less protective work than its size implied.

Cost, measured

Tree-sitter, roughly linear:

size parse
136 KB 81ms
272 KB 130ms
680 KB 289ms

500 KB costs ~215ms worst case against a full index. Past that, skipping is
genuinely right — a multi-MB .ts is almost certainly generated or minified and
its symbols would be noise, so this keeps a cap rather than removing one.

How it was found

Reconciling the live symbol graph against a direct tree-sitter run after the
tree-sitter fixes landed. Every per-file count matched exactly; the only
aggregate gaps were __corpus__ fixtures (#52) and one 136 KB file silently
over this limit. The arithmetic closed to the symbol once both were accounted
for — no extraction defect, just two file-set differences, one of which was
invisible.

Testing

Mutation-checked independently: reverting the cap to 100 KB fails two tests,
making the skip silent again fails one.

npm run check: green.

🤖 Generated with Claude Code

…skipped

The silence was the defect; the number was secondary.

A file over the limit was dropped with `return`, so a user whose symbols were
missing from find_references had nothing to go on. Same shape as the scan
truncation in #40, smaller in blast radius: raising the limit only moves the
cliff, naming it is what makes falling off it observable.

100 KB was also low for real source. This repo's own p99 is 41 KB — only one
file exceeds 100 KB and it is a test — but generated TypeScript users
legitimately want indexed (GraphQL types, protobuf output, OpenAPI clients,
large const tables) routinely passes it. The pathological files a cap exists to
stop, minified bundles and vendored trees, mostly sit in directories
INDEX_EXCLUDE_DIRS already removes, so the cap was doing less protective work
than its size implied.

Measured with tree-sitter, roughly linear:

    136 KB ->  81ms
    272 KB -> 130ms
    680 KB -> 289ms

500 KB costs ~215ms worst case against a full index. Past that, skipping is
right — a multi-MB `.ts` is almost certainly generated or minified and its
symbols would be noise.

Found while reconciling the live graph against a direct tree-sitter run: every
per-file count matched, and the only aggregate gaps were __corpus__ fixtures
(#52) and one 136 KB file silently over this limit.

Mutation-checked independently: reverting the cap fails two tests, silencing
the log fails one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

✅ All checks passed

Check Status
Type check ✅ success
Lint ✅ success
Tests ✅ success

Posted by SideCarAI-Bot

@nedonatelli
nedonatelli merged commit 8e0e6b6 into main Aug 4, 2026
3 checks passed
@nedonatelli
nedonatelli deleted the fix/index-size-cap branch September 1, 2026 15:10
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