Skip to content

feat(build): build, verify and package the mobile web bundle with every desktop release (OTA phase A, 2/5) - #21326

Merged
Jinwoo-H merged 16 commits into
mainfrom
ota-a2-build
Sep 18, 2026
Merged

Jinwoo-H merged 16 commits into
mainfrom
ota-a2-build

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​653 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​650
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​718 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​712

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 buildId implementations 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's buildId, desktopVersion and 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 under src/ because the root-directory guard forbids new top-level entries. .gitattributes pins eol=lf (a CRLF checkout changes buildId), 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) into out/mobile-web/: index.html is the only stable name, every other asset is assets/<sha256>.<ext>, and manifest.json carries schemaVersion, buildId (sha256 over the sorted asset list, a pure function of content), desktopVersion, the protocol window read from src/shared/protocol-version.ts, entrypoint, totalBytes and the sorted assets. Deterministic: no timestamps, absolute paths, sourcemaps, metafile or legal comments. buildId cannot be injected into a hashed asset (the hash would depend on itself), so the page fetches ./manifest.json. The entry-script guard resolves through pathToFileURL on 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 same buildId; enforces the Phase A budget (≤16 assets, ≤256 KiB); verifies every asset hashes to its manifest entry; a function behind the same entry guard (no process.exit at import).
  • Scripts: build:mobile-web wired into build:desktop, build:release and build:release:parallel (siblings, not a chain), plus a Build mobile web bundle step in pr.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 dropped build:mobile-web call fails a test rather than a release.
  • Packaging: config/electron-builder.config.cjs excludes the source; out/mobile-web/ ships inside app.asar by the existing out rules, exactly like out/web (verified with a real FileMatcher). beforePack gains verify-packaged-mobile-web-bundle.cjs (same family as the other verify-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 (default out/mobile-web) so the existing arch-guard tests drive the real beforePack against a scratch bundle; production behaviour is unchanged (beforePack.length is pinned at 1). A missing bundle, a flipped byte, a truncated or deleted asset, a wrong buildId, a traversal path or a stray file all fail the release with a pnpm build:mobile-web remedy; proved by driving the real hook, not a packaging build.
  • Typecheck: config/tsconfig.mobile-web.json in the parallel typecheck runner, and a knip entry for the new source.

Bundle today

path bytes contentType
index.html 784 text/html; charset=utf-8
assets/13885b6d….css 704 text/css; charset=utf-8
assets/b119abed….js 965 text/javascript; charset=utf-8
assets/2c4e654d….png 105 image/png

buildId 9d78435e…, 2558 bytes, unchanged across the source move and the CSS reformat. Rendering proved in headless Chromium: all four assets 200, CSS applied, PNG decoded, printed buildId equals 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/scripts 203 files, 1819 tests, run with out/mobile-web absent 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; tracking docs/reference/plans/mobile-ota-phase-a.local.md (untracked).

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
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 92a0f155-d22f-4aa6-b496-7fd2d841db84

📥 Commits

Reviewing files that changed from the base of the PR and between c57673a and 554db7c.

📒 Files selected for processing (9)
  • config/electron-builder.config.cjs
  • config/scripts/build-mobile-web-bundle.mjs
  • config/scripts/build-mobile-web-bundle.test.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/mobile-web-bundle-packaging-workflow-contract.test.mjs
  • config/scripts/verify-mobile-web-bundle.mjs
  • config/scripts/verify-packaged-mobile-web-bundle.cjs
  • config/scripts/verify-packaged-mobile-web-bundle.test.mjs
  • src/mobile-web/src/bootstrap.css
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/mobile-web/src/bootstrap.css
  • config/scripts/build-mobile-web-bundle.mjs
  • config/scripts/verify-packaged-mobile-web-bundle.test.mjs
  • config/scripts/verify-mobile-web-bundle.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The 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 beforePack now include the mobile web bundle.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 554db

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed scope, implementation, testing, and review context. However, it does not follow several required template sections, including ELI5, Why, a Fixes # linked issue, Vis… Add and complete the missing template sections. Include a Fixes #<issue> reference, attach before/after visual proof or write N/A with a reason, complete the testing and checklist items, address the agent-skill boundary and Notes sectio…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: building, verifying, and packaging the mobile web bundle with desktop releases. It is specific and related to the pull request scope.
Full details: Docstring Coverage

Explanation

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 check

Explanation

The description provides detailed scope, implementation, testing, and review context. However, it does not follow several required template sections, including ELI5, Why, a Fixes # linked issue, Visual Proof or N/A, the required testing checkboxes, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Add and complete the missing template sections. Include a Fixes #&lt;issue&gt; reference, attach before/after visual proof or write N/A with a reason, complete the testing and checklist items, address the agent-skill boundary and Notes sections, and state AI disclosure details when applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f4157f6a-b49e-445a-adde-fa2064beb1a5

📥 Commits

Reviewing files that changed from the base of the PR and between 27bddc6 and 7a6a498.

⛔ Files ignored due to path filters (1)
  • mobile-web/src/orca-mark.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • config/electron-builder.config.cjs
  • config/scripts/build-mobile-web-bundle.mjs
  • config/scripts/build-mobile-web-bundle.test.mjs
  • config/scripts/run-typecheck-projects-in-parallel.mjs
  • config/scripts/verify-mobile-web-bundle.mjs
  • config/scripts/verify-packaged-mobile-web-bundle.cjs
  • config/scripts/verify-packaged-mobile-web-bundle.test.mjs
  • config/tsconfig.mobile-web.json
  • mobile-web/index.html
  • mobile-web/src/bootstrap.css
  • mobile-web/src/bootstrap.ts
  • package.json

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 fetches manifest.json and prints the bundle's buildId/versions.
  • build-mobile-web-bundle.mjs — esbuild into out/mobile-web/ with index.html as the only stable name, assets/<sha256>.<ext>, and a manifest.json whose buildId is a pure hash of the sorted asset list.
  • verify-mobile-web-bundle.mjs — builds twice into scratch, asserts a stable buildId, enforces the Phase A budget, re-hashes every asset, and rejects a stale out/mobile-web.
  • verify-packaged-mobile-web-bundle.cjs — new beforePack guard that re-validates the manifest and every asset's bytes before packaging.
  • Wiring — build:mobile-web appended to build:desktop/build:release/build:release:parallel; mobile-web/ excluded from app.asar; tsconfig.mobile-web.json added 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Moved the bundle source from the repo root mobile-web/ into src/mobile-web/, clearing the root-directory guard and placing it under the product-scope src/ prefix so the package lanes run for source-only edits.
  • Replaced the Windows-broken file://${process.argv[1]} entry guard with isDirectInvocation resolving through pathToFileURL, with a test that exercises the win32 URL form.
  • Added an explicit Build mobile web bundle step to the Linux package job and a workflow-contract test asserting every electron-builder --config job (except --prepackaged) reaches a bundle producer.
  • Pinned eol=lf for the bundle source in .gitattributes and added assertNoCarriageReturnsInSource plus git check-attr coverage, so a CRLF checkout cannot silently change every asset hash.
  • Wired tsconfig.mobile-web.json into the parallel typecheck runner and src/mobile-web/src/bootstrap.ts into 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.

Pullfrog  | View workflow run | Using 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ 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.

  • beforePack bundle-root seam — assertMobileWebBundleBuilt now takes an explicit bundle root, threaded through beforePack's second parameter with MOBILE_WEB_BUNDLE_DIR as the default, so the arch-guard unit tests drive the real hook against a scratch bundle instead of needing out/ built.
  • Reject unlisted bundle files — assertNoUnlistedFiles walks 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 — isDirectInvocation resolves argv[1] through an injectable realpathSync before 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 reachesBundleBuild chain test over package.json.
  • CSS reformat — bootstrap.css font-family wrapped by oxfmt.

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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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.mjs reuses the packaging guard — verifyMobileWebBundle() now calls assertMobileWebBundleBuilt from verify-packaged-mobile-web-bundle.cjs instead of re-implementing manifest parsing and asset hashing, so the dev verify rejects exactly what beforePack rejects (safe paths, recomputed buildId, 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 through package.json to a non---prepackaged electron-builder --config line, so daemon-relocation-spike.yml spike (packs via build:unpack) is detected. EXPECTED_PACKAGING_JOBS is 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.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit ad4f26c into main Sep 18, 2026
33 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-a2-build branch September 18, 2026 02:41
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…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
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