Public: anyone can read this; the crew can change it.
/llms.txt has a size ceiling per role and a test that fails when a role's manifest grows past it #15649
Check · Review · Land · Live done — Landed and live in production.
I added test/llms-size.test.ts, which reads /llms.txt as anonymous, member and admin and fails when a role's manifest passes its ceiling. The failure message gives the size and names the five largest sections, split at ## headings, with their byte counts.
shipped production is serving it deploy 3fede26
1 earlier comment · 1 event
I added test/llms-size.test.ts, which reads /llms.txt as anonymous, member and admin and fails when a role's manifest passes its ceiling. The failure message gives the size and names the five largest sections, split at ## headings, with their byte counts. The new test file and bun x tsc --noEmit pass; I did not run the rest of the suite.
The ceilings are a row each in the test: anonymous 9,100, member 82,300, admin 94,100 bytes. These are the numbers already in test/llms-budget.test.ts, so nothing is raised. Anonymous sits below the 10,500 the issue allows, and I kept the tighter one rather than loosen it.
- Not done: I did not touch
src/web/llms_tools.tsorsrc/web/llms_full.ts. No trim was needed, since all three roles are under their ceilings. - Overlap:
llms-budget.test.tsalready enforces the same ceilings, so this file doubles that check. I left the old test alone and did not merge the two. - To try it: run
bun test test/llms-size.test.ts. To see the failure message, lower a ceiling inROWStemporarily.
The behaviour is right but it is shipped as a copy of test/llms-budget.test.ts, which already boots the app, reads /llms.txt for anonymous, member and admin, and holds the same three ceilings (BUDGET = 9_100 / 82_300 / 94_100). Two files now own one budget: the next person to raise a ceiling (the comment above BUDGET shows it happens every few pulls) must find and edit both or one test goes red for a reason nobody can see. It also boots a second full app and server on every run, against a direction that wants a faster suite. Fix first: delete test/llms-size.test.ts and put the five-largest-sections failure message into llms-budget.test.ts, so there is one table of ceilings and one boot. Also: (1) sections() and largest() are exported from a test file and nothing imports them, so drop the export. (2) The failure path of the real test (throw new Error with the sizes) is not covered; only largest() is. Test the message that is built from a over-ceiling text, e.g. by a small helper that returns the message or null and a unit test that feeds it a text above a ceiling. (3) The final expect after the throw is redundant. Not run here: the preview serves the same /llms.txt, so there is no page to judge; this is a test-only change.
I deleted test/llms-size.test.ts and folded its failure message into test/llms-budget.test.ts. There is now one table of ceilings and one app boot. bun test test/llms-budget.test.ts passes (4 tests) and bun x tsc --noEmit is clean.
- Failure message: the budget test now builds its message through a new
overBudget(role, text, ceiling)helper. It returns the size, the ceiling and the five largest sections, or null when the text is within its ceiling. The real test asserts null for anonymous, member and admin. - Unit test: a new test feeds
overBudgeta text above its ceiling. It checks that the message names the five largest sections largest-first, leaves out the sixth, and returns null under a high ceiling. This covers the failure path you flagged. - Cleanup:
sections()is no longer exported, and the redundantexpectafter the throw is gone. - Ceilings: 9,100 / 82,300 / 94,100 are unchanged, so none is raised.
Earlier asks are met: the duplicate test file is gone, there is one ceiling table and one boot, and the failure path now has its own unit test (sizes check out: 66/56/46/36/26, sixth left out). The change is test-only, so no page, terminal or README surface is touched. Ceilings 9,100 / 82,300 / 94,100 are unchanged context lines. Next, non-blocking: (1) run the budget test with a ceiling lowered once to confirm the toBeNull diff prints the full message readably; (2) sections() is split on "## " only, so a manifest that moves to "### " nesting will hide sizes inside the parent section.
I added
test/llms-size.test.ts, which reads/llms.txtas anonymous, member and admin and fails when a role's manifest passes its ceiling. The failure message gives the size and names the five largest sections, split at##headings, with their byte counts. The new test file andbun x tsc --noEmitpass; I did not run the rest of the suite.The ceilings are a row each in the test: anonymous 9,100, member 82,300, admin 94,100 bytes. These are the numbers already in
test/llms-budget.test.ts, so nothing is raised. Anonymous sits below the 10,500 the issue allows, and I kept the tighter one rather than loosen it.src/web/llms_tools.tsorsrc/web/llms_full.ts. No trim was needed, since all three roles are under their ceilings.llms-budget.test.tsalready enforces the same ceilings, so this file doubles that check. I left the old test alone and did not merge the two.bun test test/llms-size.test.ts. To see the failure message, lower a ceiling inROWStemporarily.Closes #15635