Skip to content

CS-11022: emit boxel-ui-checksum.txt from vite host build#4649

Merged
lukemelia merged 2 commits intomainfrom
cs-11022-restore-deleted-package-dist-checksums
May 6, 2026
Merged

CS-11022: emit boxel-ui-checksum.txt from vite host build#4649
lukemelia merged 2 commits intomainfrom
cs-11022-restore-deleted-package-dist-checksums

Conversation

@lukemelia
Copy link
Copy Markdown
Contributor

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:

  • Walk `packages/boxel-ui/addon/dist` recursively, skip `.map` files
  • Sort files, hash `relPath:sha256(content)` stream
  • Emit `boxel-ui-checksum.txt` at the bundle root via `this.emitFile`

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):

  • Direct `calculateBoxelUIChecksum()` returns a deterministic 64-char SHA256 across runs
  • `generateBundle` emits one asset, `{ type: 'asset', fileName: 'boxel-ui-checksum.txt', source: }` — exactly what `compilation.emitAsset` produced before
  • Missing-dist path warns and emits nothing (matches prior behavior)

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

  • CI: host tests pass
  • Manual (after deploy): `curl /boxel-ui-checksum.txt` returns a 64-char hex string
  • Manual (after deploy): `POST /_post-deployment` against staging realm-server returns 200 (no longer throwing on the boxel-ui checksum fetch)

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Preview deployments

Host Test Results

    1 files  ±    0      1 suites  ±0   3h 54m 6s ⏱️ + 2h 5m 48s
2 565 tests +  208  2 549 ✅ +  218  15 💤 ± 0  0 ❌ ± 0  1 🔥  - 10 
5 168 runs  +2 793  5 136 ✅ +2 798  30 💤 +15  1 ❌  - 10  1 🔥  - 10 

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
1 248 tests ±0  1 248 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 326 runs  ±0  1 326 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit f56976b. ± Comparison against earlier commit b51cc1c.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 emits boxel-ui-checksum.txt at the bundle root.
  • Wire the new plugin into packages/host/vite.config.mjs so it runs during vite 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.

Comment thread packages/host/lib/build/boxel-ui-checksum-plugin.mjs
Comment thread packages/host/vite.config.mjs Outdated
@lukemelia lukemelia requested review from a team and backspace May 5, 2026 17:09
@lukemelia lukemelia force-pushed the cs-11022-restore-deleted-package-dist-checksums branch from 1b05bad to b51cc1c Compare May 5, 2026 21:52
lukemelia and others added 2 commits May 5, 2026 19:24
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>
@lukemelia lukemelia force-pushed the cs-11022-restore-deleted-package-dist-checksums branch from b51cc1c to f56976b Compare May 5, 2026 23:24
@lukemelia lukemelia merged commit a5048fe into main May 6, 2026
97 of 102 checks passed
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.

3 participants