Skip to content

fix(ui): measure boot assets with the shipped gzip level selection - #200241

Closed
jalehman wants to merge 1 commit into
mainfrom
fix/control-ui-perf-compression-parity
Closed

jalehman wants to merge 1 commit into
mainfrom
fix/control-ui-perf-compression-parity

Conversation

@jalehman

@jalehman jalehman commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: the Control UI performance gate reports boot JS gzip growth that the shipped build does not have, because it recompresses hash-normalized boot assets at libdeflate level 12 only while the build ships the smallest of levels 10, 11 and 12.

User Impact

No user-visible change. Maintainers and contributors get a performance gate whose normalized boot gzip numbers follow the same compression policy as the shipped sidecars, so a change that shrinks shipped gzip no longer fails boot budgets because of compressor-level noise. Budgets, hash normalization, identity fallback, Brotli settings and code splitting are unchanged.

Why This Change Was Made

createControlUiPrecompressedAssetVariants (ui/vite.config.ts) picked the smallest gzip of levels 10/11/12 for boot assets and level 12 for deferred assets. measureControlUiBudgetAsset (ui/config/control-ui-asset-compression.ts) received compression.boot but always used level 12 when normalization changed the text, and the served sidecar size when it did not, so the measured policy depended on whether normalization touched the asset. Both paths now call one selector, gzipControlUiAsset(body, boot).

Observed on #200145 (4be2dde vs b307684, two identical paired Studio builds): shared boot JS raw +53 B, shipped gzip -384 B, normalized budget gzip +729 B, with identical chunk and module inventories. #200145 depends on this PR.

Evidence

  • Fail-first parity test (ui/src/app/vite-precompression.node.test.ts): measures a hash-normalized fixture where level 10 beats level 12 and asserts boot, deferred and ineligible (identity) measurements equal what the build ships. On main sources it fails with expected 5460 to be 5432 (level-12 measurement vs shipped boot sidecar); with this change it passes. Reproduced locally and in the container below.
  • Local (rebased onto main 48cd549b1c48653061ec312e35fef62d13df62cf): pnpm test ui/src/app/vite-precompression.node.test.ts ui/src/app/vite-config.node.test.ts test/scripts/control-ui-performance.test.ts → 102 tests passed; with main's ui/config/control-ui-asset-compression.ts and ui/vite.config.ts the parity test fails again (expected 5460 to be 5432).
  • Crabbox container proof, current head (Mac Studio, provider local-container, image node:24.22.1-trixie runtime_image_id sha256:f1e034976f948cf212ef1f659c12e5dd58ac7eab947831813e81a62401ca38be, Node v24.22.1, 8 CPU / 24 GiB, --no-hydrate): lease cbx_f3fafd504399 (run_bc538d6712fc108889e25da14415f77d), HEAD 9d34a02905360ee3e104b6c2b18a49009d3d4209, command corepack pnpm install --frozen-lockfile --store-dir .pnpm-store; corepack pnpm test ui/src/app/vite-precompression.node.test.ts; corepack pnpm ui:check-performance:base 48cd549b1c48653061ec312e35fef62d13df62cf → parity test 2/2 passed, gate exit 0, total 3m34s, lease stopped. Chat boot JS 1,323,907 → 1,323,751 B (−156; limit 1,324,691), new-page boot 815,710 → 815,554 B (−156; limit 816,160), largest JS 558.5 KiB (limit 559.0), startup JS and CSS unchanged.
  • Earlier proof, previous head 7b9674ac (same image and recipe): lease cbx_2cc06ff303e6 showed the parity test passing on the branch and failing with main's sources, and ui:check-performance:base 9e66164c exit 0. Lease cbx_10eff13acc0d ran feat(openclaw-id): members can recover access with a recovery kit #200145's 3e7e9f0 plus this fix (scratch branch scratch/ocf-552-perf-parity-3e7e9f0, HEAD bc2aad92): ui:check-performance:base b307684 → exit 0. That pair previously failed (+729 B normalized; over the largest-JS, chat and new-page caps by 205, 234 and 142 B). With the fix: chat boot JS 1,312,699 → 1,313,109 B (+410; limit 1,313,246), new-page boot 815,218 → 815,628 B (+410; limit 815,806), largest JS 558.6 KiB (limit 558.7).
Review notes

Independent review found no P0–P2 issue in this diff. It noted a pre-existing, separate gap: the gate derives boot assets from index.html only, while the build also treats login-only chunks (routes.login, deliberately absent from the HTML) as boot for compression. Those chunks are not part of the chat/new boot totals; aligning that classification needs the gate to learn the login route set and is left as a follow-up rather than widened into this fix.

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares gzip level selection between Control UI sidecar generation and normalized performance measurements.

Example: Measure the normalized boot JavaScript fixture where gzip level 10 beats level 12.

  • Before: The budget reports 5,460 bytes while the build's selected encoding is 5,432 bytes.
  • After: Both paths select the 5,432-byte encoding.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with a meaningful regression and production performance evidence; broader CI disposition remains unresolved.
Proof confidence 🐚 platinum hermit (4/6) This is a tooling measurement correction with unchanged shipped assets; the body supplies fail-first parity results and production performance-command output, and exact-head performance CI passes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Contributors can receive false boot-gzip budget failures because measurement uses a different compression policy from the build.
Reason: The source-confirmed mismatch has a concrete downstream failure, and the maintainer-authored direction preserves existing output and budget policy.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main compression-policy mismatch without changing shipped asset selection; no actionable patch defect was found, while broader CI failures remain unattributed.

Priority: P2
Reviewed head: 7b9674ac00b6b8e3ce91adfbd1776d6e04975d99

Before merge

None.

Findings

None.

Agent review details

How this fits together

Vite generates compressed Control UI sidecars, while the performance collector recompresses hash-normalized assets to evaluate budgets; both now consume the same gzip selector.

flowchart LR
  A[Built assets] --> B[Vite sidecar producer]
  A --> C[Hash normalizer]
  C --> D[Budget measurement]
  B --> E[Shared gzip selector]
  D --> E
  E --> F[Compressed bytes]
  D --> G[Performance gate]
Loading

Technical review

Best possible solution:

Keep one gzip selector for sidecar generation and normalized measurement while retaining existing budgets and compression eligibility.

Do we have a high-confidence way to reproduce the issue?

Current-main source directly shows the mismatched selectors, and the supplied fail-first fixture records the expected discrepancy; this read-only review ran no target code.

Is this the best way to solve the issue?

The shared selector is the smallest complete fix for the reported mismatch, removes duplicated policy, and preserves the existing build output contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 800bd59c1a3a.

Provenance checked

  • Normalized asset measurements keeps the original intent (00ddcde: Remove generated asset-hash noise from budget compression while preserving served-byte reporting and compression eligibility.)
  • Boot gzip level selection keeps the original intent (4220420: The actual introducing hunk explicitly selects the smallest boot encoding because compression levels are not monotonic; this PR preserves that algorithm unchanged.)
  • Precompression regression suite keeps the original intent (7f345d6: Preserve boot compression savings while using cheaper deferred Brotli compression and bounded build concurrency.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 00ddcde adds ui/config/control-ui-asset-compression.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 00ddcde27521; files: ui/config/control-ui-asset-compression.ts)

PR surface

Source +10, Tests +37. Total +47 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 25 15 +10
Tests 1 37 0 +37
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 62 15 +47

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: False performance-budget failures block legitimate contributions, with no demonstrated runtime or served-asset regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 3:18 PM ET / 20:18 UTC.

@jalehman
jalehman force-pushed the fix/control-ui-perf-compression-parity branch from 7b9674a to 9d34a02 Compare November 16, 2026 22:36
@jalehman

Copy link
Copy Markdown
Contributor Author

Folded into #200145 at Josh's direction: commit 9d34a02 landed with it in 5f41b56. Closing without merging.

@jalehman jalehman closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant