Repository navigation
perf(octane): share one production formatter across published zero-argument errors - #1856
Merged
Merged
Conversation
…gument errors The publish-time error specialization inlined a private __octaneNoArgError helper, carrying the full "Minified Octane error" text, into each of the 29 modules it rewrote. A consumer bundle carried one copy per such module, and a code-split application one in every chunk that included any of them. Rewritten modules now import formatNoArgumentErrorMessage from the new import-free src/error-message-no-arguments.ts. Messages, the call-time NODE_ENV read and #1362's binding-only contract (no generic formatter, no argument encoder) are unchanged. error-message.ts is untouched, so source-built bundles are byte-identical. Published dist, hydrating signals app: 9 copies -> 2 (-1,357 raw); split into 19 chunks: 22 copies in 10 chunks -> 2 in one (-3,662 raw, -1,105 gzip). Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 7, 2026 19:30
Merged
5 of 6 tasks
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 570eca0 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 07:33 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 570eca0 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 07:35 PM |
Contributor
Benchmark report🟢 No budget breaches, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 60 measured values. Public-import reachability bundles (bytes)No changes across 108 measured values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/specialize-error-calls.mjs, perf: specialize zero-argument errors #1362) inlined a private__octaneNoArgErrorhelper, with the full "Minified Octane error … or use a development build …" text, into every module it rewrote. Twenty-nine published modules carried their own copy.formatNoArgumentErrorMessagefrom a new import-freesrc/error-message-no-arguments.ts. A consumer bundle holds the zero-argument text once, and a split application holds it in one shared chunk.error-message.js) and its argument encoder. Development messages, production messages and the call-timeNODE_ENVread are byte-identical.Why
A production signals + hydration app audit found the formatter inlined in about 10 chunks. The duplication exists only in the published
dist/. The in-repo size harness builds from source, so it never saw it.Merging this text with the generic formatter's would leave one copy instead of two, but neither way of doing it fits:
formatProdErrorMessageinto two functions costs about 40 B raw in every source-built bundle, which breaches every budget.Measured against the published
dist/Built with
build-runtime.mjson main 7e6bda5 and on this head. Both are measured with the same production Vite (Oxc) consumer builds. The fixture is thehydrate-framescenario from #1855.hydrate-frame, one bundleoctane/behavior,octane/signals,octane/hydration,octane/dom-bindingsandoctane/hydration/streamed-signals(19 chunks)published-errors.test.mjs)Bundle-size gate
The size harness builds the runtime from source, where this change only adds a module nothing imports. Both gates were run in CI mode, with
BUDGET_BASE=origin/mainand--budgets --ratchet, and both exit 0 with every bundle byte-identical to main. For example,hydrate-rootis 137,671 / 44,037 B,deferred-hydration230,935 / 72,354 B andbinding-radix-vite199,075 / 62,491 B (raw / gzip); the apps are rows 34,396, todo 37,297, chat 36,648, weather 42,873 and bindings 108,408 B framework gzip. No budget changes. The saving appears only in published builds, which the table above measures.Validation
pnpm error-codes:check: catalog check plus 16node --testcases, including a new nested-module case that resolves the import relative tosignals/. Every zero-argument client and server code still formats exactlyformatProdErrorMessage(code, [])in production.node packages/octane/scripts/build.mjs(dist, declarations,verifyDist,smokeDist,published-errors.test.mjs): 3/3 passed. CI runs the same throughpackages:pack:check→prepack.published-errors.test.mjsfails, because the compiled binding consumer carries 5 copies (actual: 5, expected: 1).pnpm typecheck:filesandpnpm format:files:checkon the changed files.pnpm test,pnpm typecheckandpnpm format:checkwere not run locally; CI runs them.Risk / follow-ups
./or../error-message-no-arguments.js).verifyDistchecks that every emitted relative import resolves, and the specializer derives the path from the module's location undersrc/.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Build-time publish transform only; error messages and NODE_ENV semantics are locked by existing and new tests, with only added relative imports in emitted modules.
Overview
Published zero-argument error modules no longer each inline ~190 bytes of the “Minified Octane error” production string. The publish specializer (
specialize-error-calls.mjs) now swaps the generic formatter import for a relative import of newformatNoArgumentErrorMessageinerror-message-no-arguments.ts, so consumers dedupe that text to one shared module (at most two copies in a bundle alongside the generic formatter for parameterized errors).Runtime behavior is unchanged: development vs production branching and message text still match
formatProdErrorMessage(code, []). Tests add a nested-module relative-import case and assert compiled binding bundles contain a single “Minified Octane error #” occurrence.Reviewed by Cursor Bugbot for commit 570eca0. Bugbot is set up for automated code reviews on this repo. Configure here.