Skip to content

Commit 24351cf

Browse files
test(app-shell): wait on the whole list in the report index suite's positive cases (#27128)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8SfRz7pGa2P99NAztqiusfy)_ Fixes #27116 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:只改一个测试文件:报表索引测试套件里所有「期望看到完整列表」的用例,改为等到整个列表出现再断言,而不是等到某一项出现就立即断言。 - **为什么改**:⌘K 面板里通过导航项出现的报表会先出现,导航外的报表要等报表列表返回后才出现;原用例等到 Gamma 就断言全部四项,CI 负载高时 Delta 还没到,导致合并队列里的 PR 被误踢出。 - **风险与回滚**:极低:只改测试,不改产品代码,不跳过、不重试、不调超时;回滚即还原本 PR 的一个提交。 - **先看**:`AppReportIndex.navGates-26892.test.tsx` 中「(f) CONTROL: offers it, once, to a member granted that permission」一例,以及 `indexSettled` 上方的说明。 - **两分钟验证**:`pnpm --dir ui exec vitest run packages/app-shell/src/views/__tests__/AppReportIndex.navGates-26892.test.tsx --sequence.shuffle`,预期 18 个用例全绿。 - **需要你做的**:无,席位落地。 ## What changes Test-only, one file: `ui/packages/app-shell/src/views/__tests__/AppReportIndex.navGates-26892.test.tsx`. - **The race.** "(f) CONTROL: offers it, once, to a member granted that permission" waited for Gamma, then asserted the full palette list synchronously. The palette offers a nav-named report (Gamma) through its navigation entry at once, and Delta (named by no entry) only once the report list answers, so on a loaded shard the assertion ran with Delta still missing (received Alpha, Beta, Gamma). It now waits on the full list: `waitFor(() => expect(paletteReports()).toEqual(ALL))`. - **Siblings audited.** Every case that expects a list now waits on that list itself: the index's four positive controls (they waited for the Gamma link, then read the list; safe today because the index renders its list from one answer, changed so no case leans on that), and the palette's "(e) CONTROL" (it waited for Delta through `paletteSettled`, then read the list). The negative cases keep their settle-then-assert shape: a negative is asserted after the lists have answered (`indexSettled` / `paletteSettled` wait for Delta, which no gate hides), and the permissions provider renders nothing before its answer, so no later answer can add the hidden entry. A doc comment above `indexSettled` says the settles serve the negatives only, and why. - ⛔ No source change, no skip, no retry, no timeout change. ## Tests The race was reproduced by a one-off mutation of the suite's adapter double, through `scripts/ablation-replace.mjs`, which restores the file and proves it matches HEAD each time: - **Red, before the fix** (head `6817bf1e`): the report list answer delayed 300 ms. Result: "(f) CONTROL: offers it, once, to a member granted that permission" fails with Delta missing; the other 17 cases pass. - **Green, after the fix** (head `b24c61d8`): the same 300 ms delay gives 18/18; report and dataset lists both delayed 600 ms gives 18/18; plain run 18/18; `--sequence.shuffle` 18/18. ## Acceptance notes - `origin/main` moved after the branch point (`6817bf1e` to `e6e41998`, 84 files), and none of them is this suite or the source it covers; the branch is not merged with main for a test-only change, and CI runs the PR's merge ref. ## Verification Head `b24c61d8`, worktree from `origin/main` `6817bf1e`, after building the `@object-ui/app-shell` dependency closure under the verify lock (exit 0). <details><summary>Type-check, lint</summary> - `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit` and `tsconfig.test.json`): exit 0. - `pnpm --dir ui exec eslint` on the file: exit 0, no problems. - `pnpm --dir ui run check:new-line-citations`: 0 new citations, exit 0. </details> <details><summary>Derived gates</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 24 commands; each ran with its exit captured before any pipe (`pnpm --dir ui exec vitest run scripts/` under the verify lock). `--ran` reconciliation: 24 derived, 24 run, 0 NOT-MEASURED, 0 UNRUN. Model tier: no path-derived mandate. - `node scripts/check-closing-keyword-parity.mjs` exit 0 - `node scripts/check-closing-keyword-parity.mjs --self-test` exit 0 - `node scripts/check-comment-mask-corpus.mjs` exit 0 - `node scripts/check-sdui-manifest.mjs` exit 0 - `node scripts/check-sdui-manifest.mjs --self-test` exit 0 - `pnpm --filter @objectstack/spec run check:duration-unit-keys` exit 0 - `pnpm check:cross-package-test-inputs` exit 0 - `pnpm check:dispatcher-error-vocabulary` exit 0 - `pnpm check:driver-memory-census` exit 0 - `pnpm check:engine-double-contract` exit 0 - `pnpm check:gitlink-declared` exit 0 - `pnpm check:nul-bytes` exit 0 - `pnpm check:published-files` exit 0 - `pnpm check:query-options-erasure` exit 0 - `pnpm check:refd-timer-probe` exit 0 - `pnpm check:skill-identifier-liveness` exit 0 - `pnpm check:test-source-alias` exit 0 - `pnpm check:tier-file-adoption` exit 0 - `pnpm check:type-check-coverage` exit 0 - `pnpm check:type-check-debt` exit 0 - `pnpm check:undeclared-dep-imports` exit 0 - `pnpm check:watch-hint-literal` exit 0 - `pnpm check:where-matcher` exit 0 - `pnpm --dir ui exec vitest run scripts/` exit 0 </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; eslint on the changed file: 0 problems. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. Nothing published changes (test-only, `@object-ui/app-shell` is `private: true`): `skip-changeset`; both declaration lines are filled in above. - [x] 6. `packages/spec` not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbZNdnTTr8WJsM98Mxh --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZNdnTTr8WJsM98Mxh)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 753683a commit 24351cf

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

‎ui/packages/app-shell/src/views/__tests__/AppReportIndex.navGates-26892.test.tsx‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,14 @@ function paletteReports(): string[] {
207207
.sort();
208208
}
209209

210-
/** The index has listed Delta, the report no gate can hide: its lists have answered. */
210+
/**
211+
* The index has listed Delta, the report no gate can hide: its lists have
212+
* answered. A settle for the NEGATIVE cases only: a case that expects a list
213+
* waits on that whole list (objectstack#27116). The palette's two doors answer
214+
* at different times (a nav-named report through its entry at once, Delta
215+
* once the report list answers), so a wait on one entry says nothing about
216+
* another.
217+
*/
211218
async function indexSettled() {
212219
await screen.findByRole('link', { name: 'Delta' });
213220
}
@@ -237,8 +244,7 @@ describe('the report index applies the navigation\'s member gates (objectstack#2
237244

238245
it('(b) CONTROL: lists it for a member granted that permission', async () => {
239246
renderIndex(appWith(gammaEntry({ requiredPermissions: ['crm_forecast:read'] })), { forecastRead: true });
240-
await screen.findByRole('link', { name: 'Gamma' });
241-
expect(indexed()).toEqual(ALL);
247+
await waitFor(() => expect(indexed()).toEqual(ALL));
242248
});
243249

244250
it('(c) leaves out a report whose entry sits in a `visible: false` group', async () => {
@@ -263,21 +269,18 @@ describe('the report index applies the navigation\'s member gates (objectstack#2
263269

264270
it('(e) CONTROL: an entry `visible: true` lists the report', async () => {
265271
renderIndex(appWith(gammaEntry({ visible: true })));
266-
await screen.findByRole('link', { name: 'Gamma' });
267-
expect(indexed()).toEqual(ALL);
272+
await waitFor(() => expect(indexed()).toEqual(ALL));
268273
});
269274

270275
it('(e) CONTROL: one entry the member is shown is enough, beside a hidden one', async () => {
271276
renderIndex(appWith(gammaEntry({ visible: false }), gammaEntry({ id: 'nav_gamma_2' })));
272-
await screen.findByRole('link', { name: 'Gamma' });
273-
expect(indexed()).toEqual(ALL);
277+
await waitFor(() => expect(indexed()).toEqual(ALL));
274278
});
275279

276280
it('(e) CONTROL: an app whose navigation names no report lists every report it owns', async () => {
277281
const app = { ...appWith(), navigation: [{ id: 'nav_accounts', type: 'object', objectName: 'crm_account', label: 'Accounts' }] };
278282
renderIndex(app);
279-
await screen.findByRole('link', { name: 'Gamma' });
280-
expect(indexed()).toEqual(ALL);
283+
await waitFor(() => expect(indexed()).toEqual(ALL));
281284
});
282285
});
283286

@@ -299,8 +302,7 @@ describe('⌘K applies the same gates to the app\'s reports (objectstack#26892)'
299302

300303
it('(e) CONTROL: offers the report, once, when its entry is shown', async () => {
301304
renderPalette(appWith(gammaEntry({ visible: true })));
302-
await paletteSettled();
303-
expect(paletteReports()).toEqual(ALL);
305+
await waitFor(() => expect(paletteReports()).toEqual(ALL));
304306
});
305307
});
306308

@@ -355,8 +357,7 @@ describe('⌘K offers its navigation entries as the sidebar shows them (objectst
355357

356358
it('(f) CONTROL: offers it, once, to a member granted that permission', async () => {
357359
renderPalette(appWith(gammaEntry({ requiredPermissions: ['crm_forecast:read'] })), { forecastRead: true });
358-
await waitFor(() => expect(paletteReports()).toContain('Gamma'));
359-
expect(paletteReports()).toEqual(ALL);
360+
await waitFor(() => expect(paletteReports()).toEqual(ALL));
360361
});
361362

362363
it('(f) offers neither door to a report whose entry sits in a `visible: false` group', async () => {

0 commit comments

Comments
 (0)