Repository navigation
fix(console): the record form draws a field whose visibleWhen holds for the record, on the default form too - #35451
Conversation
… form (repro, WIP) 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>
…ly; visibleWhen is evaluated by the form where the record is bound Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…predicate on both console surfaces (WIP) Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…the published scope The field list no longer judges visibleWhen, so the pins that used it as the probe for the bound roots (current_user shape, hasCapability, features, the data root) now read resolveFieldRuleState over the scope the provider publishes. 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>
… builds a predicate bag of its own Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…t collection 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-19T10:06Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
…fault-form-visiblewhen
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-19T10:30Z
State: draft → ready + auto-merge (merge queue). #35249 closes on merge via |
Fixes #35249
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The console's record-form dialog (
AppContent,?form=) and the full-page form (RecordFormPage) built the field pool they hand the form by evaluating each object field'svisibleWhenonce, with no record bound. A total,has()-guarded predicate such as HotCRM's(has(record.stage) && record.stage == "closed_lost") || ...answers a cleanfalsewithout a record, so the field left the pool before the form saw the record. A form derived fromfieldGroupsdraws only pooled fields, so the field never appeared. An authored ModalForm section resolves without the pool and drew it. An unguardedrecord.xpredicate faults record-less and fails open, which is why plain fixtures never reproduced it.ExpressionProvider.tsx: the helperisObjectFieldVisible(field, evaluator)becomesisObjectFieldListed(field), which reads the statichiddenalone. Its docblock says where each declared key is read:hiddenat the list;visibleWhenby the form renderer (resolveFieldRuleState), against the record and the provider's predicate scope, re-evaluated as values change. The objectui#6514 ruling is unchanged:visiblestays unread,hiddenANDvisibleWhenstill compose (now across the two tiers), and a faulted predicate still fails open. The package's public exports (ExpressionProvider,evaluateVisibility) are unchanged.AppContent.tsx,RecordFormPage.tsx: the list filters useisObjectFieldListed. The per-sitecreateExpressionEvaluatorbags and their permission hooks were only feeding that filter, so they are removed. TheExpressionProvidereach site mounts is untouched.@object-ui/app-shellpatch.Tests
New pins (both surfaces, real ModalForm and real ObjectForm over the field registry, a deal object with Loss Reason / Win Reason / Loss Memo / Next Step):
fieldGroups: thehas()-guarded predicate that holds for the record draws its fieldhidden: truestays hidden although its predicate holdsform.sections) naming the field: drawn (this was the path flagged NOT MEASURED in the first round, measured below)visibleWhenfield is listed whatever its predicate answers record-less;hidden: trueis notThe plugin-form pin
fieldGroupsFieldVisibleWhen-35249.test.tsx(ObjectForm / ModalForm / DrawerForm, edit mode, full pool, plus authored-section controls) is unchanged from the first round: 6/6.Re-pointed pins. Ten existing pins used the shell's list as their probe for user/permission predicates (
hasCapability,predicateScope, the 8166 data-root floor, the mount-parity pin). They now assert the form's own verdict,resolveFieldRuleStateover the scope the provider publishes, so they still prove the same scope reaches the same predicate. The mount-site ratchet floor moves from 5 to 4 (the two imperative evaluator sites retired). The source fence now asserts neither record-form site builds a predicate bag of its own.Acceptance notes
visibleWhenreads only the user (e.g.hasCapability(...)) is now listed and hidden by the form, rather than omitted from the list. Its value stays in form state. The form's clear-on-hide is transition-only, so a scope that arrives after mount could clear a value of a field that turns hidden. That is the renderer's existing behaviour for every field it hides, not new here.visibleWhenevaluation at the list. Five cases go red; the user-predicate list case stays green under it because the mutation's bare evaluator has no user, so user predicates fault and fail open. That is the expected direction, not a hole.appObjectScope.ts,MetadataProvider.tsx, locale keys.Verification
Ablation: record-less evaluation restored at the list, 5 red, restore proven
All readings below are on head
1bc8a35e.Scoped app-shell suite (RecordFormPage*, AppContent*, providers/, plus the plugin-form pin): 103 files, 951 tests
Type-check and closure build
Derived gate families (dispatch-gates --commands), local
check:type-check-debtexited 3 on the batch run, which ran while the uiscripts/suite held the verify lock its internal closure build queues on; the standalone re-run printedVERDICT command-exit 0and0 raw tsc error(s) total.check:test-source-aliaswas red on the previous head (two edited pins reachAppContentwithout paying the@objectstack/lintload at collection); fixed in1bc8a35e, now OK.dispatch-gates --ran: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.Generated by Claude Code