Skip to content

build(signals): pin mangled _-prop names in a checked-in map - #4503

Merged
ryansolid merged 3 commits into
nextfrom
claude/project-thread-x1ore2-mangle-cache
Oct 30, 2026
Merged

ryansolid merged 3 commits into
nextfrom
claude/project-thread-x1ore2-mangle-cache

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Before: scripts/mangle-props.mjs started each build from an empty terser nameCache. Terser hands out short property names in first-seen order across the sorted file walk, so one added field renamed every field seen after it. Adding one field in core renamed 46 of 139 prod fields across 18 files, and one in boundaries.js renamed 58. Size scenarios that never include the changed file still moved brotli. With one new field in boundaries.js, the core floor moved +6 B, hello world +7 B, createStore −22 B and isPending/latest +13 B.

After: existing fields keep their names, and only a new field gets a new name, so scenarios that don't contain a change stay at exactly 0 B. Today's dist is byte-identical, and every size scenario is unchanged: hello world 9,973 B, core floor 7,413 B.

How:

  • packages/signals/scripts/mangle-props.json holds each tree's _field → name map (prod: 139 fields, observe: 168), generated from next @ 643a7a7.
  • The script seeds terser's nameCache from it. A new field takes terser's own fallback, the first base54 name the cache doesn't hold.
  • A pin whose _ token no longer appears in the unmangled tree is dropped, so its name is free again. Renaming _pendingValue to _stagedValue kept ue, and every scenario moved 0 B.
  • The build writes the map back only when it changes and prints a note to commit it, like a lockfile. Deleting a tree's entry re-packs every name from scratch; that should be a PR of its own.
  • turbo.json lists the map among the signals build outputs, so a cache hit restores it with dist.

What this doesn't fix: on scenarios that do contain the change, brotli still swings by up to about ±100 B for tiny inputs. With the same pinned build and the new field forced to It, Qq, Wx or zz (identical minified size), page base moved −53 to +74 B and router +7 to +105 B. That noise comes from brotli itself, not from the mangler.

Tests: signals 6080 passed / 17 expected fail. tests/dist-artifacts.test.ts passes 36/36 against pinned dists with a new field.


Generated by Claude Code

terser hands out short property names in first-seen order, so one added or
renamed field reshuffled names across the prod/observe trees and moved brotli
on unrelated size scenarios. scripts/mangle-props.json seeds the shared
nameCache per tree; existing fields keep their names, new fields take unused
names, removed fields drop out. Generated from next @ 643a7a7: dist is
byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
A cache hit restored dist but not a map the build wrote back, so the next
build re-derived names the cached dist did not use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
@changeset-bot

changeset-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ea36d94

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown

Size (brotli, eager entry chunk)

scenario head vs base minified vs base minified vs recorded cap lazy chunks (not counted)
signals: core floor (createSignal/Memo/Effect/Root/flush) 7.41 KB 0 B 0 B +15 B 7.43 KB ✅
signals: + createStore 14.96 KB 0 B 0 B +6 B 14.97 KB ✅
signals: + isPending/latest 11.27 KB 0 B 0 B 0 B 11.29 KB ✅
signals: + until/refresh (truth readers, no optimism) 8.05 KB 0 B 0 B +2 B 8.06 KB ✅
app: render + one signal (the simple-app floor) 9.79 KB 0 B 0 B +15 B 9.78 KB ⚠️ over by 8 B, 5 B minified headroom
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 18.72 KB 0 B 0 B 0 B 18.74 KB ✅ lazy-page.js 0.04 KB
app: hydrating + every store primitive family 32.47 KB 0 B 0 B 0 B 32.48 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 13.45 KB 0 B 0 B +9 B 13.47 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 15.19 KB 0 B 0 B +9 B 15.20 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 29.76 KB 0 B 0 B +9 B 29.78 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 9.97 KB 0 B 0 B +2 B 9.98 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 26.27 KB 0 B 0 B +13 B 26.33 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 32.48 KB 0 B 0 B +7 B 32.54 KB ✅ stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.75 KB 0 B 0 B 0 B 11.77 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.73 KB 0 B 0 B 0 B 33.77 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.10 KB, wire.js 3.47 KB
page: live server components (base + live/GET + action + isPending/latest) 38.97 KB 0 B 0 B 0 B 38.98 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, trace.js 9.11 KB, wire.js 3.47 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 35.66 KB 0 B 0 B 0 B 35.72 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.06 KB, sc-comments.js 0.20 KB, trace.js 9.06 KB, wire.js 3.47 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 42.93 KB 0 B 0 B 0 B 42.95 KB ✅ eager (counted): web.js 22.95 KB; assets.js 0.78 KB, decode.js 7.09 KB, regions.js 1.08 KB, sc-comments.js 0.19 KB, trace.js 9.09 KB, wire.js 3.47 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.13 KB 0 B 0 B 0 B 41.25 KB ✅ assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.06 KB, server.js 1.03 KB, serverForms.js 3.59 KB, trace.js 9.06 KB, wire.js 3.48 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 48.57 KB 0 B 0 B 0 B 48.58 KB ✅ eager (counted): client.js 28.07 KB; assets.js 0.78 KB, decode.js 7.09 KB, lazy-page.js 0.04 KB, regions.js 1.07 KB, server.js 1.03 KB, serverForms.js 3.30 KB, trace.js 9.06 KB, wire.js 3.49 KB
server: floor (getRequestEvent + isServer) 1.27 KB 0 B 0 B 0 B 1.29 KB ✅
server: renderToString (the server-render floor) 22.79 KB 0 B 0 B 0 B 22.80 KB ✅

⚠️ Over the brotli cap within the minified allowance (passes)

  • app: render + one signal (the simple-app floor): over brotli cap by 8 B; minified 26,754 B vs 26,739 B recorded with the cap (+15 B) — 5 B of the 20 B minified allowance left; +0 B minified over this PR's base

Bundled with Rolldown (what Vite ships), brotli q11, decimal KB. A scenario fails only when it is over its brotli cap and its minified size is more than 20 B over the minified recorded with the cap; over the cap within that allowance is brotli layout noise and passes with a warning. Caps and their recorded minified in scripts/size/scenarios.js; the floor and page caps in floor-caps.json are frozen (lower only, or Size-Exception: in the PR body). npm run ratchet lowers caps per RC; it never raises one (scripts/size/README.md).

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 41120509370

Coverage remained the same at 78.1%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1362
Covered Lines: 1125
Line Coverage: 82.6%
Relevant Branches: 1090
Covered Branches: 790
Branch Coverage: 72.48%
Branches in Coverage %: Yes
Coverage Strength: 29.95 hits per line

💛 - Coveralls

@ryansolid
ryansolid merged commit 4ae408f into next Oct 30, 2026
8 checks passed
@codspeed

codspeed Bot commented Oct 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 200 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing claude/project-thread-x1ore2-mangle-cache (ea36d94) with next (14a8190)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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.

3 participants