Repository navigation
Commit d4661df
test(fields): wait for the schema-typed range bound before asserting its number value (#35055)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
Part of #34991
The card stays open: two sibling test files with the same race
(`FilterConditionField.emptyOperators-10790`,
`FilterConditionField.builderRows-8748`) follow in a second PR under it
(seat order 2026-11-18 00:31Z, claim amendment 6965218495).
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:只改一个测试文件。两个“已保存的数值区间”用例改为等待带类型的数字输入框(`spinbutton` 角色)出现后再断言
`toHaveValue(5)` / `toHaveValue(1)`。
- 为什么改:控件先用已保存的值画出区间行,`age` 的 number 类型要等异步的 `getObjectSchema`
返回才生效;在那之前框是文本框,值是字符串 "5"。原测试 `findByLabelText` 拿到第一个框就断言,在慢机上与 schema
赛跑,队列构建 44173515593 因此误踢 PR #34955。
- 风险与回滚:零产品风险,不改任何发布代码;回滚即还原这一个测试文件。断言没有放宽,仍要求数字 5。
-
先看:`ui/packages/fields/src/widgets/__tests__/FilterConditionField.betweenBlankBound-9914.test.tsx`
的 `findTypedBound` 及两处调用。
- 两分钟验证:把该文件的 `getObjectSchema` 改成延迟 300ms 返回后跑 `pnpm --filter
@object-ui/fields exec vitest run --root ../..
packages/fields/src/widgets/__tests__/FilterConditionField.betweenBlankBound-9914.test.tsx`,预期
14/14 通过(修复前同样改动会在 :174 报 `5 (string)`)。
- 需要你做的:无,席位落地。
## What changes
The stored-criteria `between` tests asserted a typed value straight
after `findByLabelText`. `FilterConditionField` seeds the row from the
stored value at once, but `age` is typed `number` only when the async
`getObjectSchema` answers; until then `FilterBuilder` draws the bound as
a text box holding `"5"`. The test now waits for the typed box itself
(`findByRole('spinbutton', { name })`), via one helper `findTypedBound`,
in both tests of this file that had the race (`:174` `To`, and `:198`
`From` in the blank-bound migration test).
No skip, no retry, no quarantine; `toHaveValue(5)` and `toHaveValue(1)`
are unchanged.
Widget reading: after the schema lands the bound IS a number input
showing the number, so no product change and no changeset. The untyped
text box exists only in the window before the schema answers (see
Acceptance notes).
## Tests
<details><summary>Reproduction: schema resolution delayed 300 ms (fails
before, passes after)</summary>
Mutation landed with `scripts/ablation-replace.mjs` (anchor hit 1, blob
changed, restored to HEAD blob, `git diff HEAD` empty), on the test-only
anchor `getObjectSchema: async () => OBJECT_SCHEMA` replaced by a 300 ms
`setTimeout` promise.
- Leg A, test as on base 4443014 plus delay: `Tests 2 failed | 12
passed (14)`. `:174 expect(element).toHaveValue(5)` Expected `5
(number)`, Received `5 (string)`, the queue signature exactly; and `:198
toHaveValue(1)` Received `1 (string)`.
- Leg B, test at 6dffff8 plus delay: `Test Files 1 passed (1)`, `Tests
14 passed (14)`.
</details>
<details><summary>Package and neighbours at 6dffff8</summary>
- `@object-ui/fields` package (`vitest run --root ../..
packages/fields/`, under os-verify-lock): `Test Files 307 passed | 1
skipped (308)`, `Tests 4651 passed | 7 skipped (4658)`, VERDICT
command-exit 0.
- The six `FilterConditionField*` files: `Test Files 6 passed (6)`,
`Tests 128 passed (128)`.
</details>
## Acceptance notes
- Same race, other file, not changed here (scope is this file): with the
same 300 ms delay, `FilterConditionField.emptyOperators-10790.test.tsx`
fails 6 tests (`findByDisplayValue('5')` then an edit expects
`"amount":6`, receives `"amount":"6"`), and
`FilterConditionField.builderRows-8748.test.tsx` fails 1
(`findAllByRole('combobox')` then `toHaveTextContent('Name')`, receives
empty). Both are latent copies of this flake.
- Widget behaviour in the pre-schema window: an edit typed into a number
bound before `getObjectSchema` answers is emitted untyped (the
emptyOperators probe above emits `"amount":"6"`). Measured only through
the unit harness; not reached through a running app.
- Type check of the test project (`type-check`) and the full UI farm are
left to CI (`Type Check UI`, `Test UI`).
## Verification
<details><summary>Derived gate families (dispatch-gates --commands, 27
commands)</summary>
All 26 non-vitest commands exit 0 at 6dffff8 (one
`check:type-check-debt` first run exited 3 while queued behind a held
lock; rerun exit 0, `0 raw tsc error(s) total`). `pnpm --dir ui exec
vitest run scripts/` (under os-verify-lock): `Test Files 171 passed | 2
skipped (173)`, `Tests 5077 passed | 2 skipped (5079)`, VERDICT
command-exit 0. `dispatch-gates --ran`: 27 derived, 27 run, 0
NOT-MEASURED (a derived zero, every line carries its exit code).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi3ezPzTysQPDEjmVz -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent b7edbeb commit d4661df
1 file changed
Lines changed: 19 additions & 3 deletions
File tree
- ui/packages/fields/src/widgets/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
| |||
170 | 182 | | |
171 | 183 | | |
172 | 184 | | |
173 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
174 | 190 | | |
175 | 191 | | |
176 | 192 | | |
| |||
194 | 210 | | |
195 | 211 | | |
196 | 212 | | |
197 | | - | |
198 | | - | |
| 213 | + | |
| 214 | + | |
199 | 215 | | |
200 | 216 | | |
201 | 217 | | |
| |||
0 commit comments