Data Liberation: Budget portable media from the remaining artifact capacity - #4675
Merged
chubes4 merged 1 commit intoAug 26, 2026
Merged
Conversation
The export selected portable media against its own 160 MiB cap without knowing how many bytes the routes, captured render dependencies, and reports already take. On a 28-page Wix capture the media filled that cap and the artifact writer then threw "Portable capture exceeds compiler limits" against the 192 MiB total, discarding a three-minute capture instead of degrading. Reserve the staged route HTML, the captured non-script resources, and the report files that already exist on disk, and give media only what is left under the artifact limit (still capped at 160 MiB). The reservation is an upper bound: media that does not fit is retained external, as before, rather than failing the export. The receipt reports the effective `max_bytes` and the `reserved_bytes` behind it, and the artifact header carries the effective total limit. `ExportCaptureOptions.limits` lets a caller (and the test) override the artifact and media limits without touching the compiler defaults. Re-exporting the same Wix capture selects the same 167 files (24.3 MB) with 145 MB reserved and a 56 MB media budget; the artifact is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Note on CI: the red "Unit Tests" job is inherited from the base branch. PR #3952's own build (buildkite 21303) fails the same job, and the failing suites are all in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The capture export now budgets portable media from the capacity left under the artifact limit, instead of a fixed 160 MiB that ignores everything else in the artifact.
Why
Routes, captured render dependencies, and reports share the 192 MiB artifact with media. The export selected media against its own cap only, so a media-heavy capture could pass selection and then throw "Portable capture exceeds compiler limits" while writing
artifact.json. That discards the whole capture instead of degrading.Now the export reserves the staged route HTML, the captured non-script resources, and the report files already on disk, and gives media only what is left (still capped at 160 MiB). Media that does not fit is retained external, as before. The receipt reports the effective
max_bytesand thereserved_bytesbehind it.ExportCaptureOptions.limitslets a caller or a test override the limits without touching the defaults.Re-exporting a real 28-page Wix capture selects the same 167 files (24.3 MB) with 145 MB reserved and a 56 MB media budget; the artifact is byte-for-byte the same size.
How to test
cd packages/data-liberation-agent && npx vitest run src/lib/capture-export.test.ts(new test: "keeps portable media within the artifact capacity left after routes and resources")capture-receipt.json→portableMedia.reserved_bytesafter astudio create --from <url>.Bundles were rebuilt from this source.
Part of the
studio create --fromwork in #3952.AI assistance: Claude Code (Claude Fable 5) found the budget gap and drafted the change. Aagam Shah directed the work and is responsible for it.
🤖 Generated with Claude Code