Repository navigation
feat(build): build, verify and package the mobile web bundle with every desktop release (OTA phase A, 2/5) - #21326
Conversation
A peer of src/ so the root workspace owns it and mobile's separate lockfile stays out of packaging. Four assets across four content types, enough to exercise multi-asset manifest handling rather than assume it. The page reads buildId from manifest.json at runtime: buildId hashes the asset list that index.html belongs to, so injecting it into a hashed asset would make that asset's hash depend on itself. Registered as a fourth typecheck project; without it the entry would be the only TypeScript in a release path that tsc never sees. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…kspace Root esbuild over mobile-web/ into out/mobile-web/, content-addressed as assets/<sha256>.<ext> with index.html the only stable name. buildId is the sha256 of the canonical serialization of the sorted asset list, so it is a pure function of content and usable as a cache key with no further reasoning. The verifier builds twice into scratch dirs and compares: a timestamp, an absolute path, or an unstable ordering fails the build when someone introduces it, not the first time a phone gets a spurious cache miss. It also enforces the Phase A budget of 16 assets and 256 KiB, separate from the permanent contract ceiling. build:release does not call build:desktop, so build:mobile-web is wired into build:desktop, build:release, and build:release:parallel. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ng or stale electron-builder only warns about a missing input, so without a beforePack guard a release ships an app that advertises the bundle capability and then errors on every request. The hash check, not the existence check, is what catches a half-written or stale out/. The source tree is excluded from app.asar; out/mobile-web ships inside it under the existing out rules, exactly as out/web does. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The changed-code casting gate rejects assertions, and `in` narrows the same untrusted JSON without one. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds a mobile web bootstrap page, stylesheet, and TypeScript entrypoint. A deterministic builder creates hashed assets and a manifest with a content-derived build ID. Verification checks source line endings, asset integrity, reproducibility, schema fields, and size limits. Desktop and release build scripts, CI packaging, typechecking, and Electron Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The mobile bundle build, verification, and packaging integration has no identified current failure that would block merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 11 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description provides detailed scope, implementation, testing, and review context. However, it does not follow several required template sections, including ELI5, Why, a Resolution Add and complete the missing template sections. Include a
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f4157f6a-b49e-445a-adde-fa2064beb1a5
⛔ Files ignored due to path filters (1)
mobile-web/src/orca-mark.pngis excluded by!**/*.png
📒 Files selected for processing (12)
config/electron-builder.config.cjsconfig/scripts/build-mobile-web-bundle.mjsconfig/scripts/build-mobile-web-bundle.test.mjsconfig/scripts/run-typecheck-projects-in-parallel.mjsconfig/scripts/verify-mobile-web-bundle.mjsconfig/scripts/verify-packaged-mobile-web-bundle.cjsconfig/scripts/verify-packaged-mobile-web-bundle.test.mjsconfig/tsconfig.mobile-web.jsonmobile-web/index.htmlmobile-web/src/bootstrap.cssmobile-web/src/bootstrap.tspackage.json
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
Caution
This PR's own CI is already red on package, package (windows), and root directory guard, and the unit test job will fail in a clean checkout. Four independent blockers, all fixable; details below and inline.
Reviewed changes
mobile-web/bootstrap source —index.html,bootstrap.ts,bootstrap.css, one PNG; a minimal page that fetchesmanifest.jsonand prints the bundle'sbuildId/versions.build-mobile-web-bundle.mjs— esbuild intoout/mobile-web/withindex.htmlas the only stable name,assets/<sha256>.<ext>, and amanifest.jsonwhosebuildIdis a pure hash of the sorted asset list.verify-mobile-web-bundle.mjs— builds twice into scratch, asserts a stablebuildId, enforces the Phase A budget, re-hashes every asset, and rejects a staleout/mobile-web.verify-packaged-mobile-web-bundle.cjs— newbeforePackguard that re-validates the manifest and every asset's bytes before packaging.- Wiring —
build:mobile-webappended tobuild:desktop/build:release/build:release:parallel;mobile-web/excluded fromapp.asar;tsconfig.mobile-web.jsonadded to the parallel typecheck runner. - Tests — build determinism/budget/manifest coverage plus the packaging guard's failure modes and electron-builder wiring.
🚨 New root-level mobile-web/ directory trips the root directory guard
root directory guard is failing on this PR. .github/scripts/check-root-directory-entries.mjs rejects any top-level entry not present on the base, and its REVIEWED_ROOT_ENTRIES allowlist contains only cloud. mobile-web/ is a brand-new top-level directory, so the guard blocks it, and no change in this PR updates the allowlist.
Technical details
# Add `mobile-web` to the reviewed root entries
## Affected sites
- `.github/scripts/check-root-directory-entries.mjs:18` — `REVIEWED_ROOT_ENTRIES = new Set(['cloud'])` does not include `mobile-web`.
- `.github/workflows/pr.yml:279-283` — `root_directory_guard` runs this script and is in `verify.needs`.
## Required outcome
- The guard accepts the reviewed `mobile-web/` addition while still rejecting arbitrary new root entries.
- `config/scripts/check-root-directory-entries.test.mjs` should carry a case for the new allowlisted entry (the existing `allows the reviewed cloud workspace directory` is the pattern).🚨 The Linux package job never builds out/mobile-web, so the new beforePack guard fails packaging
package is failing because its "Build package inputs" step runs build:cli, build:relay, build:electron-vite:parallel, build:web-from-renderer, and build:native — it does not run build:release:parallel (only package_windows does). electron-builder then invokes the new beforePack hook, whose assertMobileWebBundleBuilt() requires out/mobile-web/manifest.json, and throws. Reproduced locally: no bundle manifest at /…/out/mobile-web/manifest.json (ENOENT).
Technical details
# Build the mobile web bundle in the Linux package job
## Affected sites
- `.github/workflows/pr.yml:763-778` — Linux `package` "Build package inputs" assembles the inputs manually and omits `build:mobile-web`.
- `.github/workflows/pr.yml:789-796` — `electron-builder` runs `beforePack`, which calls `assertMobileWebBundleBuilt()`.
- `config/electron-builder.config.cjs:295-298` — `beforePack` now requires `out/mobile-web`.
## Required outcome
- `out/mobile-web` exists before `electron-builder` runs in the Linux `package` job, the same way `package_windows` gets it from `build:release:parallel`.
- Keep the existing parallelism shape; adding `pnpm run build:mobile-web` to the step (or to the parallel `scripts=(...)` array) is enough.
## Open questions for the human
- The PR body says "pr.yml calls the parallel one" — true for `package_windows` only. Was the Linux `package` step meant to be folded into `build:release:parallel`?ℹ️ mobile-web/ is outside the package-change scope
config/scripts/pr-code-change-scope.mjs does not list mobile-web/ in SHARED_PACKAGE_PREFIXES (and isProductBundlePath only special-cases src/), so a future PR that edits only mobile-web/src/** will run typecheck/test but not the package/package_windows lanes that exercise the new packaging guard. Worth adding alongside the guard work, since the bundle now ships inside every desktop release.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…passes
.github/scripts/check-root-directory-entries.mjs blocks any new top-level entry
by name, so mobile-web/ could not live at the root.
The source is excluded from app.asar by the existing '!src{,/**/*}' rule; the
explicit '!src/mobile-web{,/**/*}' entry stays as a marker. out/mobile-web is
unaffected and still ships under the out rules like out/web. No tsconfig
includes src/**, so node, web, cli, and relay do not pick the tree up; it is
registered as a knip entry so audit:dead-code does not call it unused.
buildId is unchanged at 9d78435e: the builder hashes content, not paths.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`file://${process.argv[1]}` never equals import.meta.url on Windows, where that
url is file:///C:/... So the builder exited 0 having written nothing and the
Windows packaging job failed later, at the guard, with no clue why. Every other
script in config/scripts already uses pathToFileURL; this one now does too, via
an exported predicate a posix runner can exercise with a win32 path.
The verify script had no entry guard at all, so importing its budget constants
ran the whole verification — including its process.exit — inside the test
worker. It is now a function behind the same guard.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
That job assembles packaging inputs step by step instead of calling build:release, so the new beforePack guard hard-failed it. The census test added here is the oracle: it walks every workflow job that invokes electron-builder without --prepackaged (which short-circuits doPack before beforePack) and requires a bundle-producing script in the same job. It goes red on exactly pr.yml's package job when this step is removed. Ten jobs covered; the other nine already ran build:release, build:release:parallel, or build:desktop. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ildId Every text byte under src/mobile-web is hashed into an asset digest and from there into buildId, so a CRLF checkout produces a different bundle id for the same commit: 91af2897 instead of 9d78435e. That would make a Windows-built desktop disagree with a mac-built one about which bundle a phone has cached. .gitattributes pins eol=lf for the text sources and -text for the PNG, matching the four trees already pinned for byte-hashing. The verify script asserts no source file carries a CR, so the build fails if the pin ever stops applying rather than silently shipping a second bundle identity. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
oxlint unicorn/prefer-import-meta-properties. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Moved the bundle source from the repo root
mobile-web/intosrc/mobile-web/, clearing the root-directory guard and placing it under the product-scopesrc/prefix so thepackagelanes run for source-only edits. - Replaced the Windows-broken
file://${process.argv[1]}entry guard withisDirectInvocationresolving throughpathToFileURL, with a test that exercises the win32 URL form. - Added an explicit
Build mobile web bundlestep to the Linuxpackagejob and a workflow-contract test asserting everyelectron-builder --configjob (except--prepackaged) reaches a bundle producer. - Pinned
eol=lffor the bundle source in.gitattributesand addedassertNoCarriageReturnsInSourceplusgit check-attrcoverage, so a CRLF checkout cannot silently change every asset hash. - Wired
tsconfig.mobile-web.jsoninto the parallel typecheck runner andsrc/mobile-web/src/bootstrap.tsinto the knip entries.
All four blockers from the prior review are resolved, and the new tests are meaningful (the packaging-workflow test fails if the Linux package step is removed; the CRLF and win32 tests target the exact regressions they describe). Verified locally: the three new test files (42 tests), six related contract tests (87 tests), and the changed-code quality gate (0 findings); package, package (windows), root directory guard, typecheck, and static analysis are green in CI.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…lized YAML yaml.stringify folds long lines, and in dev-channel-win-build.yml's build-win the fold landed between `electron-builder` and `--config`, so a real packaging job was invisible to the census: 11 jobs exist, the test saw 10. Slice each job's raw source by its parsed boundaries instead, and pin the inventory so a new packaging workflow has to be added here on purpose. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The census only checks that a packaging job invokes one of ten build scripts; that those scripts still reach build:mobile-web was asserted nowhere, so a dropped link would leave every job looking covered while packaging failed at beforePack. Resolve each script for real, and pin pr.yml's hand-rolled step, since that job never calls build:release. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Node resolves symlinks in import.meta.url but not in argv[1], so `node /tmp/...` against a /private/tmp realpath compared two different strings: the builder and the verifier exited 0 having written and checked nothing. Same silent-success shape as the Windows file:// bug, so the fix sits next to it, with both seams injectable. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
It was the only tracked CSS failing oxfmt --check. The buildId is unchanged at 9d78435e8bb73c3341f833c20aaefbd7bfdfc414b68dadf87c1689d86728fe33, because esbuild's CSS minifier normalises the whitespace this touches before the asset is hashed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The guard only walked the manifest, so a dropped assets/stale.js passed: assets are content-addressed, nothing ever overwrites a stale copy, and it would ship inside asar unreachable and unverified. Require every file under out/mobile-web to be the manifest or a listed asset. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The bundle guard read the repo's out/mobile-web unconditionally, so the two arch-aware packaging tests that call the real beforePack went red in the unit-test job, which never runs build:mobile-web. beforePack now takes the bundle root as a second parameter defaulting to out/mobile-web, which is what electron-builder gets, and those tests build a real bundle into a temp dir instead. The guard is neither skipped nor made tolerant of a missing bundle. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
ℹ️ No critical issues — one minor coverage gap in the new packaging census, inline.
Reviewed changes
The incremental delta since the prior pullfrog review (c57673a) is six commits of fixes and tests around the mobile web bundle packaging guard.
beforePackbundle-root seam —assertMobileWebBundleBuiltnow takes an explicit bundle root, threaded throughbeforePack's second parameter withMOBILE_WEB_BUNDLE_DIRas the default, so the arch-guard unit tests drive the real hook against a scratch bundle instead of needingout/built.- Reject unlisted bundle files —
assertNoUnlistedFileswalks the bundle directory and fails packaging on any file the manifest does not list, so a stale content-addressed asset cannot ship unreachable inside asar. - Realpath the entry path —
isDirectInvocationresolvesargv[1]through an injectablerealpathSyncbefore comparing, covering symlinked entry paths and Windows drive-letter case, with a new symlink end-to-end test. - Census rewritten over raw workflow text — the packaging-workflow contract test slices jobs by YAML node ranges instead of re-serializing (which folded a line and hid a job), asserts the exact 11-job list, and adds a
reachesBundleBuildchain test overpackage.json. - CSS reformat —
bootstrap.cssfont-family wrapped byoxfmt.
Verified locally: the four changed test files pass (90 tests), and app-builder-lib calls beforePack with the context alone (emitBeforePack → emit("beforePack", context)) and returns before it when --prepackaged is set, so the new seam and the census's --prepackaged exclusion are both sound.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
… the guard The workflow census only matched a literal `electron-builder --config` line, so daemon-relocation-spike's `pnpm run build:unpack` (which packs and runs beforePack) was invisible to it. Jobs now count when any `pnpm run <script>` they invoke chains to electron-builder without --prepackaged; the spike joins the pinned list (12 jobs). verify-mobile-web-bundle.mjs re-implemented a weaker subset of the packaging guard (no safe-path check, no buildId recompute). It now calls assertMobileWebBundleBuilt, so a manifest edited after the build fails at `pnpm build:mobile-web` exactly as at beforePack. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The incremental delta since the prior pullfrog review (dbc494c) is one commit, and it closes the census gap that review raised.
verify-mobile-web-bundle.mjsreuses the packaging guard —verifyMobileWebBundle()now callsassertMobileWebBundleBuiltfromverify-packaged-mobile-web-bundle.cjsinstead of re-implementing manifest parsing and asset hashing, so the dev verify rejects exactly whatbeforePackrejects (safe paths, recomputedbuildId, on-disk hashes, unlisted files). The Phase A budget and the two-build reproducibility check stay local.- Packaging census follows script wrappers — a job now counts as a packaging job when any
pnpm [run] <script>it invokes chains throughpackage.jsonto a non---prepackagedelectron-builder --configline, sodaemon-relocation-spike.yml spike(packs viabuild:unpack) is detected.EXPECTED_PACKAGING_JOBSis pinned at 12 and the exact-list assertion still guards the set.
Verified locally: pnpm run build:mobile-web produces and verifies buildId 9d78435e…, the two changed test files pass (41 tests), and oxlint is clean on both. The prior inline thread is resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ry desktop release (OTA phase A, 2/5) (stablyai#21326) * feat(mobile-web): add the Phase A bootstrap web source A peer of src/ so the root workspace owns it and mobile's separate lockfile stays out of packaging. Four assets across four content types, enough to exercise multi-asset manifest handling rather than assume it. The page reads buildId from manifest.json at runtime: buildId hashes the asset list that index.html belongs to, so injecting it into a hashed asset would make that asset's hash depend on itself. Registered as a fourth typecheck project; without it the entry would be the only TypeScript in a release path that tsc never sees. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * feat(build): build and verify the mobile web bundle from the root workspace Root esbuild over mobile-web/ into out/mobile-web/, content-addressed as assets/<sha256>.<ext> with index.html the only stable name. buildId is the sha256 of the canonical serialization of the sorted asset list, so it is a pure function of content and usable as a cache key with no further reasoning. The verifier builds twice into scratch dirs and compares: a timestamp, an absolute path, or an unstable ordering fails the build when someone introduces it, not the first time a phone gets a spurious cache miss. It also enforces the Phase A budget of 16 assets and 256 KiB, separate from the permanent contract ceiling. build:release does not call build:desktop, so build:mobile-web is wired into build:desktop, build:release, and build:release:parallel. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * feat(packaging): fail the release when the mobile web bundle is missing or stale electron-builder only warns about a missing input, so without a beforePack guard a release ships an app that advertises the bundle capability and then errors on every request. The hash check, not the existence check, is what catches a half-written or stale out/. The source tree is excluded from app.asar; out/mobile-web ships inside it under the existing out rules, exactly as out/web does. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * refactor(mobile-web): narrow the manifest with `in` instead of a cast The changed-code casting gate rejects assertions, and `in` narrows the same untrusted JSON without one. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile-web): move the bundle source under src/ so the root guard passes .github/scripts/check-root-directory-entries.mjs blocks any new top-level entry by name, so mobile-web/ could not live at the root. The source is excluded from app.asar by the existing '!src{,/**/*}' rule; the explicit '!src/mobile-web{,/**/*}' entry stays as a marker. out/mobile-web is unaffected and still ships under the out rules like out/web. No tsconfig includes src/**, so node, web, cli, and relay do not pick the tree up; it is registered as a knip entry so audit:dead-code does not call it unused. buildId is unchanged at 9d78435e: the builder hashes content, not paths. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(build): resolve the entry-script guard through pathToFileURL `file://${process.argv[1]}` never equals import.meta.url on Windows, where that url is file:///C:/... So the builder exited 0 having written nothing and the Windows packaging job failed later, at the guard, with no clue why. Every other script in config/scripts already uses pathToFileURL; this one now does too, via an exported predicate a posix runner can exercise with a win32 path. The verify script had no entry guard at all, so importing its budget constants ran the whole verification — including its process.exit — inside the test worker. It is now a function behind the same guard. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(ci): build the mobile web bundle in the PR package job That job assembles packaging inputs step by step instead of calling build:release, so the new beforePack guard hard-failed it. The census test added here is the oracle: it walks every workflow job that invokes electron-builder without --prepackaged (which short-circuits doPack before beforePack) and requires a bundle-producing script in the same job. It goes red on exactly pr.yml's package job when this step is removed. Ten jobs covered; the other nine already ran build:release, build:release:parallel, or build:desktop. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(mobile-web): pin source line endings, because CRLF changes the buildId Every text byte under src/mobile-web is hashed into an asset digest and from there into buildId, so a CRLF checkout produces a different bundle id for the same commit: 91af2897 instead of 9d78435e. That would make a Windows-built desktop disagree with a mac-built one about which bundle a phone has cached. .gitattributes pins eol=lf for the text sources and -text for the PNG, matching the four trees already pinned for byte-hashing. The verify script asserts no source file carries a CR, so the build fails if the pin ever stops applying rather than silently shipping a second bundle identity. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * style(build): read the test's own path from import.meta.filename oxlint unicorn/prefer-import-meta-properties. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(test): census packaging jobs over raw workflow text, not re-serialized YAML yaml.stringify folds long lines, and in dev-channel-win-build.yml's build-win the fold landed between `electron-builder` and `--config`, so a real packaging job was invisible to the census: 11 jobs exist, the test saw 10. Slice each job's raw source by its parsed boundaries instead, and pin the inventory so a new packaging workflow has to be added here on purpose. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * test(build): assert the script chain the packaging census trusts The census only checks that a packaging job invokes one of ten build scripts; that those scripts still reach build:mobile-web was asserted nowhere, so a dropped link would leave every job looking covered while packaging failed at beforePack. Resolve each script for real, and pin pr.yml's hand-rolled step, since that job never calls build:release. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(build): realpath the entry path before the direct-invocation compare Node resolves symlinks in import.meta.url but not in argv[1], so `node /tmp/...` against a /private/tmp realpath compared two different strings: the builder and the verifier exited 0 having written and checked nothing. Same silent-success shape as the Windows file:// bug, so the fix sits next to it, with both seams injectable. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * style(mobile-web): format bootstrap.css with oxfmt It was the only tracked CSS failing oxfmt --check. The buildId is unchanged at 9d78435e8bb73c3341f833c20aaefbd7bfdfc414b68dadf87c1689d86728fe33, because esbuild's CSS minifier normalises the whitespace this touches before the asset is hashed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(packaging): reject bundle files the manifest does not list The guard only walked the manifest, so a dropped assets/stale.js passed: assets are content-addressed, nothing ever overwrites a stale copy, and it would ship inside asar unreachable and unverified. Require every file under out/mobile-web to be the manifest or a listed asset. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(packaging): give beforePack an explicit mobile web bundle root The bundle guard read the repo's out/mobile-web unconditionally, so the two arch-aware packaging tests that call the real beforePack went red in the unit-test job, which never runs build:mobile-web. beforePack now takes the bundle root as a second parameter defaulting to out/mobile-web, which is what electron-builder gets, and those tests build a real bundle into a temp dir instead. The guard is neither skipped nor made tolerant of a missing bundle. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb * fix(packaging): census sees script-wrapped packers; dev verify reuses the guard The workflow census only matched a literal `electron-builder --config` line, so daemon-relocation-spike's `pnpm run build:unpack` (which packs and runs beforePack) was invisible to it. Jobs now count when any `pnpm run <script>` they invoke chains to electron-builder without --prepackaged; the spike joins the pinned list (12 jobs). verify-mobile-web-bundle.mjs re-implemented a weaker subset of the packaging guard (no safe-path check, no buildId recompute). It now calls assertMobileWebBundleBuilt, so a manifest edited after the build fails at `pnpm build:mobile-web` exactly as at beforePack. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

What this is
Second of five PRs for Phase A of the mobile OTA work (desktop builds and serves a content-addressed mobile web bundle behind a new capability; no released phone changes). This PR is the producer and its packaging guard. The contract is #21325 (landed); this builder's manifest validates against it and both
buildIdimplementations agree byte for byte (checked by both reviewers); a parity test that pins the three serializers to each other lands with the host-surface PR.Change
src/mobile-web/: a bootstrap page (index.html, a small TypeScript entry, a stylesheet, one PNG) that renders and prints the bundle'sbuildId,desktopVersionand protocol window. Deliberately minimal: the bundle format is the deliverable, and Phase C swaps the producer for the real screens behind the same manifest. Lives undersrc/because the root-directory guard forbids new top-level entries..gitattributespinseol=lf(a CRLF checkout changesbuildId), and the verifier asserts no source carries a carriage return.config/scripts/build-mobile-web-bundle.mjs: root esbuild (already a root dependency; no lockfile change) intoout/mobile-web/:index.htmlis the only stable name, every other asset isassets/<sha256>.<ext>, andmanifest.jsoncarriesschemaVersion,buildId(sha256 over the sorted asset list, a pure function of content),desktopVersion, the protocol window read fromsrc/shared/protocol-version.ts,entrypoint,totalBytesand the sorted assets. Deterministic: no timestamps, absolute paths, sourcemaps, metafile or legal comments.buildIdcannot be injected into a hashed asset (the hash would depend on itself), so the page fetches./manifest.json. The entry-script guard resolves throughpathToFileURLon a realpath'd argv so it works on Windows and through symlinks.config/scripts/verify-mobile-web-bundle.mjs: builds twice into scratch directories and asserts the samebuildId; enforces the Phase A budget (≤16 assets, ≤256 KiB); verifies every asset hashes to its manifest entry; a function behind the same entry guard (noprocess.exitat import).build:mobile-webwired intobuild:desktop,build:releaseandbuild:release:parallel(siblings, not a chain), plus aBuild mobile web bundlestep inpr.yml's package job, which assembles its inputs by hand. A census test over every workflow job that invokes electron-builder without--prepackaged(11 jobs, matched on raw workflow text because YAML re-serialisation folds lines) asserts each produces the bundle first, and a second test resolves the script chain so a droppedbuild:mobile-webcall fails a test rather than a release.config/electron-builder.config.cjsexcludes the source;out/mobile-web/ships insideapp.asarby the existingoutrules, exactly likeout/web(verified with a realFileMatcher).beforePackgainsverify-packaged-mobile-web-bundle.cjs(same family as the otherverify-packaged-*guards): manifest present and parseable, every listed asset present and sha256-matching, no unlisted file in the directory. The config passes the bundle root as an explicit argument (defaultout/mobile-web) so the existing arch-guard tests drive the realbeforePackagainst a scratch bundle; production behaviour is unchanged (beforePack.lengthis pinned at 1). A missing bundle, a flipped byte, a truncated or deleted asset, a wrongbuildId, a traversal path or a stray file all fail the release with apnpm build:mobile-webremedy; proved by driving the real hook, not a packaging build.config/tsconfig.mobile-web.jsonin the parallel typecheck runner, and a knip entry for the new source.Bundle today
index.htmlassets/13885b6d….cssassets/b119abed….jsassets/2c4e654d….pngbuildId9d78435e…, 2558 bytes, unchanged across the source move and the CSS reformat. Rendering proved in headless Chromium: all four assets 200, CSS applied, PNG decoded, printedbuildIdequals the manifest's, zero page errors.Review
Round 1: do not ship, three blockers all red on CI and all fixed: a Windows-only entry guard that exited 0 writing nothing; the root-directory guard forbidding the top-level source; the PR package job never running the build. Plus the eol pin. Round 2 (fresh): ship after fixes, all applied: the census regex over folded YAML missed one of 11 packaging jobs; the script chain was asserted nowhere; the argv path was not realpath'd; the CSS failed
oxfmt; the guard ignored unlisted files. CI then showed the two arch-guard tests hitting the guard in the unit-test job, fixed by the explicit bundle root.Gates
All four typecheck projects clean · vitest
config/scripts203 files, 1819 tests, run without/mobile-webabsent to match CI · oxlint 0 · oxfmt clean · changed-code quality 0 findings across 10 files · max-lines ratchet OK · root-directory guard passed. Lead reproduced the build, the verify, the tests under the CI condition, and the guard.Design:
/tmp/step2-parallel/phase-a-design.md; trackingdocs/reference/plans/mobile-ota-phase-a.local.md(untracked).