CS-11022: emit boxel-ui-checksum.txt from vite host build#4649
CS-11022: emit boxel-ui-checksum.txt from vite host build#4649
Conversation
Preview deploymentsHost Test Results 1 files ± 0 1 suites ±0 3h 54m 6s ⏱️ + 2h 5m 48s Results for commit f56976b. ± Comparison against earlier commit b51cc1c. For more details on these errors, see this check. Realm Server Test Results 1 files ±0 1 suites ±0 16m 28s ⏱️ +40s Results for commit f56976b. ± Comparison against earlier commit b51cc1c. |
There was a problem hiding this comment.
Pull request overview
This PR restores the boxel-ui-checksum.txt artifact in Vite-built host bundles so realm-server’s post-deployment logic can detect cross-deploy Boxel UI changes and trigger a full reindex (matching the legacy webpack behavior that previously produced this file).
Changes:
- Add a Vite/Rollup build-only plugin that computes a deterministic SHA256 over
packages/boxel-ui/addon/dist(excluding.map) and emitsboxel-ui-checksum.txtat the bundle root. - Wire the new plugin into
packages/host/vite.config.mjsso it runs duringvite build.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/host/vite.config.mjs | Imports and registers the new checksum-emitting Vite plugin during build. |
| packages/host/lib/build/boxel-ui-checksum-plugin.js | Implements checksum calculation + Rollup generateBundle emission of boxel-ui-checksum.txt. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1b05bad to
b51cc1c
Compare
Restores the cross-deploy boxel-ui-change signal that the webpack build produced. Vite plugin hashes packages/boxel-ui/addon/dist (skip source maps, sort files, sha256 of `relPath:sha256(content)` stream) identically to the deleted webpack plugin so an existing /persistent/boxel-ui-checksum.txt on EFS stays comparable across the cutover. Emits the checksum at the bundle root via this.emitFile, so the realm-server's fetchCurrentBoxelUIChecksum(<assetsURL>/boxel-ui-checksum.txt) call continues to work and POST /_post-deployment fires a full-reindex when boxel-ui changed. Build-only — `apply: 'build'` skips the dev server (no static checksum needed there, and walking the dist tree on every dev restart isn't worth the latency). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
packages/host has no "type": "module" in package.json, so a .js plugin file would be treated as CommonJS by any direct Node loader and fail on its top-level import/export. Vite's config loader bundles via esbuild so the build worked anyway, but .mjs makes the ESM intent explicit and avoids the trap if anything else ever imports this plugin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
b51cc1c to
f56976b
Compare
Summary
Restores the cross-deploy boxel-ui-change signal that the webpack build produced. The webpack plugin (
packages/host/lib/build/package-dist-checksums.js) was deleted in commit `0f24e3c06e` as part of the vite migration, but its consumer (`packages/realm-server/lib/boxel-ui-change-checker.ts` + `POST /_post-deployment`) was left in place — so on a vite-built host, `/boxel-ui-checksum.txt` 404s and the post-deploy reindex never fires when boxel-ui changes.Approach
New vite/rollup plugin at `packages/host/lib/build/boxel-ui-checksum-plugin.js`. Same algorithm as the webpack plugin so an existing `/persistent/boxel-ui-checksum.txt` on EFS stays comparable across the cutover:
Build-only (`apply: 'build'`) — dev server doesn't need a static checksum and walking the dist tree on every dev restart isn't worth the latency.
Verification
Smoke-tested the plugin in isolation (the local checkout predates the vite merge so a full `pnpm install + vite build` wasn't on hand):
CI's `vite build` step should produce the asset; reviewers can confirm by checking that `packages/host/dist/boxel-ui-checksum.txt` shows up in the build output artifact.
Test plan
🤖 Generated with Claude Code