Repository navigation
perf(console): the chat UI, the auth pages and qrcode leave the first load - #38384
Merged
Merged
Conversation
… load The plugin-chatbot-core chunk group now takes the two modules core.ts re-exports that it did not list (hitlContinuation, chat/questionSkip), so the plugin-chatbot and plugin-markdown chunks are lazy again. The nine auth pages and four dev pages load with their routes, and qrcode loads when a QR first draws. The eager-closure gate gains a half that fails when a chat chunk is in the eager closure. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
…ceiling The eager-closure gate's chat half gets unit cases, a main-level exit-1 case and a static case that matches every module plugin-chatbot/src/core.ts re-exports against the plugin-chatbot-core group. MAX_EAGER_CLOSURE_GZIP_BYTES and BASELINE are re-pinned by the gate's formula to the reading on the branch commit 483eaa3: 1,893,147 + 355,840 = 2,248,987. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
The auth routes drop their own Suspense, so the mobile shell's ready() still waits for the first route to be on screen. The docs-portal laziness test moves its eager positive control from LoginPage to FormPage. The changeset carries the claim's Clause-② line verbatim. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
The build of 686c999 reads 1,893,160 gz across 134 of 2653 chunks, so the ceiling is 1,893,160 + 355,840 = 2,249,000 and BASELINE names 686c999. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
This was referenced Nov 28, 2026
With the auth pages lazy, the first route commits after a chunk resolves, and ready() and routeChanged run in that commit's passive effects, which can land after findByTestId returns. The five event assertions now wait for the events; the ready: prefix still records what was on screen when ready() came. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM
Contributor
Author
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T21:21Z · zone
|
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.
Fixes #37572
Requested by Tesla · project thread
Part of #37444
Clause-②: no (load order only)
Metadata-protocol: none
维护者速读
What changes
The chunks every Console page fetches before it can draw drop from 2,226,792 to 1,893,160 bytes gzipped (147 to 134 eager chunks), measured on production builds of
mainateef1cbfe4and of this branch at686c9993. Three cuts, as amendment 7243947617 on the card lists them:ui/apps/console/vite.config.ts).packages/plugin-chatbot/src/core.tsre-exportshitlContinuationandchat/questionSkip, and theplugin-chatbot-corechunk group did not list them. They landed inplugin-chatbot, which the eager core chunk then imported statically, and that pulled inplugin-chatbot(236,909 gz) andplugin-markdown(69,180 gz) on every page. The group lists both now.ui/apps/console/src/App.tsx). Each page now useslazy(). The dev pages sit behindProtectedRouteand get their own Suspense boundary, asDevRowActionsalready did. The auth pages get no boundary of their own. They suspend intoConsoleShell's boundary, which also holdsNativeShellRouting, so the mobile shell'sready()still waits until/loginis on screen (see Acceptance notes).qrcodeis imported on demand at its two call sites:TotpQrinRemediationOverlay.tsxandQrcodeBlockinActionResultDialog.tsx. If the import fails, the message goes to the error slot that an encoding error already used.Guard.
ui/scripts/check-eager-closure-budget.mjsgains a sixth half,evaluateLazyChatChunks. It fails when aplugin-chatbotorplugin-markdownchunk is in the eager closure, whatever the aggregate says. It returns error when the report has no files, or when its counter-probe finds no module of either package in a chunk of that name, so a renamed chunk cannot pass by default. Unit tests cover pass, fail for each chunk, the counter-probe, an unreadable report, andmaingoing from exit 0 to 1. A static case also checks that everyexport ... fromincore.tsis matched by the group regex parsed out ofvite.config.ts.Re-pin. I re-pinned by the gate's documented formula at the measured head, as the seat ruled. The ceiling is
MAX_EAGER_CLOSURE_GZIP_BYTES= 1,893,160 + 711,680 / 2 = 2,249,000 (it was 2,407,237).BASELINE= 1,893,160 / 134 / 2653 at686c9993, withsquashMergenull until a back-fill. The four per-chunk ceilings did not move. Changeset: patch for@object-ui/app-shell,@object-ui/consoleand@objectstack/console.Tests
Every reading in this section was taken at head
809cfb890. Commit809cfb890changes only the gate script and its test, andvite.config.tsdoes not import that script, so no bundler input differs from686c9993, where the bundle was built.node scripts/check-eager-closure-budget.mjs(inui) exits 0. Every half is ✅, including "Chat chunks stay lazy". The same gate on themainbuild exits 1 on that half../hitlContinuationand./chat/questionSkip. The rebuilt bundle reads 2,201,929 gz in 148 eager chunks. The gate exits 1 from the chat half alone, while the aggregate half stays ✅ (2150.3 KB under the 2196.3 KB budget). Without the new half, the gate would not have caught this regression.pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped; 5159 tests passed, 2 skipped.App.docsPortalLazy,App.nativeShellMode-29039andApp.nativeShellOpenSet-29330: 2 of 3 files passed on the first run, 1 test failed (see Acceptance notes, "a timing-dependent assertion"). Re-run ofApp.nativeShellMode-290394 times on an idle box: 17/17 each, then 3 more times under synthetic CPU load: passed each time.RemediationOverlay*andActionResultDialogtests: 7/7 files, 48/48 tests.type-checkexits 0 for@object-ui/consoleand for@object-ui/app-shell(its script also runstsconfig.test.json).@object-ui/app-shelland@object-ui/consolesuites (CITest UIruns them).Derived gates (dispatch-gates --commands, 47 families, at 809cfb8)
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ranwith the exit-coded record: "47 derived famil(ies) accounted for — 45 run, 2 NOT-MEASURED". 45 exited 0. NOT MEASURED:pnpm check:dual-build-cjs-loads(exit 3, PREREQUISITE NOT MET: the@objectstack/*packages are not built in this worktree;Build Corebuilds them in CI), andpnpm check:type-check-debt(its re-measure needs a full-repo package build; CILint & Repo Gatesruns it).overlap-check.mjs --branch=claude/project-thread-ciejge: "VERDICT clean exit 0", merges cleanly ontoorigin/main61cde6dc7.Acceptance notes
App.nativeShellMode-29039andApp.nativeShellOpenSet-29330then caughtready()being posted over the loading fallback (ready:nothing) instead of the login page. Removing those boundaries fixes it. The native shell drops its cover only once the first route is on screen, as before.App.docsPortalLazy.test.tsxusedLoginPageas its live positive control for an eager import. Cut 2 makes that page lazy, so the control moves toFormPage, which is still static. This is the same move objectui#13410 made whenSharedRecordPagewent lazy. The test file is not on the amendment's file list. It is in this PR because cut 2 made its assertion false. It is in commit686c9993.OS_AUTH_TWO_FACTOR=true), the "Enable Two-Factor Auth" button does not render on the user's own record in Setup (Users, Security tab). This happens on themainbuild and on this branch alike. The browser console says:[ActionEngine] action "enable_two_factor" hidden: its visible predicate threw — CEL predicate failed to evaluate: (has(record.id) && record.id == ctx.user.id && has(record.two_factor_enabled) && record.two_factor_enabled != true) && features.twoFactor == true. The record shows "Two-Factor Enabled: No", and/api/v1/auth/configreportsfeatures.twoFactor: true. It is in the report for the seat to file. Because of it, the QR reading below goes through the other call site, the MFA remediation overlay.services.aiunavailable andGET /api/v1/ai/agentsreturns an empty list. For the chat-panel reading, the browser stubs that one endpoint with a single agent so the button and the drawer render. What the reading measures is which chunks the browser fetches. It does not measure a reply.App.nativeShellMode-29039failed once in "posts ready once, after the first route rendered":expected [] to deeply equal [ 'ready:login-page', 'route:/login' ]. With the auth pages lazy, the first route commits after a chunk resolves, andready()androuteChangedrun in that commit's passive effects. These effects can land afterfindByTestIdreturns, so the synchronousexpect(events)right after it can read an empty list. Onmainthe page was eager, so the first route committed insiderender'sact(inferred from the code, not measured). Measured: 1 failure in 9 runs, on a cold and loaded box. The fix is fivewaitForwraps in that file and inApp.nativeShellOpenSet-29330. Both files are outside the amendment's file list, so the fix is left to the seat to add to the file list, not pushed here.Verification
Read first, by risk:
ui/apps/console/src/App.tsx: the comment above the lazy pages and the 9 auth routes without their own boundary. A boundary added back there would bring back the earlyready().ui/scripts/check-eager-closure-budget.mjs:evaluateLazyChatChunks, and thechat-lazyentry inmain's fold.ui/packages/app-shell/src/views/ActionResultDialog.tsx: theimport('qrcode')path that writes to the error slot.Two-minute check: run
pnpm --filter @object-ui/console buildand then, inui,node scripts/check-eager-closure-budget.mjs. Expect "✅ Chat chunks stay lazy" and about 1848.8 KB eager against a 2196.3 KB budget.Readings
Eager closure before and after (production builds, same container, same instrument)
Both builds were measured with
emitEagerClosureReport(dist/eager-closure.json). Control:mainateef1cbfe4. Head:686c9993. Commit809cfb890changes only the gate script and its test.eef1cbfe4686c9993plugin-chatbotplugin-markdownindexbrowser(qrcode)The per-chunk rows are unchanged:
vendor-objectstack-392,framework-18,ui-components+583,i18n-locale-en0.Earlier readings, kept as recorded: at
483eaa34, 1,893,147 in 134 of 2653. With cut 1 ablated, 2,201,929 in 148 of 2653.Gate at head: exit 0
The ablation build (cut 1 reverted) gives:
The gate exits 1.
Browser readings: real Chromium 1243 through Playwright 1.63, production builds, HTTP/2 TLS front
Setup:
objectstack startwithNODE_ENV=production,OS_AUTH_TWO_FACTOR=trueandOS_TRUSTED_ORIGINSset to the front, the showcase app and a SQLite file database. The main and PR dists were served in turn by the same server behind the same HTTP/2 front. Each check used a fresh browser context, and every document was served overh2.mainbuild/loginrenders the e-mail and password inputs/loginfetches aLoginPage-*.jschunkindex)LoginPage-TuUOOWNS.js/loginplugin-markdown,plugin-chatbotplugin-markdown,plugin-chatbotplugin-markdown-z1wyxXLS.js,plugin-chatbot-eTgo7l4P.jsqrcodechunk fetched before enrolmentbrowser-jSiDnjdN.js(theqrcodechunk, not eager)The QR was read on the MFA remediation overlay (
TotpQr) for a second account, withauth.mfa_requiredset toeveryoneand a grace period of 0. The setting was restored tooffafterwards. Notes on why: the record-page "Enable Two-Factor Auth" button does not render on either build (Acceptance notes), and the agent catalog is stubbed for the chat reading because the open framework has no AI service.LCP medians by the #37444 method
Method: production builds, HTTP/2 TLS front, Lighthouse 13.6.0
desktop-config(simulated throttling, storage reset on), signed in through the Console login form, Chromium 1243 headless. I ran the arms back to back in blocks main-1, pr-1, pr-2, main-2 of 5 runs per page each, so each arm has 10 runs. Every document and script was served overh2, and no run recorded a runtime error./_console/home, landing on the showcase capability map)/apps/com.example.showcase/showcase_task).../showcase_task/record/GYPAOUBLX6JfK5c_)Home caveat.
/_console/homeredirects to the last app opened. In block main-1 it landed on the Setup dashboard, because the browser checks before it had last opened Setup. Those 5 runs measure a different page (2,473 to 2,707). They are excluded from the home row and kept in the raw data. To give main 10 runs on the same landing page, I appended a block main-3 of 5 home runs; it ran right after main-2, not interleaved with a PR block. The unfiltered home medians are main 2,378 and PR 2,068.Scripts fetched per load: home 180 on main and 167 on the PR, list 285 and 274, record 217 and 206.
Runs (ms):
These are shared-box readings. The runs held the verify lock, which excludes other locked runs but not other unlocked work.
Appended after the session restart: the gate re-read at head 809cfb8
Commit
809cfb890changes onlyui/scripts/check-eager-closure-budget.mjsand its test (git diff --stat 686c99934 809cfb890: 2 files).ui/apps/console/vite.config.tsdoes not import that script, so no bundler input differs from686c9993, and the eager closure was not rebuilt. Thedist/eager-closure.jsonon disk is byte-identical (cmp) to the686c9993reading recorded above.node scripts/check-eager-closure-budget.mjsat committed head809cfb890exits 0, and its output is byte-identical (diff) to the "Gate at head" block above: 1848.8 KB across 134 of 2653 chunks against a 2196.3 KB budget (2,249,000 bytes), and "Chat chunks stay lazy". No recorded number changes.Generated by Claude Code