Skip to content

fix(fields): hold the filter-condition builder until the object schema answers - #35392

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-35057-filter-number-bound-typed
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-35057-filter-number-bound-typed

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35057

Clause-②: no
Metadata-protocol: none

维护者速读

  1. 用户能看到什么变化:管理员在共享规则里编辑已保存的筛选条件时,字段类型读回来之前,条件编辑器会短暂置灰、不接受输入;读回后照常可编辑,输入的数字按数字保存,不再存成文本。
  2. 为什么做:控制台操作体验一系列卡片中的一张;之前的测试修复发现,类型读得慢时,提前输入的数字会被存成文本。
  3. 出错会怎样:最坏情况是编辑器一直置灰、改不了条件(读取失败或宿主不提供字段类型时不会置灰);回滚这一个提交即可恢复。
  4. 要你做什么:无,席位落地。

What changes

ui/packages/fields/src/widgets/FilterConditionField.tsx (the filter-condition widget behind sys_sharing_rule.criteria_json):

  • The schema answer is keyed by the object it answers for, so a render that names a new object never reads the previous object's field types.
  • schemaPending = the host offers getObjectSchema and it has not answered for this object yet. While it holds, the builder sits in a fieldset disabled with aria-busy, and handleBuilderChange emits nothing.
  • A failed read settles to an empty field list and releases the builder. A host with no getObjectSchema never holds it. Raw-JSON mode is not held.

Route chosen: hold, not retype on arrival. Retyping would have to survive the widget's re-seed effect, which replaces the rows whenever what they emit differs from the stored value, so a held-then-retyped edit would be wiped by that effect.

The reading (os-dev-report 7002349726)

Rows amount 5, 6, 12, 30, 100, a number field, through the real ObjectQL engine and SqlDriver. Each cell is the amounts returned.

comparand number raw driver, "6" engine where, "6" engine filter, "6"
$eq / implicit [6] [6] [6] [6]
$gt [12,30,100] same same same
$lte [5,6] same same same
$gte+$lte 6..30 [6,12,30] same same same
$in [6,12] [6,12] same same same

SQLite (better-sqlite3) and PostgreSQL 16.15 gave identical results. No stored filter compares wrongly, and the card stays p2. The engine's number-comparand declared-type door already narrows a numeric string to its number before any driver. This PR removes the race at the producer.

Tests

New pin FilterConditionField.schemaPendingHold-35057.test.tsx (6 cases):

  • A held getObjectSchema, for implicit equality, $gt and $lte: the stored row's box is disabled, and a change fired at it emits nothing. After the answer, typing 6 emits the number ({"amount":{"$gt":6}}).
  • CONTROL: when the schema answers first, the same number is emitted straight away.
  • Bounds of the hold: a failed read releases the builder, and a host without getObjectSchema never holds it. Both of these still emit the typed text, because no type is known.
Readings

All readings below were taken on the working tree that was then committed unchanged as 53cd5c9d (component blob ace20001), on base 8b550f81. The reverse verification ran before the commit, so its restore was proven by hash rather than by checking out HEAD.

  • Pin: pnpm --dir ui exec vitest run packages/fields/src/widgets/__tests__/FilterConditionField.schemaPendingHold-35057.test.tsx: Tests 6 passed.
  • Reverse verification, component file swapped back to base 8b550f81 and then restored (hash ace20001 checked after restore): 4 failed, 2 passed. The three held cases failed with "Received element is not disabled", and so did the failed-read release case, whose pre-answer leg asserts the hold. The two controls passed. This is the predicted direction.
  • pnpm --dir ui exec vitest run packages/fields/src/widgets/ on the final tree: Test Files 147 passed (147), Tests 1437 passed (1437).
  • pnpm --filter @object-ui/fields run type-check: 0 error TS.
  • Derived gates (dispatch-gates --commands): 38 derived, 38 run, every one exit 0. That includes pnpm --dir ui exec vitest run scripts/ (Test Files 171 passed, 2 skipped).

Acceptance notes

  • The app-shell FilterConditionField (dataset / related-list filters) has no such window, read at source: it mounts the builder only once the caller's typed field list is non-empty.
  • A criteria already stored with a string bound is not rewritten. The server reads it as the number it spells.

Generated by Claude Code

…a answers

A number bound typed into a stored row before getObjectSchema answered was
emitted as the string in the untyped text box, and the schema's arrival never
retyped it. The builder now takes no edit while the schema read is in flight;
a failed read or a host without getObjectSchema does not hold it.

Claude-Session: https://claude.ai/code/session_01Utp6CajiB6BSQKWowy6YLB
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Final head for review · area data-2 · 2026-11-19T08:20Z
Head: 53cd5c9d27a50ca3c4603e009e67a959a9532e67 — all check runs on it concluded: 44 success, 13 skipped, 0 failed (UI path: Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Test UI shards green).
Fixes #35057 · Clause-②: no · Metadata-protocol: none · +196/−12 over 3 files · K = 5.
Review route: L1-a thread. Landing after its ACCEPT, by the area.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:在共享规则里编辑筛选条件时,打开后的一瞬间(字段信息还没加载完)条件编辑器会先变灰,加载完才能改。
  • 为什么做:以前在加载完之前输入数字,会被存成文字(比如 "6" 而不是 6);规则匹配结果没变,但存下来的内容取决于手快手慢。
  • 出错会怎样:最坏情况是又能在加载完之前输入,和修之前一样。加载失败时编辑器照常可用,直接编辑原始内容的方式不受影响,已保存的条件也不会被改写。
  • 要你做什么:不需要你做任何事,区域审完自己落地。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 53cd5c9d27a50ca3c4603e009e67a959a9532e67 · 2026-11-19T08:23Z

  • 形态 — 3 files, +196/−12: ui/packages/fields/src/widgets/FilterConditionField.tsx, a new card-named pin and one changeset. Base 8b550f81, K=5. check-governed-merges.mjs --pr 35392: not governed, under the 3000-line limit. Clause-②: no, Metadata-protocol: none. The claim is amended to name the client file.

  • Fixes vs card reading first: FilterConditionField emits a number bound untyped ("amount":"6") when the user types before getObjectSchema answers — a saved filter may store a string comparand on a number column #35057 — what the change does:

    • The schema answer is now stored keyed by the object it answers for (schemaAnswer.object), so a render that names a new object never reads the previous object's types.
    • schemaPending = canReadSchema && fields === null.
    • While pending, the FilterBuilder sits in a <fieldset disabled aria-busy> and handleBuilderChange returns early. That is a backstop for anything that would still emit, a mount-time normalisation included.
    • Bounds: a failed read settles to [] and releases the hold, as before. A host with no getObjectSchema never holds. Raw-JSON mode is never held.

    The server door already narrows numeric strings (relay note), so no stored rule matched differently. The defect was document instability, and the changeset says so.

  • Changeset — @object-ui/fields patch, read sentence by sentence against the diff. Each statement matches the code:

    • the "6" versus 6 example;
    • the box that changed type after the fact;
    • "changed no rule's matches";
    • disabled while in flight, and emitting nothing;
    • released on failure;
    • no hold without a schema request;
    • raw JSON not held;
    • nothing rewritten.
  • Pins — new FilterConditionField.schemaPendingHold-35057.test.tsx:

    • it.each: with the schema not yet answered, the builder is disabled and emits nothing, then emits the number once answered.
    • CONTROL: a schema that answers first emits the number straight away.
    • A failed read releases the builder.
    • A host with no getObjectSchema never holds it.
  • 门禁 — 57 check-runs on this head: 44 success, 13 skipped, 0 failure.

  • 接受的偏差 — none.

  • 范围外去向 — none found.

  • 落地条款 — not governed: data-2 lands this head after this ACCEPT. A new push needs a fresh L1 only if it changes more than a main merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CajiB6BSQKWowy6YLB

Landing · area data-2 · 2026-11-19T08:23Z

reading value
L1-a ACCEPT comment 7003766118 at 53cd5c9d27a50ca3c4603e009e67a959a9532e67 (= current head); no conditions, no accepted deviations
L2 not owed (Clause-②: no, Metadata-protocol: none)
CI on head 44 success, 13 skipped, 0 failed
check-governed-merges --pr 35392 NOT governed, 0 of 3 paths; +196/−12 ≤ 3000; K = 5; no locale file changed on main since merge base

State: draft → ready + auto-merge (merge queue). #35057 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 08:24
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a9b36ef Nov 19, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35057-filter-number-bound-typed branch November 19, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants