From f74cc3d9f4797acd9debc0b552729652f8595244 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Aug 2026 13:38:09 +0000 Subject: [PATCH 1/2] fix(console): hoist the InternalFormRoute import out of the timed window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `hop1SessionPrincipal` was spending 10204ms of its 15000ms budget inside `await import('./InternalFormRoute')` — the first VALUE request for `@object-ui/app-shell` in the file, which runs the `vi.mock` factory's `importOriginal()` against `packages/app-shell/src`. The render and the assertions cost ~12ms. Module scope moves the load into the import phase, which no test or hook timeout bounds. Same specifier, same binding. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q --- .../FormPage.predicateScope.test.tsx | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/apps/console/src/components/FormPage.predicateScope.test.tsx b/apps/console/src/components/FormPage.predicateScope.test.tsx index c1a0abca17..48de6d8fad 100644 --- a/apps/console/src/components/FormPage.predicateScope.test.tsx +++ b/apps/console/src/components/FormPage.predicateScope.test.tsx @@ -65,6 +65,31 @@ import { MemoryRouter, Route, Routes } from 'react-router-dom'; import { PredicateScopeProvider } from '@object-ui/react'; import { FormPage } from './FormPage'; +/** + * `InternalFormRoute` is imported HERE, at module scope, and deliberately NOT + * with a dynamic `await import()` inside `hop1SessionPrincipal` below — + * AGENTS.md §测试纪律, "an unbounded module load counted inside a bounded + * window". + * + * This module's graph is the first VALUE request for `@object-ui/app-shell` in + * the file (`FormPage` only `import type`s it), so it is what runs the + * `vi.mock('@object-ui/app-shell')` factory's `importOriginal()` below — and + * that specifier is aliased to `packages/app-shell/src` + * (`apps/console/vite.config.ts`), a barrel carrying eight side-effect imports, + * transformed on demand. Measured on an IDLE machine it cost **10204ms** of + * `hop1SessionPrincipal`'s 15000ms budget; the render and the assertions cost + * ~12ms, the same as the seven cases above. Nothing was wrong with the test — + * it was racing the module loader, and lost whenever the transform pipeline was + * saturated by a full-project run. + * + * Module scope moves that cost into the IMPORT phase, which no test or hook + * timeout bounds. `beforeAll` would not do: it is bounded by `hookTimeout` + * (10s), narrower than the 15s it replaces. The specifier is unchanged, so this + * is the same module and the same binding as the `await import()` was — only + * loaded before the timed window instead of inside it. + */ +import { InternalFormRoute } from './InternalFormRoute'; + vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); /** @@ -312,6 +337,10 @@ describe('#6110 controls — green before AND after the fix, by construction', ( * REAL, because they are the thing under test. `DefaultHomeLayout` is a * pass-through: the chrome is #4109's subject, not this card's, and stubbing it * cannot hide the provider, which the route mounts itself. + * + * These still apply to the module-scope `InternalFormRoute` import above: + * `vi.mock` calls are hoisted above every import in the file, so the factories + * are registered before that import executes. */ vi.mock('@object-ui/app-shell', async (importOriginal) => { const actual = await importOriginal>(); @@ -341,7 +370,6 @@ describe('#6110 hop 1 — `/forms/:name` publishes the SESSION principal', () => // `/apps/:appName/*` subtree) and in app-shell's `RecordFormPage`, and // NEITHER is above `/forms/:name`. Binding the evaluator call sites without // this hop would have shipped a fix that reads `{}` forever. - const { InternalFormRoute } = await import('./InternalFormRoute'); vi.stubGlobal( 'fetch', stubFetch([ From 182be8350ab1564ccdb7a1892419db46f04b5c0e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Aug 2026 14:10:09 +0000 Subject: [PATCH 2/2] chore(changeset): declare the #6567 test hoist as releasing nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty frontmatter — `check-changeset-presence` asks for the declaration because `apps/console` is a released package; the change is test-only. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q --- .../issue-6567-hoist-internalformroute-import.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/issue-6567-hoist-internalformroute-import.md diff --git a/.changeset/issue-6567-hoist-internalformroute-import.md b/.changeset/issue-6567-hoist-internalformroute-import.md new file mode 100644 index 0000000000..e8d1e73a62 --- /dev/null +++ b/.changeset/issue-6567-hoist-internalformroute-import.md @@ -0,0 +1,10 @@ +--- +--- + +Test-only: in `apps/console/src/components/FormPage.predicateScope.test.tsx`, hoist +`InternalFormRoute`'s import from a dynamic `await import()` inside the +`hop1SessionPrincipal` case to module scope. That load was costing 10204ms of the +case's 15000ms budget — it is the file's first value request for +`@object-ui/app-shell`, aliased to source — which made the file's one anti-inert +case fail under full-project parallel load. Same module, same binding, loaded +before the timed window instead of inside it. No published behaviour changes.