Repository navigation
fix(fields): a lookupFilters { $record } path through or to a multi-valued field is left out with a dev warning - #34618
Conversation
…alued field is left out with a dev warning A hop through a multiple: true lookup was dropped unsaid, and a plain path to a multi-valued field sent its list as a scalar comparand. Both now leave the entry out and warn once per path in a development build, the spec's rule that such a path has no single value. Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC Co-authored-by: Claude <noreply@anthropic.com>
…ord } path Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC Co-authored-by: Claude <noreply@anthropic.com>
…okup-multi-valued-path
|
repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC Final head for L1 · 2026-11-17T03:55Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs 席位核对L1 first review: ACCEPT · PR #34618 · card #34389 · area o2-B · L1-a2 · 2026-11-17T03:56Z Head-sha: Final-head comment 6937758551; dev report 6937737132. Checklist
L2 and landing
|
|
repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC Landing · 2026-11-17T03:57Z
State change: ready for review + auto-merge, by area o2-B. #34389 closes through |
Requested by Steve · project thread
Fixes #34389
Clause-②: no
Metadata-protocol: none
维护者速读
lookupFilters里{ $record }路径经过或指向多值字段(多选关联、tags、关联行上的多值字段)时,不再把列表当标量发出,也不再静默丢弃;该条过滤一律不发,并在开发构建里告警一次,点名路径和多值字段。$record路径的选择器(lint 本就拒收这种写法);单值路径、字面条目、dependsOn 行为不变。回滚即撤销本 PR。ui/packages/fields/src/widgets/lookupRecordReference.ts的readRecordPath三处Array.isArray守卫与warnMultiValuedPath;再看测试文件新增的 describe。pnpm --filter @object-ui/fields exec vitest run --root ../.. packages/fields/src/widgets/LookupField.recordReference-34197.test.tsx -t multi-valued,预期 4 个用例全绿(三种形状 + CONTROL)。What changes
readRecordPath(the picker's reader for alookupFilters{ $record }path) now treats a list found anywhere on the path as a multi-valued path:tags) — before: sent with the whole list as the comparand of a scalar operator;multiple: truelookup (accounts.cb_market) — before: left out silently (referencedIdfinds no id in a list, so neither a read nor the unreadable-hop warning happened);account.markets) — before: sent as a list.In all three the entry is left out of the candidate query and a development build warns once per path, through the file's existing dev-warning channel (now
warnLeftOut, shared with the unreadable-hop warning; production builds stay silent as before). The warning names the path, says it is multi-valued and names where the list sits (the field, or the lookup that holds a list of records).The spec half (merged on main) says in
LookupFilterRecordReferenceSchema's describe that such a path "has no single value: it is not resolved"; the picker now does exactly that. Nopackages/spec/**change.Tests
New
describein the existing harnessui/packages/fields/src/widgets/LookupField.recordReference-34197.test.tsx(one shared harness per component): one case per shape (entry left out of the candidate query, warning given naming the path and the field) and a CONTROL (a single-valued field path and a single-valued one-hop path still resolve, no[LookupField]warning). No existing test was changed.Package run, type-check and ablations (fix head 2a3ed4f; after the main merge to bc61296121 the card test file re-ran 16/16 on a rebuilt spec)
pnpm --filter '@object-ui/fields^...' build(dependency closure, under the verify lock): VERDICT command-exit 0.@object-ui/fieldspnpm run type-check(tsc --noEmit && tsc -p tsconfig.test.json; the test file is in the test program, counted with--listFiles): VERDICT command-exit 0.@object-ui/fieldspnpm test: Test Files 307 passed, 1 skipped (308); Tests 4649 passed, 7 skipped (4656); VERDICT command-exit 0.scripts/ablation-replace.mjs(fix committed first; each guard disabled alone asif (false && Array.isArray(...)), anchor 1 -> 0 on disk, restore proven blob == HEAD andgit diff HEADempty). The test imports./LookupFieldfrom source, so no dist is involved:Acceptance notes
isMultiValueField). The widget has no field map for the hop's target object, so a value read is the one signal available for all three shapes. Consequence: a multi-valued field that is currently null or unset is left out as an empty value without the multi-valued warning (the entry is still left out;os lintrefuses the path at authoring time). An empty list[]now warns as multi-valued instead of being left out silently as empty.Verification
Dispatch-gate derivation (
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack) run on the final head; every derived command run locally and reconciled with--ran. Families CI owns are read from this PR's check-runs.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC