Skip to content

docs(adr): ADR-0089 — unify conditional-visibility predicate under visibleWhen - #2641

Merged
os-zhuang merged 1 commit into
mainfrom
claude/spec-visibility-properties-siu3vf
Jul 5, 2026
Merged

docs(adr): ADR-0089 — unify conditional-visibility predicate under visibleWhen#2641
os-zhuang merged 1 commit into
mainfrom
claude/spec-visibility-properties-siu3vf

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What

Adds ADR-0089 (Proposed) proposing that the conditional-visibility predicate — the same "show this only when the CEL predicate is TRUE" concept, currently spelled three different ways by layer — be unified under a single canonical name, visibleWhen.

LayerKey todayLocation
Data field / field optionvisibleWhenpackages/spec/src/data/field.zod.ts:592, 108
View form section / fieldvisibleOnpackages/spec/src/ui/view.zod.ts:762, 781
Page componentvisibilitypackages/spec/src/ui/page.zod.ts:109

Why

Because every key is .optional() and the schemas run zod's default strip mode, a key placed on the wrong layer (visibleOn on a data field, visibleWhen on a form field) is silently dropped — no type error, no validation error, the element just renders unconditionally. For an AI author that is the worst failure mode: no signal to self-correct from. Three compounding traps: same concept switches name by layer; visibleOn itself has two binding roots (record in runtime forms vs data in metadata-editing forms); and failure is silent.

Decision (summary)

  • Canonical visibleWhen across all layers — chosen over visibleOn because it stays aligned with the existing readonlyWhen / requiredWhen family and the already-resolved conditionalRequired → requiredWhen consolidation (field.zod.ts:594-598). Picking visibleOn would break that triad.
  • visibleOn / visibility become @deprecated aliases, normalized to visibleWhen at parse time — zero breaking change, shipping as an ADR-0087 L1 invisible break.
  • .strict() + a lint rule so a mis-layered or mis-rooted (data. vs record.) key becomes a loud error instead of a silent no-op (per ADR-0049 enforce-or-remove, ADR-0078 no-silently-inert).
  • Boolean visible (Tab on/off) is a static flag, not a predicate — explicitly out of scope.

Scope

Docs-only: a single new ADR file at docs/adr/0089-unify-visibility-predicate-naming.md. No code changes yet — this is the design decision; the schema/lint/codemod implementation would follow in a separate PR if the ADR is accepted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PHCX3Qo8NjyMiMMMayygjg


Generated by Claude Code

…bleWhen
Propose collapsing the same "show when CEL predicate is TRUE" concept —
spelled visibleWhen (data field), visibleOn (view form), and visibility
(page component) — onto a single canonical visibleWhen, keeping the old
names as @deprecated aliases normalized at parse time.
Chooses visibleWhen (not visibleOn) to stay aligned with the existing
readonlyWhen/requiredWhen family and the conditionalRequired -> requiredWhen
precedent. Adds .strict() + a lint rule so a mis-layered or mis-rooted key
becomes a loud error instead of being silently stripped by zod. The boolean
`visible` (Tab on/off) stays out of scope.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PHCX3Qo8NjyMiMMMayygjg
@vercel

vercelBot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specBuildingBuildingPreview, CommentJul 5, 2026 4:14pm

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation size/m labels Jul 5, 2026
@os-zhuangos-zhuang added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Jul 5, 2026 — with Claude
@os-zhuang
os-zhuang marked this pull request as ready for review July 5, 2026 16:22
@os-zhuang
os-zhuang merged commit 113bd50 into mainJul 5, 2026
16 of 18 checks passed
@os-zhuang
os-zhuang deleted the claude/spec-visibility-properties-siu3vf branch July 5, 2026 16:22
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@os-zhuang@claude