Skip to content

fix(plugin-detail): the highlights strip, the detail view and the record drawer hide a field whose own visibleWhen is false - #35545

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35437-visiblewhen-highlights-drawer
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35437-visiblewhen-highlights-drawer

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35437

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:记录页顶部的要点条、详情视图(含页眉小标签)和列表等视图打开的侧边抽屉里,「显示条件」对当前记录不成立的字段不再显示,与编辑表单和详情正文一致。
  • 为什么做:上一张卡只修好了详情正文,这三处是同一问题剩下的位置;同一条记录在不同位置显示不一,读者会看到空的或误导的字段。
  • 出错会怎样:只影响显示,数据与接口不变;条件写错或算不出来时照常显示该字段;整体撤回一个提交即可。
  • 要你做什么:无。

What changes

A field's own object-level visibleWhen (Field.visibleWhen: "field is shown only when TRUE (else hidden)") now hides it on every record surface in plugin-detail that draws fields, not only on the record:details body:

  • One implementation, three callers. The details body's fold is lifted into a new module-internal helper, ui/packages/plugin-detail/src/fieldPredicateVisibility.ts (dropFieldPredicateHidden, with assemblePredicateRecord, lazyPredicateRecord and fieldPredicateVisible moved there unchanged). It is not exported from the package barrel. Call sites:
    1. record:details (renderers/record-details.tsx): its dropPredicateHidden now delegates to the helper; the group gate keeps its own fail-closed judge and reads the same lazily assembled record.
    2. HeaderHighlight: drops a gated highlight before the read/edit face split. This covers record:highlights and the strip a detail-view draws from highlightFields.
    3. DetailView: a render-only drawn memo filters fields, sections[].fields, sectionGroups[].sections[].fields and the header summary chips. This covers the detail-view node and the record drawer (RecordDetailDrawer and the views' overlay both render RecordDetailPanel, which renders DetailView).
  • The verdict is the form's (the ruling in the claim). resolveFieldRuleState, the record bound as record and previous, the host predicate scope. A predicate that cannot be evaluated SHOWS the field and warns once (ADR-0137 D3). A field with no predicate is untouched.
  • Evaluated against the saved record, as on the details body: on the strip, an inline edit reveals a gated field after save, not while typing.
  • DetailView's record read is untouched. The $expand read keeps schema's lists. A list derived from the verdict would refetch whenever the verdict moved.

Tests

New ui/packages/plugin-detail/src/__tests__/fieldVisibleWhen.surfaces-35437.test.tsx (11 tests). Each test renders the same row on four surface legs: record:highlights, the detail-view node through SchemaRenderer, the node's own highlightFields strip, and RecordDetailDrawer. It also renders the row through the entry form renderer and asserts { form, highlights, node, nodeStrip, drawer } against the expected verdict in one assertion, so a red names the surface:

  • Parity matrix (8): envelope and bare-string predicates, where the WON row is the CONTROL for a predicate that holds. Also: no predicate (CONTROL), a parse error and an unbound bare identifier (both fail-open CONTROLs, drawn), the null seed, a relation bound as its stored id, previous, and the host current_user scope.
  • Controls (1): beside a hidden field, a field whose predicate holds and a field with none stay drawn on every surface.
  • Summary chip (1): the detail-view header draws no chip for a gated field.
  • Harness guards: each leg first finds an ungated anchor value, and the DetailView legs wait for their own object-schema read to land. Otherwise the leg throws HARNESS DEAD, so an empty render cannot pass a hidden leg.

The details body's own pin, record-details.fieldVisibleWhen-35314.test.tsx (19 tests), is unchanged and green.

Reproduction on the base renderer: 8 red, the 3 fail-open/no-predicate controls green

DetailView.tsx, HeaderHighlight.tsx and record-details.tsx were restored from the base commit 5756ae0 with git restore --source, and the new pin was run. The sources were restored with git checkout HEAD -- in an EXIT trap. Mutation proof: helper references in the three files = 0/0/0. Restore proof: git diff HEAD empty, git status --porcelain empty, and the three git hash-object values equal the HEAD blobs.

x envelope `record.stage == closed_won` — the card reproduction; CONTROL: drawn where it holds
x bare-string `record.stage == closed_won` — the same verdict as the envelope
x a declared field the row does not carry compares as null — evaluated, not faulted
x a relation binds as its stored id, expanded or not
x `previous` binds the persisted row, as on the record's edit form
x the host `current_user` scope binds on every surface
x CONTROL — beside a hidden field, a field whose predicate holds and a field with none stay drawn
x a `stage` chip is drawn on WON and not on LOST
 Tests  8 failed | 3 passed (11)
card reproduction diff: form [false, true]; highlights, node, nodeStrip, drawer each [true, true]

All four surface legs reproduce red on the base (A1). None already routed through the details body.

Ablation of the shared helper: both pins red

node scripts/ablation-replace.mjs replaced the helper's if (visibleWhen == null) return true; with return true;: anchor 1 to 0, blob 627ab41f to 0e66c463. The new pin and the details-body pin were then run together:

 Test Files  2 failed (2)
      Tests  22 failed | 8 passed (30)

That is 8 red in the new pin and 14 in the record:details pin, the same 14 that PR #35421 measured red against its base. So the details body runs through the shared helper too. Restored with git checkout HEAD -- in an EXIT trap: git diff HEAD empty, hash equals the HEAD blob, marker count 0.

Package suite and type-check

Taken at head 86c2830, after merging origin/main. The build closure was rebuilt first, and the commands were chained with && under the verify lock, whose verdict was command-exit 0:

pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-detail^...' build
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-detail/
 Test Files  388 passed | 1 skipped (389)
      Tests  3536 passed | 18 skipped (3554)
pnpm --filter @object-ui/plugin-detail run type-check   (tsc --noEmit && tsc -p tsconfig.test.json; the second program includes src/**/*.test.tsx, so the new pin is compiled)
exit 0

The group-gate pin record-details.groupVisibleWhen-11630.test.tsx and the details-body pin record-details.fieldVisibleWhen-35314.test.tsx are in that suite and unchanged.

Acceptance notes

  • The drawer learns the predicate from DetailView's own object-schema read (dataSource.getObjectSchema). That is the same read that gives it option labels on the record page. RecordDetailPanel hands DetailView typed field descriptors and no object schema. A host that opens the panel with a data source lacking getObjectSchema therefore still draws a gated field, as it also draws no option labels from DetailView's side. Every in-repo caller (grid, list, gallery, kanban, calendar, gantt, map, tree, timeline) passes the view's data source. RecordDetailPanel.tsx is outside this claim's file surface, so this is noted here, not changed.
  • The header summary chips are included. They are fields the detail-view node draws, and they have the same defect. An auto-picked chip that is hidden is dropped, not replaced by the next candidate.
  • record:highlights still registers every authored highlight name for the body's dedupe. A field the predicate hides is dropped by both the strip and the body, so the registration changes nothing visible.
  • Display only. The record API still returns the field, as with a field the form hides.
  • Line-addressed citations: none added.

Verification

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-detail/src/__tests__/fieldVisibleWhen.surfaces-35437.test.tsx. Expect 11 passed, each asserting the form and all four surface legs together.

Files to read first:

  1. ui/packages/plugin-detail/src/DetailView.tsx, the drawn memo and the render sites that read it. Risk: a render path still reading schema.* (the fetch effect deliberately does).
  2. ui/packages/plugin-detail/src/fieldPredicateVisibility.ts, the single implementation.
  3. ui/packages/plugin-detail/src/HeaderHighlight.tsx, the gate before the read/edit split.
Derived local gate families

At head 86c2830, node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 38 commands. Each was run with its exit code captured before any pipe, the vitest and type-check families under the verify lock. All 38 exited 0. --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN. pnpm --dir ui exec vitest run scripts/ reported 171 passed and 2 skipped files (5092 passed tests). pnpm check:new-line-citations (ui) reported 0 new citations. Every other family belongs to CI; see this PR's check runs.


Generated by Claude Code

…ord drawer hide a field whose own visibleWhen is false

Lift the details body's field-visibleWhen fold into one module-internal
helper (fieldPredicateVisibility.ts) and call it from HeaderHighlight and
DetailView as well as record:details.

Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com>
…p pin gates stage

Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com>
… without an explicit any

Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation 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-19T15:18Z
Head: 86c2830d266e8ba84982c88b2dc2bc6566fa25c1. All check runs on it concluded: 42 success, 13 skipped, 0 failed (the PR-side subset). K = 11 (< 15, no main merge owed).
Fixes #35437 · Clause-②: no (no barrel export, no prop or spec change) · Metadata-protocol: none · +604/−106 over 6 files (test +384). Not governed (0 of 6).
Scope: #35421's field-visibleWhen fold is lifted unchanged into one module-internal helper, fieldPredicateVisibility.ts, used by the details body (now delegating), HeaderHighlight (covers record:highlights and the detail-view strip) and DetailView (fields, sections, section groups and the header summary chips; the record drawer reaches it through RecordDetailPanel). Same verdict: the form's resolveFieldRuleState, fail-open, record bound as record and previous, plus the host predicate scope. record-highlights.tsx and RecordDetailDrawer.tsx needed no edit. The #35314 parity pin is unchanged and green. Readings in os-dev-report 7012800108.
Review route: L1-a thread. The area lands it after the ACCEPT.

@objectstack-fleet

objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:字段设了"满足条件才显示"时,记录页顶部的重点信息条、详情视图和从列表/看板等打开的记录抽屉,现在都会像编辑表单一样把它藏起来。
  • 为什么做:以前只有详情正文会藏,其他几处照样显示,同一条记录在不同地方看到的字段不一致。
  • 出错会怎样:只影响显示;条件写错时字段照常显示并提示一次,数据接口仍返回该字段,不会丢数据。
  • 要你做什么:无。区域审核通过后自行落地。
  • 席位意见:做法正确,复用同一判断逻辑,证据充分,可以落地。

席位核对

L1-a: ACCEPT · head 86c2830d266e8ba84982c88b2dc2bc6566fa25c1 · Fixes #35437 · 2026-11-19T15:19Z · reviewed to pm-dispatch text at origin/main fca72dfa32

Readings, my own: check-governed-merges --pr 35545 0 of 6 paths governed; merge-tree against main clean; K=11 (<15, no merge owed); CI 42 success / 13 skipped / 0 failed; +605/−106. The claim (7008733335, 12:11Z) predates the 14:38Z p1-only rule, so this p2 is in flight. Every file is inside the claimed surface (HeaderHighlight.tsx, DetailView.tsx, renderers/record-details.tsx for the lift only, one new module-internal helper, its test, .changeset/), so no amendment is owed; record-highlights.tsx and RecordDetailDrawer.tsx were claimed and needed no edit.

The lift is unchanged. fieldPredicateVisibility.ts holds assemblePredicateRecord (the old sectionPredicateRecord, body identical), lazyPredicateRecord (the old ??= cache), fieldPredicateVisible (identical resolveFieldRuleState({ visibleWhen }, record, {}, record, scope, where).visible) and dropFieldPredicateHidden (the old dropPredicateHidden filter with the surface name moved into where). It is not exported from the barrel. record-details.tsx now delegates, and its group gate (sectionPredicateVisible, fail-closed) still reads the same assembled record.

The surfaces.

  • HeaderHighlight: drawnFields filters fields before the read/edit hasValue split, after the !fields.length || !data early return. That return is not a hook boundary; usePredicateScope() is called at line 78, above it. Both record:highlights and DetailView's strip pass objectSchema/objectName, so both learn the predicate.
  • DetailView: the drawn memo (line 604, no early return above it in the component body) filters fields, sections and sectionGroups[].sections and gives shows for the summary chips. All the render paths I found read drawn.*: the tabbed details body, the plain body, EmptySectionsFold/EmptySectionsLine and direct fields. The $expand/fetch effect and effectiveSummaryFields still read schema.*, the latter then filtered at render. Reading the unfiltered lists for the fetch is the stated intent: no refetch when the verdict moves.
  • The verdict is the saved record's on every surface, as on the details body; the changeset says so.

Pins (names grepped, not recalled). fieldVisibleWhen.surfaces-35437.test.tsx has two describes.

  • The first runs the case table (envelope and bare-string record.stage == 'closed_won', the no-predicate CONTROL, a parse-error fail-open CONTROL), plus the host current_user scope binds on every surface and the CONTROL that a held predicate and an ungated field stay drawn.
  • The second is a stage chip is drawn on WON and not on LOST.

Each case asserts { form, highlights, node, nodeStrip, drawer } against one expected verdict. The HARNESS DEAD / PARTIAL FIELD guards keep an empty render from passing a hidden leg. A1 (8 of 11 red at base), the ablation (22 of 30 red) and the unchanged green #35314 pin are from os-dev-report 7012800108.

Declaration: agreed. Clause-②: no / Metadata-protocol: none / @object-ui/plugin-detail patch. The change is display only, over an existing spec key (Field.visibleWhen) whose published meaning is "shown only when TRUE". No schema, export, door or answer key changes, so no L2 is owed. Skills-docs: is not required for this arm.

Out of scope, noted and not filed. RecordDetailPanel with a data source lacking getObjectSchema still draws a gated field. Every in-repo caller passes one, and the file is outside the claim. If ux-2 wants it tracked, file a p3 card nested under #35437 (Bill's 15:06Z standing permission covers that); non-blocking.

Routing. Not governed and no contract face: ux-2 lands it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-19T15:20Z

reading value
L1-a ACCEPT comment 7013375178 at head 86c2830d26 (= current head)
CI green at 86c2830d26 (42 success, 13 skipped, 0 failed); K = 11 (< 15)
check-governed-merges --pr 35545 NOT governed, 0 of 6 paths; +604 / −106; no L2 owed

Not filed: a host data source without getObjectSchema would not gate the drawer. Every in-repo caller passes one and there is no public-door reach, so no card is owed (L1-a: optional p3).
State: draft → ready + auto-merge (merge queue). #35437 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 15:21
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit b65488a Nov 19, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35437-visiblewhen-highlights-drawer branch November 19, 2026 15:41
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/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

record page: the header highlights strip, the detail-view node and the record drawer still draw a field whose own visibleWhen is false

2 participants