Skip to content

Commit 9a274e6

Browse files
test(plugin-list): the inlineFlsNoop UNAUTHORED case waits for the object-schema headers, not the first render (#37981)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoKVUc6H29jLDJsTfYRni5MR)_ Fixes #37972 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:只改了列表页的一个自动化测试,产品行为不变。 - 这个测试在慢的检查机上会偶发失败,挡住了与界面无关的修复合并;修好后这类合并不再被它卡住。 - 出错的话只是这个测试再次偶发失败,删掉本次改动即可撤回,不影响任何用户。 - 要你做什么:无。 ## What changes `ui/packages/plugin-list/src/__tests__/ListView.inlineFlsNoop-6723.test.tsx`, the UNAUTHORED case only. The rows can paint before the object schema arrives. Until it does, `objectSchema` is null, so `generateColumns()` answers from the row keys on the inline-data path (`ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx:783-784`): `Id` shown, `Amount` dropped by the #6723 gate. The case took the first non-empty header set, so on a slow runner it read that render and failed with `expected [ 'Id', 'Opportunity Name' ] to not include 'Id'` (PR #37948, jobs 140512339260 and 140529997984). The case now waits until the headers equal the object-schema set, `['Opportunity Name']`, before it asserts. The three assertions after the wait (`toContain('Opportunity Name')`, `not.toContain('Amount')`, `not.toContain('Id')`) are unchanged. No other case changes; the CONTROL case's `toContain('Amount')` stays as it is. No source file changes. The file is not published (test-only), so `skip-changeset`. ## Tests All runs from `ui/`: `pnpm exec vitest run --maxWorkers=2 packages/plugin-list/src/__tests__/ListView.inlineFlsNoop-6723.test.tsx`, under `scripts/pm/os-verify-lock.sh`, on head `db083480` (base `origin/main` 0b539b6). | Run | Result | |:--|:--| | This head, three runs | 3/3 passed, each time | | Race forced: `getObjectSchema` delayed 300 ms, OLD case (0b539b6) | red: `expected [ 'Id', 'Opportunity Name' ] to not include 'Id'` at `:171`, the CI message exactly | | Race forced: same 300 ms delay, this head | 3/3 passed | | Ablation: `rowKeysWouldOutrankSchemaPolicy` forced to `false` (grid stays on the inline-data path), this head | red: `expected [ 'Id', 'Opportunity Name' ] to deeply equal [ 'Opportunity Name' ]` at `:165` (the new wait); the other two cases green | Both mutations went through `scripts/ablation-replace.mjs` (anchor hit 1 -> 0, blob moved, restored to the HEAD blob with `git diff HEAD` empty). `@object-ui/plugin-grid` resolves to `src` through the `ui/vitest.config.mts` alias, so the ablation needs no build. ## Acceptance notes - Seen, not fixed here (card #37972 names it out of scope): `StudioRoute.metadataArea-28561.test.tsx` red `Test UI (13/16)` once on PR #37962. Different test, no change. ## Verification Two-minute check: run the command above from `ui/`; expected `Tests 3 passed (3)`. To see the race the old case lost, delay `getObjectSchema` in the file's `makeDataSource()` by 300 ms: this head stays green. --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibwRxn1J7oT4Lx22UxZ)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent ab04434 commit 9a274e6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎ui/packages/plugin-list/src/__tests__/ListView.inlineFlsNoop-6723.test.tsx‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,14 @@ describe('ListView-hosted grid — the #6723 inline-data FLS gate is a no-op her
156156
const { container } = renderList(listSchema(), DENY_AMOUNT);
157157

158158
await waitFor(() => expect(screen.getByText('Acme expansion')).toBeInTheDocument());
159-
const headers = await waitFor(() => {
160-
const h = dataHeaders(container);
161-
expect(h.length).toBeGreaterThan(0);
162-
return h;
163-
});
159+
// The rows can paint before the object schema arrives. Until it does,
160+
// `objectSchema` is null, so the grid answers from the row keys on the
161+
// inline-data path (`Id` shown, `Amount` dropped by the #6723 gate). The
162+
// first non-empty header set is therefore NOT the mechanism under test:
163+
// wait for the object-schema set itself. A grid that stays on the
164+
// inline-data path never reaches it, so this wait is what reds that case.
165+
await waitFor(() => expect(dataHeaders(container)).toEqual(['Opportunity Name']));
166+
const headers = dataHeaders(container);
164167

165168
expect(headers).toContain('Opportunity Name');
166169
// The pre-existing object-schema gate dropped it.

0 commit comments

Comments
 (0)