Commit 10e8983
feat(spec): unify conditional-visibility predicate under visibleWhen (ADR-0089) (#2900)
* feat(spec): unify conditional-visibility predicate under visibleWhen (ADR-0089)
Make `visibleWhen` the single canonical conditional-visibility key across all
layers (data field, view form section/field, page component), aligning with the
existing `readonlyWhen` / `requiredWhen` family and the resolved
`conditionalRequired → requiredWhen` precedent.
D1 — canonical key: accept `visibleWhen` on `FormFieldSchema` /
`FormSectionSchema` (view.zod.ts) and `PageComponentSchema` (page.zod.ts),
documenting the per-layer binding root (runtime surfaces bind
`record` + `current_user` + `page.<var>`; metadata-editing forms bind `data`).
D2 — aliases + normalization: mark the view `visibleOn` and page `visibility`
keys `@deprecated`; fold them into `visibleWhen` once at the schema boundary via
a shared `normalizeVisibleWhen` zod `.transform()` (canonical wins when both are
present), so no consumer re-implements the fallback.
Codemod first-party sources to canonical `visibleWhen`: metadata-editing forms
(`*.form.ts`), the showcase view/pages, and the affected tests + docs + the
objectstack-formula skill + the expression-conformance ledger (both spellings
kept as live CEL surfaces during the deprecation window).
Out of scope, unchanged: boolean `visible` (Tab on/off), field `hidden`,
gallery `visibleFields`, and unrelated `visibility` enums (feed / package /
environment / agent). The `.strict()` flip (D3a), the lint rule (D3b), and the
ObjectUI renderer reads (sibling repo) are staged follow-ups per the ADR.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017fU25GeYSPKq9eEURsQffF
* chore(spec): update api-surface snapshot for visibleWhen helpers
Regenerate the public API-surface snapshot to include the two new
`@objectstack/spec` exports added by ADR-0089 — `normalizeVisibleWhen`
and `VISIBILITY_ALIAS_KEYS` (shared visibility-normalization helper).
Non-breaking (2 added, 0 removed/narrowed).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017fU25GeYSPKq9eEURsQffF
* feat(lint): visibility-predicate lint rule for ADR-0089 (D3b)
Add `validateVisibilityPredicates` (`@objectstack/lint`) and wire it into
`os validate` + `os compile` as advisory warnings:
- `visibility-alias-deprecated` — a deprecated `visibleOn` (view form) or
`visibility` (page component) key in authored source → steer to `visibleWhen`.
- `visibility-root-mislayered` — a runtime view/page visibility predicate rooted
at `data.` (the metadata-editing-form root) → runtime surfaces bind
`record`/`current_user`/`page.<var>`, so a `data.` root never matches.
Runs on the PRE-parse (normalized) stack — like `validate-list-view-mode` —
because the schema folds `visibleOn`/`visibility` into `visibleWhen` at parse,
so the parsed stack no longer carries the alias the author wrote. Both rules are
warnings; the build never fails on them.
Addresses #2903 (ADR-0089 D3b).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017fU25GeYSPKq9eEURsQffF
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0e13513 commit 10e8983
30 files changed
Lines changed: 645 additions & 87 deletions
File tree
- .changeset
- content/docs
- data-modeling
- protocol/objectui
- ui
- docs/adr
- examples/app-showcase
- src/ui
- pages
- views
- test
- packages
- cli/src/commands
- dogfood/test
- lint/src
- spec
- src
- data
- ui
- skills/objectstack-formula
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
| 755 | + | |
756 | 756 | | |
757 | 757 | | |
758 | 758 | | |
| |||
772 | 772 | | |
773 | 773 | | |
774 | 774 | | |
775 | | - | |
| 775 | + | |
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | | - | |
799 | | - | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
803 | | - | |
| 804 | + | |
804 | 805 | | |
805 | 806 | | |
806 | | - | |
| 807 | + | |
807 | 808 | | |
808 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
809 | 821 | | |
810 | 822 | | |
811 | 823 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments