Skip to content

Commit d69cf97

Browse files
test(app-shell): load the lazy object list at collection in the disabled-package deep-link suite (#34231)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9QjKmMVoDWtE45ELv1652Kd)_ Part of #33581 Clause-②: no — a test's load order; no surface added or changed Metadata-protocol: none ## 维护者速读 - 做了什么:修 #34176 合入后留下的一个测试超时。`AppContent.disabledPackageDeepLink-13052` 的 (b) 用例在 main 上每次都在约 1000 ms 超时,合并队列里同步过 main 的 PR 会因此被踢出。 - 原因(实测):(b) 的“对象不存在”画在懒加载的对象列表路由里。#34176 之后,第一次画它还要冷加载 plugin-view 包入口,测试里总耗时超过了 `waitFor` 的 1 秒。断言本身只要约 40 ms。 - 修法:按 ui/AGENTS.md 的懒边界规则,在测试文件模块作用域预载对象列表模块,冷加载算在收集阶段。同目录 dashboard 路由测试已经这样写。没有加大超时。 - 产品侧:对象列表路由块在 AppContent 知道路由时就和元数据读取并行预载(objectui#12980),plugin-view 块作为它的静态依赖一起并行取。所以“对象不存在”不会多排一次队,产品代码不用改。 - 风险:只改一个测试文件,不发布任何包,没有 changeset。 - 需要你做的:无。合入后 #34180 可以重新排队。 ## What changes `ui/packages/app-shell/src/console/__tests__/AppContent.disabledPackageDeepLink-13052.test.tsx` imports `../../views/ObjectView` (and `@objectstack/lint`, which that module reaches) at module scope, beside `AppContent`, with a comment saying why. That is ui/AGENTS.md's rule for an assertion behind a `React.lazy` boundary, spelled as `AppContent.dashboardRouteReads-28784.test.tsx` already spells it for `DashboardView`. ## Why Case `(b) CONTROL: 404 RESOURCE_NOT_FOUND still draws "Object Not Found"` timed out in queue build 43779205122 and on #34180's synced head (job 133021475780). Both contain `571cf9082a` (#34176). Measured on this box (verbose reporter, the file alone under `os-verify-lock`, `@object-ui/app-shell^...` root deps built in both trees): | tree | (b) | |:--|--:| | `571cf9082a^` (`44fc2fc4`), 3 runs | passes; 691 ms on run 1 | | `main` (`aab8b318`), 3 runs | times out at ~1012 ms every run | | `main` + module-scope `import '@object-ui/plugin-view'` | 630 ms | | `main` + module-scope `import '../../views/ObjectView'` (this PR), 3 runs | 41 / 46 / 42 ms | So the whole of (b)'s time is the cold load of the lazy route's modules. Before #34176 it was already 691 ms of a 1000 ms budget: `ObjectView`'s own graph, with plugin-view held by `AppContent`'s eager import. #34176 moved plugin-view's entry graph out of `AppContent`'s imports and into that first lazy load. The assertion itself takes about 40 ms. **Product.** (a) `OBJECT_PACKAGE_DISABLED` is drawn by `AppContent` itself. (b) `RESOURCE_NOT_FOUND` is drawn inside the lazy `ObjectView` route element, and has been since #33677. In the console, `preloadAppRouteChunk` starts that route chunk's import as soon as `AppContent` knows the route, in parallel with the route's metadata reads (objectui#12980). The plugin-view chunk is a static dependency of that chunk and is fetched with it, so the not-found state does not queue behind an extra serial load. No product change. ## Tests - The file: 18/18 on three runs. - **Ablation** (`scripts/ablation-replace.mjs`): `import '../../views/ObjectView';` → `/* ablated */` reproduces the CI failure: `(b)` ✗ at 1016 ms, `Unable to find an element by: [data-testid="object-not-found"]`. Restored: blob == HEAD, `git diff HEAD` empty. - No forced edits to other tests. ## Verification - `dispatch-gates.mjs --commands` on head `8280ad42`: 27 commands, every one exit 0; `--ran`: `27 derived famil(ies) accounted for — 27 run, 0 NOT-MEASURED`. Among them `check:test-source-alias` (the added `@objectstack/lint` import), `check:type-check-debt` and `pnpm --dir ui exec vitest run scripts/`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmT5bCDp1MDcReXVCop Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 9a7f8c1 commit d69cf97

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎ui/packages/app-shell/src/console/__tests__/AppContent.disabledPackageDeepLink-13052.test.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ vi.mock('@object-ui/react', async (importOriginal) => ({
9494
}));
9595

9696
import { AppContent } from '../AppContent';
97+
// The object list is a lazy route element (`AppContent`'s `ObjectView`), and
98+
// the plain "Object Not Found" of (b) is drawn inside it. Its cold load — the
99+
// list and `@object-ui/plugin-view`'s entry, which the shell no longer holds
100+
// eager (objectstack#33581) — is paid here, at collection, never inside a
101+
// clocked `waitFor`. `@objectstack/lint` is reached through it, so it is too.
102+
import '@objectstack/lint';
103+
import '../../views/ObjectView';
97104
import { MetadataProvider } from '../../providers/MetadataProvider';
98105

99106
const PKG = 'app.showcase';

0 commit comments

Comments
 (0)