CLI: Bound the stored static import receipt - #4676
Conversation
|
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 |
The generated import script wrote Static Site Importer's full response into `.studio-import/result.json` as `import_receipt`. On a 28-page Wix artifact that response was 3.04 GB (`import_report` 2.72 GB, `materialization_receipt` 325 MB). macOS `write(2)` rejects a single write of 2 GB or more, so `file_put_contents` returned false and the import failed with "result receipt could not be saved" after every page and the theme had already been materialized. Store the existing bounded projection (`static_site_importer_studio_result_projection`) as the receipt on both the success and failure paths. The CLI only reads `continuation`, `canonicalization_pending`, `completed_routes`, and `total_routes` from the receipt, and the database option already stores the same projection. With this change the same import completes, canonicalizes 32 pages, and writes a 124 KB receipt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
77f6abc to
abd13b2
Compare
|
CI update: after a no-change re-push, "CLI E2E Tests" passed again (22 min) and "Unit Tests" flipped from pass to fail with the same inherited |
What
The generated
.studio-import/import.phpnow stores the bounded result projection asimport_receiptinresult.json, on both the success and the failure path. It used to store Static Site Importer's full response.Why
On a 28-page Wix artifact, SSI's import response was 3.04 GB (
import_report2.72 GB,materialization_receipt325 MB). macOSwrite(2)rejects a single write of 2 GB or more, sofile_put_contentsreturned false and the import failed with "Static Site Importer result receipt could not be saved" after every page and the theme had already been materialized. Node could not have parsed a receipt that size either.The CLI reads only
continuation,canonicalization_pending,completed_routes, andtotal_routesfrom the receipt, and the database option already stores the same bounded projection.With this change the same import completes, canonicalizes 32 pages, and writes a 124 KB receipt. The oversized SSI response itself is reported separately in the static-site-importer repo.
How to test
npx vitest run apps/cli/commands/site/tests/create.test.tsstudio create --from <artifact dir or url>on a large site and confirm.studio-import/result.jsonstays small and the import finishes.Part of the
studio create --fromwork in #3952.AI assistance: Claude Code (Claude Fable 5) traced the failed write to the 2 GB limit and drafted the change. Aagam Shah directed the work and is responsible for it.
🤖 Generated with Claude Code