Repository navigation
Commit 36d46b5
test(fields): wait for the schema-typed render in the emptyOperators and builderRows FilterConditionField tests (#35063)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
Fixes #34991
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:只改两个测试文件(`FilterConditionField.emptyOperators-10790` 与
`FilterConditionField.builderRows-8748`),让断言等到 schema 返回后的带类型渲染再执行。接续
#35055(同一张卡的第一个 PR,修了 betweenBlankBound 文件)。
- 为什么改:控件先用已保存的条件画出行,字段类型和字段标签要等异步 `getObjectSchema` 返回才生效。原测试 `findBy`
拿到第一次渲染就断言:数字框还是文本框时编辑会发出字符串 "6",字段下拉还没有标签 "Name"。慢机上与 schema 赛跑,和
#35055 是同一个队列误踢根因。
- 风险与回滚:零产品风险,不改任何发布代码;回滚即还原这两个测试文件。断言没有放宽,仍要求数字 6 和标签 Name。
- 先看:`FilterConditionField.emptyOperators-10790.test.tsx` 的
`findTypedAmountBox`;`FilterConditionField.builderRows-8748.test.tsx` 的
`waitFor` 标签等待。
- 两分钟验证:把任一文件的 `getObjectSchema` 改为延迟 300ms 返回再跑该文件,预期全部通过(修复前
emptyOperators 红 6 个、builderRows 红 1 个)。
- 需要你做的:无,席位落地。
## What changes
Follows #35055, which fixed the same render race in
`FilterConditionField.betweenBlankBound-9914.test.tsx` and lands as
`Part of #34991`. That PR's 300 ms schema-delay reproduction found two
sibling files with the same race; this PR fixes them and closes the
card.
- `FilterConditionField.emptyOperators-10790.test.tsx`: three
`findByDisplayValue('5')` sites (the four RE-SAVE cases and the two
OR-group cases) are replaced by `findTypedAmountBox()`, which waits for
the typed number box (`findByRole('spinbutton')`) and asserts
`toHaveValue(5)` before the edit. The emitted `"amount":6` assertions
are unchanged; the string `"6"` is not accepted.
- `FilterConditionField.builderRows-8748.test.tsx`: the seeded-row test
waits for the field trigger to read its label (`waitFor` on
`toHaveTextContent('Name')`) before taking the triggers. A combobox
takes no accessible name from its content, so `findByRole('combobox', {
name: 'Name' })` cannot spell it (measured: it fails even with no
delay).
No skip, retry or quarantine. Test-only, so no changeset
(`skip-changeset`).
## Tests
<details><summary>Reproduction: schema resolution delayed 300 ms, before
and after, per file</summary>
Each mutation was applied by `scripts/ablation-replace.mjs` (anchor
`getObjectSchema: async () => OBJECT_SCHEMA,` hit once) and restored to
the HEAD blob with `git diff HEAD` empty. Leg A uses the file as on base
743308b; leg B uses 52bace8.
| File | Leg A, base plus delay | Leg B, fix plus delay |
|---|---|---|
| emptyOperators-10790 | Tests 6 failed, 30 passed (36) | Tests 36
passed (36) |
| builderRows-8748 | Tests 1 failed, 3 passed (4) | Tests 4 passed (4) |
</details>
<details><summary>Neighbours and package at 52bace8</summary>
- The six `FilterConditionField*` files: `Test Files 6 passed (6)`,
`Tests 128 passed (128)`.
- The `@object-ui/fields` package (run under os-verify-lock): `Test
Files 307 passed | 1 skipped (308)`, `Tests 4651 passed | 7 skipped
(4658)`, VERDICT command-exit 0.
</details>
## Acceptance notes
- The untyped emit before the schema answers is a widget question and is
out of scope here. It is being carded separately.
- Type check of the test project and the full UI suite are left to CI
(`Type Check UI`, `Test UI`).
## Verification
<details><summary>Derived gate families (dispatch-gates --commands, 27
commands)</summary>
All 27 commands exit 0 at 52bace8, including `pnpm --dir ui exec
vitest run scripts/`: `Test Files 171 passed | 2 skipped (173)`, `Tests
5077 passed | 2 skipped (5079)`. `dispatch-gates --ran`: 27 derived, 27
run, 0 NOT-MEASURED, a derived zero. overlap-check: VERDICT clean exit
0.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz)_
Governing claim for this branch: 6965814231 on #34991.
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi3ezPzTysQPDEjmVz -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6328877 commit 36d46b5
2 files changed
Lines changed: 24 additions & 4 deletions
File tree
- ui/packages/fields/src/widgets/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
| |||
262 | 276 | | |
263 | 277 | | |
264 | 278 | | |
265 | | - | |
| 279 | + | |
266 | 280 | | |
267 | 281 | | |
268 | 282 | | |
| |||
315 | 329 | | |
316 | 330 | | |
317 | 331 | | |
318 | | - | |
| 332 | + | |
319 | 333 | | |
320 | 334 | | |
321 | 335 | | |
| |||
326 | 340 | | |
327 | 341 | | |
328 | 342 | | |
329 | | - | |
| 343 | + | |
330 | 344 | | |
331 | 345 | | |
332 | 346 | | |
| |||
0 commit comments