build(mobile): re-measure the page's script sweep for server workspaces

Main already sat on its 78-script ceiling (re-swept: 78, table: 74); the workspace
route's shared modules split importer sets three ways more, reaching 81. Re-swept per
route prefix on this head, as #24257 did for its feature; the spread is now 1 to 11.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
Jinwoo-H
2026-10-11 05:18:20 -04:00
parent 96863da6f4
commit ce71823be3
2 changed files with 21 additions and 21 deletions
@@ -539,10 +539,10 @@ describe('the Phase C budget', () => {
key
).toBeGreaterThanOrEqual(measured)
}
// 1 to 10 per route, which is why four per route was a bound rather than a fit and why the
// 1 to 11 per route, which is why four per route was a bound rather than a fit and why the
// envelope cannot be a line through the measurement either.
expect(Math.min(...MOBILE_WEB_APP_BUNDLE_ROUTE_SCRIPT_SPREAD)).toBe(1)
expect(Math.max(...MOBILE_WEB_APP_BUNDLE_ROUTE_SCRIPT_SPREAD)).toBe(10)
expect(Math.max(...MOBILE_WEB_APP_BUNDLE_ROUTE_SCRIPT_SPREAD)).toBe(11)
})
it('sits exactly one margin over the swept tree and grants the worst route beyond it', () => {
@@ -614,13 +614,13 @@ describe('the Phase C budget', () => {
it('fails the build when the derived ceiling passes what the phone will accept', async () => {
// The shell hands back null for a manifest over its own ceiling, so a derived ceiling above
// that ships a green build no device can open. At the 42 images the tree carries, the envelope
// plus 42 plus the document crosses 256 at 30 routes, which Phase C reaches. The crossing came
// plus 42 plus the document crosses 256 at 28 routes, which Phase C reaches. The crossing came
// in from 50 with the envelope: it grants the worst swept route to each one past the sweep,
// where `4r + 16` granted four, so re-measuring a tree whose routes share more moves it out.
expect(await readMobileWebBundleMaxAssets()).toBe(MOBILE_WEB_BUNDLE_MAX_ASSETS)
expect(assertAssetCeilingFitsShell(29, 42, MOBILE_WEB_BUNDLE_MAX_ASSETS)).toBe(251)
expect(() => assertAssetCeilingFitsShell(30, 42, MOBILE_WEB_BUNDLE_MAX_ASSETS)).toThrow(
/261 .*256/
expect(assertAssetCeilingFitsShell(27, 42, MOBILE_WEB_BUNDLE_MAX_ASSETS)).toBe(249)
expect(() => assertAssetCeilingFitsShell(28, 42, MOBILE_WEB_BUNDLE_MAX_ASSETS)).toThrow(
/260 .*256/
)
})
})
+15 -15
View File
@@ -50,9 +50,9 @@ export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 9 * 1024 * 1024
* A chunk is emitted per distinct set of importers, not per route, so a route's marginal cost is
* what it fails to share rather than what it weighs. Re-measured on this head by building
* `routes.slice(0, n)` for every n, which is what the fence below is derived from rather than
* fitted to. The spread it shows is 1 to 10: `pr` and `web` add one script each, `session` adds ten.
* fitted to. The spread it shows is 1 to 11: `pr` and `web` add one script each, `tasks` adds eleven.
* The root `./_layout.tsx` (the page's web sibling of the native root) sorts first; with it the
* swept tree reads 74 scripts at 16 routes.
* swept tree reads 81 scripts at 16 routes.
*
* This table is the fence's only input, so a route added to the tree stales it and the pins beside
* the fence fail until it is re-measured. That is the point: the bound is re-derived, never bumped.
@@ -60,20 +60,20 @@ export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 9 * 1024 * 1024
export const MOBILE_WEB_APP_BUNDLE_SCRIPT_SWEEP = [
['./_layout.tsx', 3],
['./h/[hostId]/[...page].tsx', 7],
['./h/[hostId]/accounts.tsx', 9],
['./h/[hostId]/agent-history/[worktreeId].tsx', 14],
['./h/[hostId]/accounts.tsx', 10],
['./h/[hostId]/agent-history/[worktreeId].tsx', 15],
['./h/[hostId]/edit.tsx', 19],
['./h/[hostId]/files/[worktreeId].tsx', 24],
['./h/[hostId]/files/preview/[worktreeId].tsx', 32],
['./h/[hostId]/files/[worktreeId].tsx', 23],
['./h/[hostId]/files/preview/[worktreeId].tsx', 31],
['./h/[hostId]/history/[worktreeId].tsx', 34],
['./h/[hostId]/index.tsx', 39],
['./h/[hostId]/pr/[worktreeId].tsx', 40],
['./h/[hostId]/review/[worktreeId].tsx', 48],
['./h/[hostId]/session/[worktreeId].tsx', 58],
['./h/[hostId]/source-control/[worktreeId].tsx', 63],
['./h/[hostId]/tasks.tsx', 71],
['./h/[hostId]/web.tsx', 72],
['./h/_layout.tsx', 74]
['./h/[hostId]/index.tsx', 41],
['./h/[hostId]/pr/[worktreeId].tsx', 42],
['./h/[hostId]/review/[worktreeId].tsx', 51],
['./h/[hostId]/session/[worktreeId].tsx', 61],
['./h/[hostId]/source-control/[worktreeId].tsx', 66],
['./h/[hostId]/tasks.tsx', 77],
['./h/[hostId]/web.tsx', 78],
['./h/_layout.tsx', 81]
]
const sweptScripts = MOBILE_WEB_APP_BUNDLE_SCRIPT_SWEEP.map(([, scripts]) => scripts)
@@ -191,7 +191,7 @@ export async function readMobileWebBundleMaxAssets() {
* shells return null for a manifest over MOBILE_WEB_BUNDLE_MAX_ASSETS rather than dropping the
* extra assets, so a route count that pushes the chunk envelope plus images plus the document past
* it would pass this build and fail on the device with nothing to read. At today's 42 images that
* is 29 routes, inside what Phase C adds, which is why this is a build failure and not a comment.
* is 28 routes, inside what Phase C adds, which is why this is a build failure and not a comment.
* The envelope grants the worst swept route to each one past the sweep, so re-measuring a tree
* whose routes share more moves that crossing out again.
*/