Status: accepted · Date: 2026-11-28 · Amended: 2026-12-02 (the budget is 6,000,000 B)
Enforcement: apps/web/scripts/assert-docs-budget.mjs in pnpm --filter web build; scripts/measure-worker-build.mjs reports the chunk against the budget for a baseline and the working tree.
The developer docs, the ADRs and the changelog are compiled at build time into one server chunk (docs.page.server-*.js) and served by the same Worker as the app. ADR-0010 measured one change that added 64,903 B gzip of documentation to the Worker and left to the owner whether documentation counts against the Worker budget. On 2026-11-28 the chunk is 4,542,362 B raw and 621,937 B gzip, 15.5% of the 29,293,272 B of server modules, and it is the fastest-growing part of the bundle.
Decision
- Docs keep compiling into the Worker.
/docs,/llms.txt, the.mdroutes, search and the changelog stay one deployment with the app, and a change to behaviour ships with its page in the same commit. - The docs chunk has its own budget, separate from the code budgets of ADR-0010: 5,500,000 B raw, about a fifth above today's size (5,550,000 B since 2026-11-29: the chunk had reached 5,495,032 B, and the note that every feature has the ADR-0010 shape took it to 5,506,000 B; 5,650,000 B later the same day: the chunk had reached 5,544,117 B, and the Expo 58.1 changelog entry and rule M13 of ADR-0013 took it to 5,555,331 B; 5,750,000 B on 2026-11-30: combining web/mobile TanStack DB collections docs, ADR-0024 and the
packages/auth./rate-limit-storageexport row took it to 5,667,148 B; 5,950,000 B on 2026-12-01: the docs of the security fixes for uploads, auth, MCP, billing, documents and CI took it to 5,833,904 B). The budget is the constantDOCS_CHUNK_BUDGET_BYTESinscripts/docs-chunk.mjs. - The web build fails when the chunk is over the budget and prints its size and share of the budget on every build.
scripts/measure-worker-build.mjsrecords the chunk for the baseline and for the working tree, so a pull request can state the delta. - Raising the budget is a one-line change in the pull request that needs it, with the measured size in the Before / After table. Docs that describe behaviour are worth their bytes; the budget exists so that growth is a reviewed line and not a side effect.
The NGO panel guide, package exports and changelog brought the docs chunk from 5,947,930 B to 5,962,065 B raw on 2026-12-02. The revised ceiling is 6,000,000 B.
Consequences
The Worker's raw size limit is 64 MiB; at today's 29.3 MB the docs could grow severalfold before the limit matters, so this budget measures growth, not danger. The first response to the bundle trigger of ADR-0020 (raw bundle over 40 MiB or startup over 400 ms) is to stop compiling docs into the Worker, which would supersede this record. The chunk is found by its file name; renaming docs.page.server.ts fails the check until scripts/docs-chunk.mjs follows.
Alternatives
- Serve docs from a static site or a second Worker. Two deployments can drift, and the docs tests could no longer check links against the routes of the same build.
- No budget. ADR-0010 showed that documentation growth hides inside a code measurement.
- A gzip budget. The platform limit is on uncompressed bytes, and raw bytes do not depend on the compression level; gzip is reported next to it.