Skip to content

fix(console): the record form draws a field whose visibleWhen holds for the record, on the default form too - #35451

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-35249-default-form-visiblewhen
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-35249-default-form-visiblewhen

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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's visibleWhen once, with no record bound. A total, has()-guarded predicate such as HotCRM's (has(record.stage) && record.stage == "closed_lost") || ... answers a clean false without a record, so the field left the pool before the form saw the record. A form derived from fieldGroups draws only pooled fields, so the field never appeared. An authored ModalForm section resolves without the pool and drew it. An unguarded record.x predicate faults record-less and fails open, which is why plain fixtures never reproduced it.

  • ExpressionProvider.tsx: the helper isObjectFieldVisible(field, evaluator) becomes isObjectFieldListed(field), which reads the static hidden alone. Its docblock says where each declared key is read: hidden at the list; visibleWhen by the form renderer (resolveFieldRuleState), against the record and the provider's predicate scope, re-evaluated as values change. The objectui#6514 ruling is unchanged: visible stays unread, hidden AND visibleWhen still 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 use isObjectFieldListed. The per-site createExpressionEvaluator bags and their permission hooks were only feeding that filter, so they are removed. The ExpressionProvider each site mounts is untouched.
  • Changeset: @object-ui/app-shell patch.

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):

  • edit, form laid out from fieldGroups: the has()-guarded predicate that holds for the record draws its field
  • CONTROL: the predicate that answers false for this record hides its field
  • CONTROL: hidden: true stays hidden although its predicate holds
  • CONTROL: a field with no predicate is drawn
  • RecordFormPage, authored form view (form.sections) naming the field: drawn (this was the path flagged NOT MEASURED in the first round, measured below)
  • create: a predicate that needs the record does not throw, logs no fault, answers a clean false (field hidden, the renderer's posture), and the create submit goes through with only the filled values
  • the list itself: a visibleWhen field is listed whatever its predicate answers record-less; hidden: true is not

The 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, resolveFieldRuleState over 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

  • Item 4, RecordFormPage authored sections, measured. ObjectForm's authored sections are bounded by the pool (the objectui#9884 intersection), so with the record-less gate an authored section on the full page dropped the guarded field too. Under the ablation below that case goes red; with the fix it is drawn. On the dialog the authored path was never affected (ModalForm resolves authored sections without the pool).
  • User-gated fields move tiers. A field whose visibleWhen reads 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.
  • Ablation direction. The mutation restores a record-less visibleWhen evaluation 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.
  • Not changed: spec, plugin-form source, the form renderer, appObjectScope.ts, MetadataProvider.tsx, locale keys.

Verification

Ablation: record-less evaluation restored at the list, 5 red, restore proven
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 7f05fccbf6b3 -> 4d3e9eb725ba
     × lists a field whose `visibleWhen` reads the record, whatever the predicate answers without one   (RecordFormPage)
     × edit, form laid out from `fieldGroups`: the predicate that holds draws its field                 (RecordFormPage)
     × edit, authored form view: a section naming the field draws it too                               (RecordFormPage)
     × lists a field whose `visibleWhen` reads the record, whatever the predicate answers without one   (AppContent)
     × edit, dialog laid out from `fieldGroups`: the predicate that holds draws its field               (AppContent)
 Test Files  2 failed (2)
      Tests  5 failed | 14 passed (19)
ablation-replace: ok restored: blob == HEAD (7f05fccbf6b3) and `git diff HEAD` is empty

All readings below are on head 1bc8a35e.

Scoped app-shell suite (RecordFormPage*, AppContent*, providers/, plus the plugin-form pin): 103 files, 951 tests
 Test Files  103 passed (103)
      Tests  951 passed (951)
os-verify-lock: VERDICT command-exit 0 · held the lock 223s (3m43s) · waited 119s (1m59s)
Type-check and closure build
pnpm --filter '@object-ui/app-shell^...' build        -> os-verify-lock: VERDICT command-exit 0
pnpm --filter @object-ui/app-shell run type-check     -> EXIT=0 (head 1bc8a35e; run outside the lock after two 540s
                                                         queue-timeouts behind a sibling's 19-minute hold, declared narrowing)
Derived gate families (dispatch-gates --commands), local
EXIT=0  node scripts/check-adr-0087-registration.mjs --base origin/main
EXIT=0  node scripts/check-adr-0087-registration.mjs --self-test
EXIT=0  node scripts/check-changeset-no-major.mjs --base origin/main
EXIT=0  node scripts/check-closing-keyword-parity.mjs
EXIT=0  node scripts/check-closing-keyword-parity.mjs --self-test
EXIT=0  node scripts/check-comment-mask-corpus.mjs
EXIT=0  node scripts/check-empty-changeset.mjs --base origin/main
EXIT=0  node scripts/check-empty-changeset.mjs --self-test
EXIT=0  node scripts/check-sdui-manifest.mjs
EXIT=0  node scripts/check-sdui-manifest.mjs --self-test
EXIT=0  node scripts/ci/snapshot-next.mjs --self-test
EXIT=0  node scripts/pm/check-governed-queue-guard.mjs --self-test
EXIT=0  node scripts/pm/release-rehearsal-clone.mjs --self-test
EXIT=0  node scripts/release-pending-publish.mjs --self-test
EXIT=0  pnpm --filter @objectstack/spec run check:duration-unit-keys
EXIT=0  pnpm check:adr-anchors
EXIT=0  pnpm check:changeset-gate-self-tests
EXIT=0  pnpm check:closed-ceremony-text
EXIT=0  pnpm check:cross-package-test-inputs
EXIT=0  pnpm check:dispatcher-error-vocabulary
EXIT=0  pnpm check:driver-memory-census
EXIT=0  pnpm check:engine-double-contract
EXIT=0  pnpm check:gitlink-declared
EXIT=0  pnpm check:nul-bytes
EXIT=0  pnpm check:published-files
EXIT=0  pnpm check:query-options-erasure
EXIT=0  pnpm check:refd-timer-probe
EXIT=0  pnpm check:registry-log-declared
EXIT=0  pnpm check:rest-log-spy-declared
EXIT=0  pnpm check:skill-identifier-liveness
EXIT=0  pnpm check:test-source-alias
EXIT=0  pnpm check:tier-file-adoption
EXIT=0  pnpm check:type-check-coverage
EXIT=3, re-run EXIT=0  pnpm check:type-check-debt
EXIT=0  pnpm check:undeclared-dep-imports
EXIT=0  pnpm check:watch-hint-literal
EXIT=0  pnpm check:where-matcher
EXIT=0  pnpm --dir ui exec vitest run scripts/   (Test Files 171 passed | 2 skipped; Tests 5092 passed | 2 skipped; lock VERDICT command-exit 0)

check:type-check-debt exited 3 on the batch run, which ran while the ui scripts/ suite held the verify lock its internal closure build queues on; the standalone re-run printed VERDICT command-exit 0 and 0 raw tsc error(s) total. check:test-source-alias was red on the previous head (two edited pins reach AppContent without paying the @objectstack/lint load at collection); fixed in 1bc8a35e, now OK. dispatch-gates --ran: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.


Generated by Claude Code

… form (repro, WIP)

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>
… builds a predicate bag of its own

Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests 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_01Utp6CZrgaiMgTJCnswR6jQ

Final head for review · area ux-2 · 2026-11-19T10:06Z
Head: 1bc8a35e9e00bd3951ac0bd03d9960668ded1f26. All check runs on it concluded: 40 success, 13 skipped, 0 failed (the PR-side subset).
Fixes #35249 · route A of the re-scoped claim · Clause-②: no (no export, prop or spec change; the public index still exports only ExpressionProvider and evaluateVisibility) · Metadata-protocol: none · +713/−316 over 15 files. Not governed (0 of 15).
Review route: L1-a thread. The area lands it after the ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:表单里设置了“满足条件才显示”的字段,现在条件满足就会显示,比如赢单失败的商机会出现“丢单原因”。编辑过程中条件变成满足时,字段也会马上出现。
  • 为什么做:默认表单在还没拿到记录时就先判断了一次条件,结果这类字段被提前去掉,永远显示不出来。
  • 出错会怎样:最坏是某个字段在不该显示时显示,或反过来。只影响显示,服务器的权限检查不变。撤回即可。
  • 要你做什么:无。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 1bc8a35e9e · 2026-11-19T10:07Z

  • Shape: 15 files, +713/−316: two sources (AppContent.tsx, RecordFormPage.tsx), the helper in ExpressionProvider.tsx, 11 test files and a changeset. Not governed. K = 19 since base 35c63310 (≥ 15): merge main and get a green re-run before queueing. It merges cleanly. Main touched none of these files, as the dev notes.
  • Fixes vs card (console: the default record form (no authored sections) never draws a field whose object-level visibleWhen holds; the same predicate on an authored section renders #35249, the default record form never draws a field whose object-level visibleWhen holds):
  • The objectui#6514 ruling (asked): I read it as kept, and I agree.
    • Option A said to read the declared keys and delete the dead read of the spec-refused visible. Both still hold. visible is unread in either polarity, and hidden and visibleWhen are both still read.
    • They still compose as AND (hidden: true stays off whatever the predicate says, which a CONTROL pins), and a faulting predicate still fails open, now on the renderer's own VISIBLE_WHEN_FAULTED.
    • What moved is the tier that evaluates visibleWhen, to the one that has the record. The sub-clause "no current_user binding is added" also holds: the form's provider already bound it, and this PR adds no root.
  • Contract face: none. isObjectFieldVisible was internal: app-shell's entry exports only ExpressionProvider and evaluateVisibility from that module (index.ts:18), and both are unchanged. Clause-②: no and Metadata-protocol: none are right, since the key's declared meaning ("shown only when TRUE") does not change.
  • Pins:
    • Both surfaces (the dialog and RecordFormPage) get a holding has()-guarded field plus three CONTROLs: a false predicate, hidden: true with a holding predicate, and no predicate. Create mode is covered, and so is RecordFormPage's authored view, which was measured dropping the field too.
    • A plugin-form pin covers ObjectForm, ModalForm and DrawerForm on a fieldGroups layout.
    • The ablation turns 5 of 19 red.
    • The 10 existing pins that used the shell list as their probe now assert the form's verdict. That is a probe change, not a weakened assertion, because each still asserts the same field's shown or hidden outcome.
  • Changeset (read sentence by sentence): app-shell patch. The cause, the new split (list reads hidden, form reads visibleWhen per record and live), the unchanged hidden/fail-open/visible behaviour, the visible change including authored sections on the full page, and "no props, exports, metadata keys or locale keys change" all match the code.
  • Deviation accepted: the final type-check ran outside the lock after two lock timeouts. Only test files changed since the in-lock green run, and CI's Type Check covers it.
  • Gates: CI on 1bc8a35e is 40 success and 13 skipped, with 0 failed and 0 pending. PR-side CI is a subset, so ux-2 triages any queue red.
  • Landing clause: not governed, so ux-2 lands it with no L2 owed, after merging main and a green re-run. 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_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-19T10:30Z

reading value
L1-a ACCEPT comment 7006019056; the only change since is a main merge (d0e764cc, K was 19), so no new L1 is owed
CI green at d0e764cc (40 success, 13 skipped, 0 failed); K = 4 now
check-governed-merges --pr 35451 NOT governed, 0 of 15 paths; 1029 lines ≤ 3000; no L2 owed

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

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 10:30
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 609b675 Nov 19, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35249-default-form-visiblewhen branch November 19, 2026 10:50
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/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants