Repository navigation
perf(renderer): take the English catalog and the xterm WebGL addon off the boot graph - #18326
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe changes add generation and verification for a pruned English runtime localization catalog. Renderer boot-graph checks detect eagerly loaded WebGL and full-English payloads after successful builds. The WebGL addon now loads dynamically after renderer boot and supports queued pane attachment. Plugin ID and panel tab-key validation moves into shared modules. Tests, CI scripts, documentation, and package commands are updated accordingly. Merge Risk: ⚪ Minimal · up to This change reduces renderer startup payloads while preserving terminal WebGL attachment, recovery, and fitting behavior. No concrete current-head merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed explanations of the change, rationale, measurements, risks, and testing. However, it omits required template information, including a linked issue with Resolution Add a linked issue using
✨ 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 |
… data off the boot graph The renderer's boot graph — the entry chunk plus its 331 modulepreload links, all fetched and evaluated before first paint — carried three payloads nothing needs at that moment. `en.json` (644 KB) was an eager i18next resource, but every renderer string goes through `translate(key, fallback)` and `en` resolves that inline default, so most of the catalog was dead weight. The renderer now bundles a generated `en-runtime-required.json` holding only the 2,583 of 13,828 entries a default cannot reproduce: plural-suffixed keys, keys whose catalog value differs from a call site's default, and keys no call site references with a literal default. `en.json` stays the translator source and the input to the four lazy catalogs. `@xterm/addon-webgl` (243.6 KB) and `emojibase-data` (170 KB) are now primed right after the React root renders instead of statically imported. The load stays eager and `attachWebgl` stays synchronous — it reads the resolved constructor — so no terminal ever falls back to the DOM renderer for a frame. `isPluginPanelTabKey`/`isQualifiedPluginKey` move to schema-free sibling modules, re-exported from `plugin-manifest.ts`. This evicts the plugin manifest schema graph from the boot chunk but measures ~0 KB, because six other shared modules still put zod on the boot path. Boot graph: 332 chunks / 5107.2 KB -> 336 chunks / 4161.5 KB (-945.7 KB, -18.5%). A new ratchet parses the built index.html and fails if `en.json`, `@xterm/addon-webgl` or `emojibase-data` is preloaded again; it runs at the end of every `build:electron-vite`.
… data in tests CI builds the merge of a PR with main, so a byte-for-byte comparison against a committed generated file fails the moment any unrelated PR adds a translate() call — which is what happened here. The check now asserts the property that actually matters instead of byte equality: every runtime-required entry is shipped, and nothing shipped disagrees with en.json. Entries that stopped being required are dead weight, never a wrong string, so they are reported and tolerated. Failures now name the offending keys rather than saying "stale". The generator itself was already deterministic (plain code-unit sort, no locale collation, order-independent set construction); a test now pins that a reversed call-site walk produces byte-identical output. Test fixes for the catalog prune and the deferred emoji load: - browser-search / NativeChatSupportedAgents asserted key presence on the renderer's runtime resource. The durable contract is en.json — the renderer deliberately no longer bundles entries a call site default reproduces — so they assert against the translator catalog. - Four emoji tests typed a shortcode in the same tick as mount, before the catalog the hook primes on mount resolves. Not reachable by a human; the tests now await the prime.
4978974 to
f5387d2
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — two robustness suggestions on the boot-graph ratchet inline.
Reviewed changes
This PR takes three payloads off the renderer boot graph and adds a ratchet to keep them off. The work is thorough and well-tested: a real en.json → pruned-catalog transform re-renders every English entry through live i18next instances, the WebGL addon is deferred through a queued-pane continuation, and the emoji data is deferred behind a type-only module boundary with a lazy self-prime.
- Runtime-required English catalog —
en.jsonis pruned toen-runtime-required.json(2,583 of 13,828 entries) by a new generator, checked byverify:localization-runtime-catalogin lint and PR CI, and wired intoi18n.ts; the prune rule (plural suffixes, drifted values, dynamic keys/defaults all kept) is conservative and backed by a strong runtime equivalence test. - xterm WebGL addon deferral —
pane-webgl-renderer.tsswitches to a type-only import and aprimeTerminalWebglAddon()handle; panes that open mid-load are queued and attached on resolution, withdisposeWebglcleaning the queue. - Emoji catalog deferral —
emoji-shortcode-catalog-loader.tslazy-imports the shared catalog behind a type-only boundary and self-primes;workspace-emoji-shortcodes.tsrefuses to memoize an empty index. - zod off the boot path — pure string predicates move to
plugin-id-format.ts/plugin-tab-key.ts, re-exported fromplugin-manifest.tsso importers are unchanged. - Boot-graph ratchet —
renderer-boot-graph.mjsparses the builtindex.htmlmodulepreload graph and asserts none of the three payloads is present, run unconditionally at the end ofbuild:electron-vite.
ℹ️ Nitpicks
- The
@xterm/addon-webglandemojibase-datasignatures are hardcoded string literals (WebGL2 not supported,zany_face), so a dependency bump that changes either string would silently stop the guard from detecting a regression. This is acknowledged in the code comment and low-priority, but worth a periodic manual re-check or deriving them the same way the English probe is derived.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| console.log( | ||
| `Renderer boot graph: ${chunks.length} chunks, ${(totalBytes / 1024).toFixed(1)} KB minified.` | ||
| ) | ||
| if (violations.length === 0) { |
There was a problem hiding this comment.
The gate fails open when readRendererBootGraph matches no chunks. verifyRendererBootGraph (and the build-time invocation in run-electron-vite-build.mjs) returns 0 whenever violations is empty — which is also the result when chunks is empty. If electron-vite/rolldown ever emits the src/href attributes before type/rel, or changes the <link rel="modulepreload"> shape, both regexes match nothing and the ratchet passes silently with 0 chunks. The only thing that catches an empty graph is the runIf(built) test's chunks.length > 10 assertion, which is not part of the build-time gate. Failing closed (e.g. throw when chunks.length === 0) would make the guard trustworthy against HTML format drift.
Technical details
# Boot-graph ratchet fails open on an empty parse
## Affected sites
- config/scripts/renderer-boot-graph.mjs:14 — script regex assumes `type="module"` precedes `src`
- config/scripts/renderer-boot-graph.mjs:17 — link regex assumes `rel="modulepreload"` precedes `href`
- config/scripts/renderer-boot-graph.mjs:106 — returns 0 on zero violations (incl. zero chunks)
- config/scripts/run-electron-vite-build.mjs:41 — build gate exits 0 on that same path
## Required outcome
- `verifyRendererBootGraph` returns non-zero when the boot graph parses to zero chunks, so the CI build step cannot pass vacuously.
## Suggested approach
- In `verifyRendererBootGraph`, after `readRendererBootGraph`, throw or `return 1` if `chunks.length === 0`.| for (const chunk of chunks) { | ||
| const code = fs.readFileSync(chunk.file, 'utf8') | ||
| for (const payload of payloads) { | ||
| if (code.includes(payload.signature)) { |
There was a problem hiding this comment.
The English probe compares the chunk text against the decoded value from prunedAwayEnglishSignature, but in the bundle the catalog value is stored JSON-escaped. The current longest pruned value is a CSS blob with no quotes/backslashes/newlines/non-ASCII, so code.includes(signature) matches today — but if copy changes ever make the longest pruned value contain a ", backslash, or newline, the decoded string will no longer appear verbatim in the chunk and the en.json probe will silently stop detecting. Probing the escaped form (e.g. JSON.stringify(signature).slice(1, -1)) or asserting the value has no escapable characters would close the gap.
Technical details
# English probe breaks if the pruned value needs JSON escaping
## Affected sites
- config/scripts/renderer-boot-graph.mjs:53 — `prunedAwayEnglishSignature` returns the decoded value
- config/scripts/renderer-boot-graph.mjs:91 — `code.includes(payload.signature)` matches raw, not escaped
## Required outcome
- The en.json probe continues to match (or fails loudly) when the longest pruned value contains characters that bundling escapes.
## Suggested approach
- Match `code.includes(JSON.stringify(signature).slice(1, -1))` against the chunk, or throw in `prunedAwayEnglishSignature` when the value contains escapable characters.Deferring emojibase-data introduced a window that did not exist before: until the dynamic import settled, getPrimedEmojiShortcodeEntries returned [], so exactShortcodeIndex built an empty map and replaceCompletedWorkspaceEmojiShortcode returned null — leaving a typed `:wink:` in the field literally, and persisting it as the workspace display name. Pre-change the shared catalog was statically imported, so the first call at any tick returned full data. The window is reachable by anything that dispatches input in the same task as the field's mount effect — Playwright/CDP in the e2e suite and agent automation both do, and the WorktreeMetaDialog test failure was exactly that, producing 'Feature :wink:' instead of 'Feature 😉'. Nothing that resolves a shortcode can be async without that race, and a wrong persisted name is not an acceptable trade for 166.7 KB, so the deferral is reverted rather than papered over in the tests. The boot-graph ratchet drops its emojibase-data probe and records why. Boot graph: 5108.9 KB -> 4329.9 KB (-779.0 KB, -15.2%), down from -945.7 KB.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 39164063-74e8-4ae1-874c-03bf18b843f0
📒 Files selected for processing (31)
.gitattributes.github/workflows/pr.ymlconfig/localization-audit.mdconfig/scripts/generate-runtime-required-english-catalog.mjsconfig/scripts/generate-runtime-required-english-catalog.test.mjsconfig/scripts/localization-package-contract.test.mjsconfig/scripts/renderer-boot-graph.mjsconfig/scripts/renderer-boot-graph.test.mjsconfig/scripts/run-electron-vite-build.mjsconfig/scripts/verify-localization-catalog.mjsconfig/scripts/verify-renderer-boot-graph.mjspackage.jsonsrc/main/runtime/decorative-title-fact-emission.test.tssrc/renderer/src/components/UpdateCard.tsxsrc/renderer/src/components/settings/NativeChatSupportedAgents.test.tsxsrc/renderer/src/components/settings/browser-search.test.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/i18n.tssrc/renderer/src/i18n/runtime-required-catalog.test.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-reveal-repaint.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-context-recovery.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-renderer.test.tssrc/renderer/src/lib/pane-manager/pane-webgl-renderer.tssrc/renderer/src/main.tsxsrc/renderer/src/store/right-sidebar-route.tssrc/renderer/src/web/main.tsxsrc/shared/plugins/plugin-id-format.tssrc/shared/plugins/plugin-manifest-fields.tssrc/shared/plugins/plugin-manifest.tssrc/shared/plugins/plugin-tab-key.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
ℹ️ The new commit is clean; the two minor suggestions from the prior review remain open and block an approval.
Reviewed changes (since prior pullfrog review at 4978974)
This commit makes three targeted fixes, all correct:
- Merge-robust runtime-catalog gate —
generate-runtime-required-english-catalog.mjsnow checks a property (every required entry shipped, nothing shipped contradictsen.json) instead of byte equality.collectRuntimeRequiredCatalogProblemscleanly separatesmissing/contradicting(fail) fromsuperfluous(tolerated, dead weight). The reasoning holds: a key only leaves the required set when every call site spells the identical string, so a superfluous entry's shipped value is always inert — it equals bothen.jsonand every default. The new tests pin order-independence (toReversedwalk is byte-identical, code-unit sort) and the three-way classification. - Emoji priming in unit tests —
workspace-emoji-shortcodes.test.ts,SmartWorkspaceNameField.ime-enter.test.tsx, andWorktreeMetaDialog.test.tsxnowawait primeEmojiShortcodeCatalog()inbeforeAll, matching the lazy-load boundary the PR introduced. - i18n assertions moved to the source catalog —
NativeChatSupportedAgents.test.tsxandbrowser-search.test.tsassert againsten.jsonrather thani18n.getResource('en', …)/i18n.exists, since the runtime English bundle is now pruned.
The regenerated en-runtime-required.json delta (+QuickLaunchButton.ec2adf093e) is consistent: that call site's fallback is a conditional expression, so it is a dynamic default and correctly required.
I confirmed the two remaining product call sites of the bundle APIs are unaffected: rich-markdown-code-block-languages.ts uses getResourceBundle only as a cache-invalidation sentinel (labels still resolve via translate(key, label)), and the hasResourceBundle hooks check bundle presence, not pruned keys.
The two open threads from the prior review (config/scripts/renderer-boot-graph.mjs — fail-open on an empty parse, and the JSON-escaping fragility of the derived English probe) are unaffected by this commit and remain worth addressing; neither is blocking, so I am leaving them as minor suggestions rather than repeating them here.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ The emoji revert is clean and well-reasoned — no issues in the delta.
Reviewed changes (since prior pullfrog review at f5387d)
- Emoji deferral reverted —
emoji-shortcode-catalog-loader.tsis deleted andworkspace-emoji-shortcodes.tsreturns to the staticgetStandardEmojiShortcodeEntries()import;exactShortcodeIndexis back to its??=form.useWorkspaceEmojiShortcodeInput.ts,main.tsx, and the five touched test files drop theirprimeEmojiShortcodeCatalog()calls. - Boot-graph ratchet updated — the
emojibase-dataprobe is removed frombootGraphForbiddenPayloadsand the reason is recorded inline.
This is the correct call. The deferral introduced a real race: getPrimedEmojiShortcodeEntries returned [] until the dynamic import settled, so exactShortcodeIndex built an empty map and replaceCompletedWorkspaceEmojiShortcode returned null — a typed :wink: persisted literally as the workspace display name. As the commit message argues, anything that dispatches input in the same task as a field's mount effect (Playwright/CDP, orca-cli agent automation) hits the window, and no async shortcode resolver avoids it. The revert restores the prior synchronous guarantee; the 166.7 KB is a defensible trade for not persisting a wrong name. The reverted boot graph (-779 KB / -15.2%) is honestly remeasured.
The one residual artifact: src/main/runtime/decorative-title-fact-emission.test.ts and src/renderer/src/components/UpdateCard.tsx carry unrelated formatting-only changes (a call wrapped across lines, a boolean condition re-joined). They are inert, but they are scope drift from this PR and worth dropping so the revert stays purely about the emoji catalog.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…it on late attach Two defects the deferral introduced, neither possible with a static import. A failed load latched the DOM renderer for the whole session. `.then(onOk, onError)` settles fulfilled, so the memoized promise was cached forever with a null constructor: attachWebgl's re-prime got the cached promise back, and resetTerminalWebglSuggestion — the documented "GPU setting changed, retry" path — could not clear it either. The rejection path now clears the memo, latches the queued panes the way a failed construction does so they retry at a recovery boundary rather than every frame, and caps attempts so a genuinely missing chunk is not re-fetched forever. The recovery boundary re-arms it. The queued-attach drain skipped the refit. Every other late-attach path pairs attach with a refit because the grid was measured under DOM cell metrics and WebGL floors the device cell width. Post-deferral, openTerminal's attachWebgl queued and returned, the initial fit rAF then measured DOM metrics and sized the PTY from them, and the addon attached with no refit — a persistently narrow PTY and an unpainted right gutter, not a one-frame flicker. Both paths now go through one attachWebglAndRefit pairing so they cannot diverge again. Regression tests cover both, and each was verified to fail without its fix. The addon-load state machine moves to terminal-webgl-addon-loader.ts and the viewport presentation helpers to pane-viewport-present.ts, keeping pane-webgl-renderer.ts under the 300-line budget without a suppression.
There was a problem hiding this comment.
ℹ️ The deferred WebGL addon loader refactor is clean and well-tested — no new issues in the delta. The two open threads from the initial review (
renderer-boot-graph.mjsfail-open parse and the English-probe JSON-escaping) are untouched by this commit and remain open, non-blocking.
Reviewed changes (since prior pullfrog review at 4d754c5)
- WebGL addon load made recoverable —
primeTerminalWebglAddonmoved toterminal-webgl-addon-loader.ts; a failedimportnow clears the memoized promise and caps retries at 3, so the GPU-setting recovery boundary re-arms the load instead of caching a null constructor for the whole session. - Queued panes attach with a refit — the
onLoadedcontinuation pairsattachWebglwith a next-framesafeFitthroughattachWebglAndRefit, fixing the narrow-PTY/right-gutter defect a bare attach left on panes that opened mid-load. - Viewport-present helpers extracted —
presentPaneViewport*and its retry loop moved topane-viewport-present.ts(pure move, re-exported so no importer changed). - Two regression tests — the unprimed late-attach refit and the failed-load retry, each verified to fail with its fix reverted.
ℹ️ Nitpicks
terminal-webgl-addon-loader.tscaps the load at 3 attempts so a genuinely missing chunk is not re-fetched forever, but no test asserts that a fourthprimeTerminalWebglAddon()is a no-op after three failures — the cap is load-bearing and currently only documented, not pinned.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…f the boot graph (stablyai#18326) * perf(renderer): take the English catalog, xterm WebGL addon and emoji data off the boot graph The renderer's boot graph — the entry chunk plus its 331 modulepreload links, all fetched and evaluated before first paint — carried three payloads nothing needs at that moment. `en.json` (644 KB) was an eager i18next resource, but every renderer string goes through `translate(key, fallback)` and `en` resolves that inline default, so most of the catalog was dead weight. The renderer now bundles a generated `en-runtime-required.json` holding only the 2,583 of 13,828 entries a default cannot reproduce: plural-suffixed keys, keys whose catalog value differs from a call site's default, and keys no call site references with a literal default. `en.json` stays the translator source and the input to the four lazy catalogs. `@xterm/addon-webgl` (243.6 KB) and `emojibase-data` (170 KB) are now primed right after the React root renders instead of statically imported. The load stays eager and `attachWebgl` stays synchronous — it reads the resolved constructor — so no terminal ever falls back to the DOM renderer for a frame. `isPluginPanelTabKey`/`isQualifiedPluginKey` move to schema-free sibling modules, re-exported from `plugin-manifest.ts`. This evicts the plugin manifest schema graph from the boot chunk but measures ~0 KB, because six other shared modules still put zod on the boot path. Boot graph: 332 chunks / 5107.2 KB -> 336 chunks / 4161.5 KB (-945.7 KB, -18.5%). A new ratchet parses the built index.html and fails if `en.json`, `@xterm/addon-webgl` or `emojibase-data` is preloaded again; it runs at the end of every `build:electron-vite`. * chore(i18n): pin the generated English subset to LF and mark it generated * fix(i18n): make the runtime-catalog gate merge-robust and prime emoji data in tests CI builds the merge of a PR with main, so a byte-for-byte comparison against a committed generated file fails the moment any unrelated PR adds a translate() call — which is what happened here. The check now asserts the property that actually matters instead of byte equality: every runtime-required entry is shipped, and nothing shipped disagrees with en.json. Entries that stopped being required are dead weight, never a wrong string, so they are reported and tolerated. Failures now name the offending keys rather than saying "stale". The generator itself was already deterministic (plain code-unit sort, no locale collation, order-independent set construction); a test now pins that a reversed call-site walk produces byte-identical output. Test fixes for the catalog prune and the deferred emoji load: - browser-search / NativeChatSupportedAgents asserted key presence on the renderer's runtime resource. The durable contract is en.json — the renderer deliberately no longer bundles entries a call site default reproduces — so they assert against the translator catalog. - Four emoji tests typed a shortcode in the same tick as mount, before the catalog the hook primes on mount resolves. Not reachable by a human; the tests now await the prime. * revert(renderer): keep the emoji shortcode catalog statically imported Deferring emojibase-data introduced a window that did not exist before: until the dynamic import settled, getPrimedEmojiShortcodeEntries returned [], so exactShortcodeIndex built an empty map and replaceCompletedWorkspaceEmojiShortcode returned null — leaving a typed `:wink:` in the field literally, and persisting it as the workspace display name. Pre-change the shared catalog was statically imported, so the first call at any tick returned full data. The window is reachable by anything that dispatches input in the same task as the field's mount effect — Playwright/CDP in the e2e suite and agent automation both do, and the WorktreeMetaDialog test failure was exactly that, producing 'Feature :wink:' instead of 'Feature 😉'. Nothing that resolves a shortcode can be async without that race, and a wrong persisted name is not an acceptable trade for 166.7 KB, so the deferral is reverted rather than papered over in the tests. The boot-graph ratchet drops its emojibase-data probe and records why. Boot graph: 5108.9 KB -> 4329.9 KB (-779.0 KB, -15.2%), down from -945.7 KB. * fix(terminal): make the deferred WebGL addon load recoverable and refit on late attach Two defects the deferral introduced, neither possible with a static import. A failed load latched the DOM renderer for the whole session. `.then(onOk, onError)` settles fulfilled, so the memoized promise was cached forever with a null constructor: attachWebgl's re-prime got the cached promise back, and resetTerminalWebglSuggestion — the documented "GPU setting changed, retry" path — could not clear it either. The rejection path now clears the memo, latches the queued panes the way a failed construction does so they retry at a recovery boundary rather than every frame, and caps attempts so a genuinely missing chunk is not re-fetched forever. The recovery boundary re-arms it. The queued-attach drain skipped the refit. Every other late-attach path pairs attach with a refit because the grid was measured under DOM cell metrics and WebGL floors the device cell width. Post-deferral, openTerminal's attachWebgl queued and returned, the initial fit rAF then measured DOM metrics and sized the PTY from them, and the addon attached with no refit — a persistently narrow PTY and an unpainted right gutter, not a one-frame flicker. Both paths now go through one attachWebglAndRefit pairing so they cannot diverge again. Regression tests cover both, and each was verified to fail without its fix. The addon-load state machine moves to terminal-webgl-addon-loader.ts and the viewport presentation helpers to pane-viewport-present.ts, keeping pane-webgl-renderer.ts under the 300-line budget without a suppression.

ELI5
Every time Orca's window opens, the browser has to download and run a pile of
JavaScript before it can draw anything. Three big things were in that pile that
nobody needs at that moment: the full English dictionary (which the app never
actually reads) and the terminal's GPU renderer (only needed once a terminal
opens). They now load a moment after the window paints, still eagerly, so
nothing arrives later than it used to from your point of view — the startup
pile just got 779 KB (15.2%) smaller.
A third candidate, the emoji-name database, was tried and reverted: see
Negative user-facing trade-offs.
What was happening
out/renderer/index.htmllists the entry chunk plus 331<link rel="modulepreload">chunks. Every one of them is fetched and evaluatedbefore first paint. Four payloads inside that graph were pure startup tax:
en.json(644 KB) was bundled as an eager i18next resource. But everyrenderer string goes through
translate(key, fallback)— 12,868occurrences in non-test renderer source, zero single-argument
translate(key)call sites, and the only.t(call sites are insidei18n.ts/main-i18n.ts/ tests. Foren, i18next resolves the sameEnglish text from that inline
defaultValue, so most of the catalog was deadweight.
src/main/i18n/main-i18n.tsalready shipsresources: { en: { translation: {} } }for exactly this reason.@xterm/addon-webgl(243.6 KB) was a static import inpane-webgl-renderer.ts, but only ever constructed insideattachWebgl.Nine boot-path modules import that file for
ENABLE_WEBGL_RENDERER/disposeWebgl/presentPaneViewport…, dragging the addon along.right-sidebar-route.tsimported an 8-line string predicate(
isPluginPanelTabKey) fromplugin-manifest.ts, whose first line isimport { z } from 'zod'.What shipped
A generated runtime-required English catalog.
en.jsonstays thetranslator source and the input to the four lazy target catalogs; the
renderer now bundles
src/renderer/src/i18n/en-runtime-required.json, whichholds only the entries i18next cannot rebuild from a
defaultValue.The prune rule is deliberately wider than "plural keys only", because a
plural-only prune would have silently changed 60 strings:
_one/_other/…) — never derived from a defaultGenerated by
config/scripts/generate-runtime-required-english-catalog.mjs(reusing the existing TypeScript-AST reference collector in
verify-localization-catalog.mjs), checked bypnpm run verify:localization-runtime-cataloginpnpm lintand PR CI, andregenerated with
pnpm run sync:localization-runtime-catalog.The gate checks a property, not byte equality: every runtime-required entry
is shipped, and nothing shipped disagrees with en.json. An entry that stopped
being required is dead weight, never a wrong string, so it is reported and
tolerated — otherwise every unrelated PR that adds a
translate()call wouldinvalidate this file on every other open branch (CI builds the merge commit,
which is exactly how the first push of this PR went red). Failures name the
offending keys. The generator is order- and locale-independent (plain
code-unit sort, set-based construction); a test pins that a reversed
call-site walk produces byte-identical output.
primeTerminalWebglAddon()— a module-scoped handle fired bymain.tsxright after the React root renders.
attachWebglstays synchronous and readsthe resolved constructor. The load is still eager, just off the critical path.
plugin-tab-key.ts/plugin-id-format.ts— the pure string predicatesmoved out of the zod-importing modules and are re-exported from
plugin-manifest.ts, so no importer changes.Measurement
Real
pnpm run build:electron-viteon this machine, before (origin/main,946627f2ced) and after, measured fromout/renderer/index.html's entry scriptplus its modulepreload list. Both builds are on the same base.
Per targeted chunk (minified KB):
i18n-*.js(644 KB of it wasen.json)terminal-appearance-*.js(+ the two chunks it split into)useWorkspaceEmojiShortcodeInput-*.js(emojibase-data; deferral reverted)plugin-manifest-*.js(+ the two chunks it split into)store-*.jsApp-*.jsclient-*.jsThe plugin/zod fix measured zero. Moving
isPluginPanelTabKeyoffplugin-manifest.tsdid evict the manifest schema graph (that chunk went124.9 → 5.4 KB), but zod itself stays on the boot path through six other
importers —
shared/browser-client-page-renderer-protocol.ts,shared/runtime-environments.ts,shared/closed-terminal-tab-tombstones.ts,shared/codex-reset-credit-attempt-ledger.ts(viashared/constants.ts) andstore/slices/runtime-status.ts— so the 89.1 KB simply re-chunked. The changeis kept as the structural prerequisite for removing it, not as a win, and the
boot-graph guard does not ratchet zod, because there is nothing to ratchet
yet.
First paint: not measured. I could not get a repeatable first-paint number
on this machine, so I am not reporting one. The claim here is bytes fetched and
evaluated before first paint, which is measured directly from the build output.
Negative user-facing trade-offs
None found. Specifically:
No string changes. The prune rule keeps every entry whose absence could
change a rendered string, including all 60 keys where the catalog has drifted
from the inline default and all 2,485 keys with no statically-known default.
runtime-required-catalog.test.tsre-renders everyen.jsonentrythrough two live i18next instances (full catalog vs. pruned) and asserts
identical output, plus every plural base key across counts 0/1/2/5/11/100.
Deferring
@xterm/addon-webglhas one residual window, now bounded andself-correcting.
attachWebglis still synchronous, so a terminal openingafter the load resolved attaches WebGL exactly as before, before its first
paint. A terminal opening between the prime and its resolution is queued and
attached the instant the module lands.
A readiness review found two defects in the first version of that, both now
fixed and both regression-tested (each verified to fail without its fix):
.then(onOk, onError)settles fulfilled, so the memoized promise was cachedwith a null constructor, and even
resetTerminalWebglSuggestion()— thedocumented GPU-setting recovery — could not clear it. The rejection path now
clears the memo, latches queued panes so they retry at a recovery boundary
rather than every frame, and caps attempts so a genuinely missing chunk is
not re-fetched forever.
performs. Because
openTerminal'sattachWebglqueued and returned, theinitial fit measured DOM cell metrics and sized the PTY from them, and
the addon then attached without re-measuring — a persistently narrow PTY and
an unpainted right gutter, not a one-frame flicker. Both paths now share one
attachWebglAndRefitpairing so they cannot diverge again.With those fixed the worst case is a queued pane rendering on xterm's DOM
renderer for the frames between its
openTerminaland the import landing,after which it attaches and re-fits. If the chunk cannot be loaded at all,
panes stay on the DOM renderer — the same outcome this file already handles
for a WebGL context failure — and recover at the next GPU-setting change.
Deferring
emojibase-data(166.7 KB) was tried and reverted. It is theone sub-fix that could not meet the bar, so it is not in this PR. Until the
dynamic import settled,
getPrimedEmojiShortcodeEntriesreturned[], soexactShortcodeIndexbuilt an empty map andreplaceCompletedWorkspaceEmojiShortcodereturnednull(
workspace-emoji-shortcodes.ts:21-32,:112-115) — a typed:wink:stayedliteral and was persisted as the workspace display name. Before the
change the shared catalog was statically imported, so the first call at any
tick had full data; the window was new. "No human types that fast" is the
wrong test for this app: Playwright/CDP in Orca's own e2e suite and agent
automation through
orca-cliboth dispatch input in the same task as afield's mount effect, and the
WorktreeMetaDialogtest failure was exactlythat, yielding
'Feature :wink:'. Nothing that resolves a shortcode can beasync without the race, so the data stays statically imported and the ratchet
records why. (The main process was never affected — it keeps its own
synchronous import for worktree slugs.)
i18n.exists()/i18n.getResource('en', …)now return nothing for prunedkeys. No product code calls either — the only callers were two tests, which
now assert against
en.json, the translator catalog that actually carries thecontract. Rendered strings are unaffected, which is what the full-vs-pruned
test proves.
Risk & verification
pnpm tcclean;pnpm run check:code-quality:changedclean;oxlintclean;max-lines / reliability-gates / runtime-electron ratchets clean.
verify:localization-catalog,verify:localization-runtime-catalog,verify:localization-extractionandverify:localization-coverageall pass.(
lib,i18n,components/{workspace-emoji,sidebar,new-workspace,settings},shared,config/scripts, the main-process worktree slug path). Thewhole-repo run is left to CI's 8 shards.
config/scripts/renderer-boot-graph.mjsparsesthe built
index.htmlmodulepreload list and asserts neitheren.jsonnor@xterm/addon-webglappears in it. It runsunconditionally at the end of
build:electron-vite(so CI cannot skip it),is also exposed as
pnpm run verify:renderer-boot-graph, and is covered byrenderer-boot-graph.test.mjs. Run against a realorigin/mainbuild itreports both:
so it keeps working as copy changes.
primeTerminalWebglAddon()inbeforeEach(4 files) — cold-module setup, since production primes once atboot. That is not the argument for the two new deferred-load tests: those
drive the unprimed and failed-load paths deliberately, and each was checked to
fail with its fix reverted.
terminal-webgl-addon-loader.tsandthe viewport-present helpers in
pane-viewport-present.ts, keepingpane-webgl-renderer.tsinside the 300-line budget without a suppression.Both are re-exported, so no importer changed.
surface is touched. The main process is untouched apart from nothing — its
emoji path still statically imports
emojibase-dataand stays synchronous.