Skip to content

fix: raise docCache per-entry cap to 5 MB with size warnings#29

Open
mattpodwysocki wants to merge 3 commits intomainfrom
fix/cache-large-entry-warning
Open

fix: raise docCache per-entry cap to 5 MB with size warnings#29
mattpodwysocki wants to merge 3 commits intomainfrom
fix/cache-large-entry-warning

Conversation

@mattpodwysocki
Copy link
Copy Markdown
Contributor

Summary

llms-full.txt files now exist for every product on docs.mapbox.com and can be fetched via get_document_tool. The previous 2 MB per-entry cache limit would have silently dropped GL JS full content (1.6 MB) on cache attempts — it fit under the limit, but just barely, and any growth would break it with no operator visibility.

Changes:

  • Hard cap 2 MB → 5 MB — all current llms-full.txt files cache cleanly (GL JS 1.6 MB, iOS Nav 696 KB, Style Spec 466 KB)
  • Warning at 1 MBconsole.warn("[docCache] Caching large entry (X.X MB): <url>") so operators can see large cache entries in server logs
  • Warning on rejection — entries over 5 MB now log [docCache] Entry too large to cache instead of being silently dropped

The total 50 MB cache cap is unchanged.

Test plan

  • npm test — 60 tests pass
  • Existing size-limit tests updated (BatchGetDocumentsTool test bumped from 3 MB to 6 MB as "too large" value)
  • New tests: verify console.warn fires for entries >1 MB (cached) and >5 MB (rejected)
  • CI green

🤖 Generated with Claude Code

mattpodwysocki and others added 3 commits April 1, 2026 14:16
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
llms-full.txt files (GL JS 1.6MB, iOS Nav 696KB, Style Spec 466KB)
previously fell under or near the 2MB hard cap. Raising to 5MB lets
all current full-content files cache cleanly.

Add warnings so operators can see large entries in logs:
- entries 1MB–5MB: warn and cache
- entries >5MB: warn and reject (instead of silently dropping)

Update BatchGetDocumentsTool test to use 6MB as the "too large" value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner April 14, 2026 17:49
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