Repository navigation
fix(core): harvest the CEL optional record.?x spelling into the view projection - #29480
Merged
Merged
Conversation
…projection collectPredicateFieldRefs read only record.x / data.x, so a predicate written with the CEL optional selector left its operand out of $select. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTLzhrs8dyC8QCdCKg
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T16:25ZHead-sha:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #29409
Clause-②: no
Metadata-protocol: none
The two lines are copied from the claim (comment 6581111452).
维护者速读
$select(字段采集)。采集正则原先只认record.x/data.x,现在也认 CEL 可选字段写法record.?x/data.?x。record.?status.orValue('')时,status不进投影,行上永远没有这个键,按钮按"字段为空"处理,没有任何迹象指向投影。record.?单独出现、record.?.x、JS 写法record?.x仍不采集(测试钉住)。回滚即撤销本 PR。ui/packages/core/src/utils/predicate-fields.ts的RECORD_REF;测试predicate-fields.test.ts新增的 7 个用例。pnpm --dir ui exec vitest run packages/core/src/utils/__tests__/predicate-fields.test.ts,预期 39 个用例通过(正则还原为 main 时其中 5 个转红)。What changes
RECORD_REF(@object-ui/core,utils/predicate-fields.ts), the one regex behindcollectPredicateFieldRefs, accepts an optional?between the record dot and the field name, so the CEL optional-field selectorrecord.?x/data.?xis harvested as the fieldx, beside the plain spelling. Every harvest consumer (the grid row load, the list view, the related list) reads through this function, so all of them pick it up with no change of their own.$selectonly when the object declares it or it is a platform column, and only when the principal may read it. A selector that names no field (record.?alone,record.?.x,record.?1x), a longer identifier ending inrecordand the JavaScript spellingrecord?.xcontribute nothing.Tests
ui/packages/core/src/utils/__tests__/predicate-fields.test.ts, seven new cases:record.?xanddata.?xare harvested; an optional selector inside the{ dialect, source }envelope is harvested; the optional and plain spellings of one field dedupe in first-seen order.listViewPredicates: an optional operand on a row actionvisible, an object actiondisabledand a CRUDvisibleWhenoverride is harvested.record.? == null,record.?.status,data.?1st,myrecord.?statusandrecord?.statusharvest nothing.RECORD_REFrestored to the main spelling (throughscripts/ablation-replace.mjs; anchor 1 to 0, restored to the HEAD blob,git diff HEADempty), the five positive optional-selector cases go red and the 34 others stay green.Acceptance notes
$select: each fetches whole rows (the board's query and its lane-paging params, the calendar's range query and its record-anchor query, the gantt's ceiling query carry filter, order, limit, expand and search only), so a predicate operand already arrives unless field-level security strips it server-side. None of the three renders row or card actions withvisible/disabledpredicates either (no action-predicate evaluation in their sources). No view file is edited.record.xinside a CEL string literal today, and this PR keeps that for the optional spelling too: the file's own rule is that an extra declared column costs bytes while a missing one fails the predicate closed, and masking literals would under-harvest on an unbalanced quote.record['x']and the optional indexrecord[?'x']are not harvested, as before; not in this card's scope.Verification
Head
5e043f9a. The fix is commit592019e4(based onorigin/main5f7d554c);5e043f9amergesorigin/maincafe8ee6(none of this PR's files and nothing underui/packages/core/changed; clean). The branch's delta againstmainis the three files above. Readings name their head; the final head's are CI's check-runs.Tests
592019e4:pnpm --dir ui exec vitest run packages/core/at--maxWorkers=2under the verification lock: 232 files passed, 4294 tests passed, 27 skipped.592019e4:turbo run type-check --filter=@object-ui/core(tsc --noEmitand the test tsconfig): 4 of 4 tasks successful.5e043f9a:packages/core/src/utils/(113 files, the touched test included): 113 passed, 2001 tests passed.Gates
592019e4:node scripts/pm/dispatch-gates.mjs --commandsderived 34 families for this diff; all 34 ran with exit 0,pnpm --dir ui exec vitest run scripts/among them (169 files passed, 2 skipped; 4921 tests passed).--ranreconciled 34 derived, 34 run, 0 NOT-MEASURED.node scripts/check-sdui-manifest.mjs: exit 0 (no registry change).pnpm check:new-line-citations(underui/): 0 new citations.Generated by Claude Code