Repository navigation
improve(ui): stop loading unused CJK tables during boot - #194241
Conversation
Mark fixed private initializers as pure so constant-only consumers do not retain their regex and 205 KiB lookup. Preserve token-estimation consumers and lower normalized Chat, New Session, and shared chunk caps to measured head plus 64 bytes. Matched boot gzip drops 476 bytes; existing CJK contracts remain unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Measure after merging the landed sidebar projection change. The unused CJK initialization cut saves 390 normalized gzip bytes on this combined head. Keep all caps below main while setting Chat, New Session, and largest JS to their measured values plus 64 bytes.
|
Codex review: needs maintainer review before merge. What this changesThis PR makes unused CJK initializers removable by the bundler and lowers three Control UI JavaScript byte caps. Example: Loading Chat using the matched production builds reported in this PR.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR removes unnecessary boot initialization through a focused change, with no introduced correctness or security findings; exact-head CI remains unresolved. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherControl UI imports shared normalization helpers through a barrel that also exports token estimators; bundling determines which initializers reach browser assets, and the existing performance checker measures those assets. flowchart LR
A[Control UI imports] --> B[Normalization barrel]
B --> C[Production bundler]
D[CJK estimator initializers] --> C
C --> E[Browser boot assets]
E --> F[Existing byte budget checker]
D --> G[Token estimation callers]
Technical reviewBest possible solution: Keep the focused pure annotations and lower caps while preserving the existing estimator owner and budgeting semantics. Do we have a high-confidence way to reproduce the issue? Source shows unconditional initialization through the shared barrel, and the supplied matched builds report the resulting byte reduction; no target code was executed during this review. Is this the best way to solve the issue? The change is the smallest complete fix at the existing owner: the annotations cover entire fixed computations, preserve estimator references, and avoid new loading boundaries or runtime machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8662f3bf78dc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Other 0. Total +2 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 6, 2026, 12:35 PM ET / 17:35 UTC. |
|
Merged via squash auto-merge.
|
) * perf(ui): drop unused CJK initialization from boot Mark fixed private initializers as pure so constant-only consumers do not retain their regex and 205 KiB lookup. Preserve token-estimation consumers and lower normalized Chat, New Session, and shared chunk caps to measured head plus 64 bytes. Matched boot gzip drops 476 bytes; existing CJK contracts remain unchanged. * perf(ui): ratchet byte caps on integrated sidebar head Measure after merging the landed sidebar projection change. The unused CJK initialization cut saves 390 normalized gzip bytes on this combined head. Keep all caps below main while setting Chat, New Session, and largest JS to their measured values plus 64 bytes.
What Problem This Solves
Chat and New Session boot retain CJK token-estimation initialization even when their normalization imports do not use it. Main’s New Session boot was over the cap reduced in #194203.
User Impact
Boot downloads 390 B less normalized gzip and no longer allocates an unused 205 KiB character lookup. Token estimates, rendering, requests, and lazy boundaries are unchanged. No configuration or migration is needed.
Why This Change Was Made
Mark the two fixed, private CJK initializers pure so the bundler can delete them for consumers that do not use token estimation. The regex's immediate expression groups its fixed range-to-pattern computation into the same removable initialization; actual estimator consumers retain both initializers. Lower Chat, New Session, and largest-JS caps to measured head plus 64 B. No cap increases.
Related: #194135, #194203.
Evidence
Acceptance: same-machine production builds at base
349fc9649ddand this source head, generated names normalized by the repository checker; reduce bytes without moving code across lazy boundaries. This is unused-code elimination, so there is no timing or visual change to benchmark.Request counts unchanged: initial 3 JS/1 CSS, Chat 20/3, New 15/3. Across this lane, Chat is now 2,548 B below the original 1,289,681 B baseline; the three matched cuts total 2,856 B before concurrent main changes.
pnpm ui:buildon base and head; pairedpnpm ui:check-performance --base-dist … --json: pass. Final cap evaluation has zero violations.pnpm tsgo:ui: pass. Existing CJK contract suite: 34/34 pass.extensions/deep-research/browser/client.tsfile introduced by feat(research): retain authorized browser research state #177231; exact-basec4f2ca1rerun reproduces the same file (and reports an existing solid-lint eslint install-state dependency). No new ignored files or exports.Full UI CI requested with
ci:full. Prior CSS parity and screenshots remain in #194203; this follow-up does not change CSS or rendered output.Integration: merged main #194171 before the final paired measurement. Its sidebar projection change is already on main and is not part of this PR diff. The earlier c4f2ca1 pair saved 476 B; the final 349fc96 pair saves 390 B because gzip interactions change with the shared chunk. All final caps remain below their values on main.
CI attempt 1: 100 jobs passed; Real Gateway 2/2 failed before assertions when the device-platform fixture could not bind its allocated localhost port (
GatewayLockError,EADDRINUSE). Requested one rerun of only job 128040296326 via the supported job API. This is a diagnosed setup collision, not an inherited-test waiver.Final validation: CI run 42260650608 attempt 2 passed on exact head
d436946f6d726b6a86a45759650c3cc7bfb958c7. The one requested infrastructure retry resolved the setup port collision; no code changes or inherited-failure exception were needed.