build: name the source-archive ceilings in the context check (SUP2-1094)
Fixes SUP2-1094. insta build --json said needs-attention with only a "large context" warning at 315.3 MB. The 256 MiB compressed upload cap first showed up at insta deploy, after packing (307.7 MiB > 256.0 MiB).
What changes
The context check in insta build now measures the context against the archive lane's limits (pack.ts ARCHIVE_LIMITS). Build stays offline, so these are labelled as defaults; the server's negotiated figures still win at deploy.
| Case | Message |
|---|---|
| over the extracted-size or entry limit, | too large for insta deploy <dir>: … |
already-compressed files (.gz/.xz/.zip/images/video…) alone, or payload plus tar headers/padding, over the upload limit | ships only if it compresses below the cap (extension-based estimate, never a certain verdict) |
| uncompressed size over the upload limit | X MiB uncompressed (Y of it already compressed) — ships only if it compresses below the cap |
| under the cap | unchanged |
Uncompressed bytes alone never make the call, because a large text tree can pack small. When a ceiling applies, the next action also covers intentional large assets: recompress with xz/zstd, or fetch the file at start-up. That's the reporter's case: a checkpoint they ship on purpose.
--json gains archiveLimits: {maxArchiveBytes, maxExtractedBytes, maxFiles, source: "default"}.
Verification
npm run typecheckpasses.test/build.test.tspasses 41/41, including new cases: 315 MB reported case, compressible vs incompressible, extracted/entry limits, custom limits, compressed-file accounting.- Ran it on real directories (300 MiB):
- random
checkpoint.gz→too large for insta deploy <dir>: already-compressed files alone are 300.0 MiB, over the 256.0 MiB compressed upload limit - zero-filled
data.bin→ships only if it compresses below that
- random
npm test:test/setup-agent.test.tsfails 12 tests withApiError: unauthorized. It fails the same way on unmodifiedmainon my machine (local login state), so this PR doesn't cause it.
Docs: skills insta/cli-reference.md updated in a companion PR.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
The insta build context check now flags contexts that exceed the deploy archive ceilings at build time, instead of surfacing only at insta deploy after packing.
- Ceilings are measured against what the packer would actually archive (root
.dockerignore, else.gitignorefallback), not the docker context, and count tar headers and gzip framing along with the payload. - Over the extracted-size or entry limit → certain failure: too large for
insta deploy <dir>. Uncompressed size alone never triggers a certain verdict, since compressible trees can pack well below the cap. - Already-compressed files (
.gz,.xz,.zip, images, video, etc.) alone over the upload cap → warning that it ships only if it compresses below the cap (extension-based estimate; stored files can still shrink), with guidance to recompress intentional large assets with xz/zstd or fetch them at start-up. - Uncompressed size over the cap but compressible → similar warning, noting how much is already compressed and any payload that sits near the limit once tar headers count.
--jsongainsarchiveLimitswith the default ceilings, labelled as such since build runs offline and the server's negotiated figures still win at deploy.