Skip to content

fix(builder): build Vite production assets during image assembly - #1229

Closed
Koh0920 wants to merge 2 commits into
mainfrom
fix/vite-production-image-build
Closed

fix(builder): build Vite production assets during image assembly#1229
Koh0920 wants to merge 2 commits into
mainfrom
fix/vite-production-image-build

Conversation

@Koh0920

@Koh0920 Koh0920 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Run the explicit Vite production build while assembling the image because the guest rootfs is read-only at boot.
  • Run vite preview only at runtime, preserving restore without build cost.

Strict build-script eligibility

The image-time prebuild is issued only for a recognized package-manager preview launch whose package.json build script ends in plain vite build. Shell syntax and compound build scripts are rejected; Vite detection does not authorize any static-output declaration.

CI prerequisite

Windows CI exposed an existing main failure in the builder-script test shell. The independent fix is #1230; this PR will rebase onto its merge commit and rerun the complete matrix before merge.

Static Web Bundle prerequisite

This is the minimal Vite production-lane prerequisite for ato #1227. It intentionally contains only the two independent Vite production lane commits, not unrelated surface-activation work.

No staging/production deploy or infrastructure mutation is included.

Koh0920 added 2 commits August 2, 2026 16:42
…erver

Community capsules inferred from a package.json whose scripts declare plain
`vite build` + `vite preview` now launch
`sh -lc "<pm> run build && <pm> run preview -- --host 0.0.0.0 --port 8000 --strictPort"`
instead of the dev server. Dev serving shipped the unbundled module graph
through the app proxy — measured for drawdb: 448 requests / 115 MB before
first paint (the 'ready but blank for ~30s' preview); swagger-editor's graph
is 542 modules and never finishes booting. The build runs once at snapshot
capture (restores resume the serving process), and the pinned v1 lane grants
build-then-serve commands the capped 600 s boot budget for that capture.
Compound build scripts or a missing preview script keep the dev lane
(fail-closed, unchanged behavior).

Claude-Session: https://claude.ai/code/session_015MNKB1dibFqVffp5UQcg8V
…at boot

The first cut launched `sh -lc "npm run build && npm run preview …"` — but
the v1 guest rootfs is mounted read-only (only tool-owned cache paths are
tmpfs-redirected), so `vite build` writing dist/ dies on EROFS at boot and
the capture burns its whole readiness budget (observed twice on the staging
builder: 600 s spent, guest never healthy; the same build in an equivalent
2-cpu/6 GiB container takes 11 s).

The build now runs as part of image assembly: build_v1 chains
`<pm> run build` after dependency install when the launch is
`<pm> run preview …` and package.json declares a plain `… vite build`
script (vite_production_prebuild_cmd — evidence-based and fail-closed, same
doctrine as base_image_and_install). The inferred launch becomes a plain
`<pm> run preview -- --host 0.0.0.0 --port 8000 --strictPort` argv with the
standard 60 s readiness, and dist/ ships read-only in the identity-bearing
guest tree. The now-unneeded shell-compound seal arm and capture boot-budget
special case are reverted.

Claude-Session: https://claude.ai/code/session_015MNKB1dibFqVffp5UQcg8V
@Koh0920

Koh0920 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1231 (identical patch-ids for both commits, verified with git patch-id --stable); merged to main as part of the Surface Activation v2 arc.

@Koh0920 Koh0920 closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant