Repository navigation
fix(plugin-detail): the record page hides a field whose own visibleWhen is false - #35421
Conversation
…ge (repro) Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…n is false The default record page drew a field whose object-level visibleWhen is false for the record. record:details now judges each drawn field's visibleWhen with the form's own call (resolveFieldRuleState: fail-open on a fault, ADR-0137 D3), over the record, previous and host scope the group gate already uses. Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…le-dedupe ladder Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Final head for review · area ux-2 · 2026-11-19T09:03Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-19T09:05Z
State: draft → ready + auto-merge (merge queue). #35314 closes on merge via |
Fixes #35314
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/plugin-detail/src/renderers/record-details.tsx中新增的fieldPredicateVisible与dropPredicateHidden两处;其次同目录__tests__/record-details.fieldVisibleWhen-35314.test.tsx的对照矩阵。pnpm --dir ui exec vitest run packages/plugin-detail/src/renderers/__tests__/record-details.fieldVisibleWhen-35314.test.tsx,预期 19 项全绿,其中每一行都同时断言表单与详情页的结论。What changes
record:detailsnow honours a field's own object-levelvisibleWhen(Field.visibleWhen: "field is shown only when TRUE (else hidden)") on every field it draws. Before, it evaluated a field GROUP'svisibleWhen(the{ group }reference) and no field's, so the synthesized default record page drew a field whose predicate is false for the record, label and value.record:details(fields: dropHidden(normaliseList(filterList(s.fields)))) and the flat-body fold (filteredFields) applied field security, the label ladder and the header dedupe, and never read the object's fieldvisibleWhen;DetailSectiondraws whatever it is handed. The group derivation (deriveFieldGroupDetailEntries/toField) does not carry the field predicate either, so neither layer saw it.dropPredicateHidden, applied last to both lists. It reads the predicate off the object's field declaration by name and judges it withfieldPredicateVisible, which callsresolveFieldRuleStatefrom@object-ui/core: the call the form renderer makes for a field'svisibleWhen. So the fault direction is the field rule's (VISIBLE_WHEN_FAULTED, ADR-0137 D3): a predicate that cannot be evaluated SHOWS the field and warns once. That is the opposite of the group gate (fail-closed), on purpose; each slot keeps the direction the form gives it.sectionPredicateRecord(every declared field seedednull, relations collapsed to their stored id) bound asrecordandprevious, plususePredicateScope(). The lazily assembled record is now shared by both gates (predicateRecord()), so a body with no predicate does no extra work.record:detailsdraws, because the renderer cannot tell the default page's enumerated sections from an authored page's: app-shell's running default page sends the ungrouped bucket, and the whole body of an object with nofieldGroups, as enumerated sections of the same shape an authored page writes. One guard closes the class instead of a default-page-only branch.Tests
New
ui/packages/plugin-detail/src/renderers/__tests__/record-details.fieldVisibleWhen-35314.test.tsx(19 tests):record:details(the synthesized default page) AND through the entry form renderer with the field carrying the same predicate, and asserts{ form, detail }against the expected verdict: envelope and bare-string spellings, no predicate, three fault shapes (unbound bare identifier, parse error, unknown field: drawn, fail-open), a declared-but-absent column (null seed), a relation bound as its id,previous, and the hostcurrent_userscope.fieldGroups); authored enumerated sections; authored flatfieldslist.Harness guards: each render first finds an ungated anchor value and throws
HARNESS DEADotherwise, so an empty body cannot pass a hidden leg.Reverse verification: the pin against the BASE renderer (red), then restored
record-details.tsxrestored from the base commit withgit restore --source=BASE, the pin run, the file restored withgit checkout HEAD --in an EXIT trap. Mutation proof:resolveFieldRuleStatecount in the file = 0.The 5 that stay green on the base are the controls that must: no predicate, the three fail-open fault cases (drawn on both rows, which is also what the base did), and the predicate-holds control. Restore proof:
git diff HEADempty,git status --porcelainempty,git hash-objectof the file equals the HEAD blob.Package suite and type-check at head 43ff1a5
The group-gate pin
record-details.groupVisibleWhen-11630.test.tsx(13 tests) is in that suite and stays green: an authored or synthesized{ group }section's own gate is unchanged.Acceptance notes
record:detailssection (or flatfieldslist) naming a field whosevisibleWhenis false also drew it (measured red above). The guard closes that in the same fold, under the bounded in-place rule: same defect class, mechanical, same file, no new gate surface. Nothing changes for a field with no predicate, a field whose predicate holds, or a{ group }section's own gate.stageinline reveals a gated field after save, not while typing.record:highlights(the header strip) and thedetail-viewnode / record drawer do not read a field'svisibleWheneither. Not measured as reachable defects in this run; noted, not filed.showcase_invoice.paid_on(visibleWhen: record.status == 'paid', object with nofieldGroups) is the in-repo fixture of this shape; its body is the "object with no fieldGroups" leg above. A live browser run was not made (no built console bundle in this container).inputstext forrecord:details(and the generated reference page) says nothing false after this change, so it is not edited here.Verification
Derived local gate families (
node scripts/pm/dispatch-gates.mjs --commands, 38 commands) run, each with its exit code captured before any pipe; all 38 exit 0. Reconciliation with--ran: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN. Every other family is CI's; see this PR's check runs.Generated by Claude Code