Skip to content

Commit 36152cd

Browse files
committed
docs(skills): the data skill's Field Groups section teaches a group's visibleWhen and requiresFeature
examples-objects.md names the two ways a whole field group is hidden: visibleWhen (CEL over the record; FALSE or a fault hides the group, header included) and requiresFeature (a PUBLIC_AUTH_FEATURES flag, refused when unknown, lowered at parse into the group's visibleWhen and stripped, AND-composed after an authored predicate), with sys_organization's Group Structure section as the example. Paid by deleting restatement in the same file; the token ratchet row re-locks at the landed count (1756 -> 1751). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxLYNwSMSVQkj55gA6
1 parent a2f523a commit 36152cd

3 files changed

Lines changed: 28 additions & 16 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the data skill's Field Groups section teaches a group's `visibleWhen` and `requiresFeature`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`skills/objectstack-data/references/examples-objects.md` now names the two ways a whole field group (header included) is hidden: `visibleWhen`, a CEL predicate over the record that hides the group when FALSE or when it faults, and `requiresFeature`, a deployment feature flag from the `PUBLIC_AUTH_FEATURES` set, refused when unknown, lowered at parse into the group's `visibleWhen` and stripped, AND-combined after an authored `visibleWhen`; both are presentation only. The real example is `sys_organization`'s Group Structure section, hidden on a single-organization deployment with `requiresFeature: 'multiOrgEnabled'`. The text is paid for by deleting restatements in the same file (the intro sentence, the migrations paragraph, the deprecated-flag aside, the strictness sentence under Metadata Protection, a dangling "see above" and a path comment), so the file's token ceiling moves down, not up.

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,13 @@ export const CEILINGS = new Map([
10021002
// stale `{ type: 'lookup', reference: 'user' }` fields (an object that does
10031003
// not exist) became `type: 'user'`; -10 tokens, the row follows the
10041004
// measurement down, zero headroom.
1005-
['skills/objectstack-data/references/examples-objects.md', 1756],
1005+
// 1756 -> 1751: RE-LOCK at the landed count after a net cut — the Field
1006+
// Groups section now names a group's `visibleWhen` and `requiresFeature`
1007+
// (lowered into `visibleWhen` at parse, unknown flag refused, AND-composed
1008+
// after an authored predicate) with the `sys_organization` example, paid by
1009+
// deleting restatement in the same file; -5 tokens, the row follows the
1010+
// measurement down, zero headroom.
1011+
['skills/objectstack-data/references/examples-objects.md', 1751],
10061012
['skills/objectstack-data/references/lint-rules.md', 970],
10071013
// 1299 -> 1566 (#26297): the `columns` dataset key and `applyOn: 'create'`
10081014
// — a column a job or an admin owns after the first load is written on

‎skills/objectstack-data/references/examples-objects.md‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22

33
## Field Groups (MVP)
44

5-
Organize fields into logical groups (e.g., "Contact Information", "Billing",
6-
"System") for forms, detail pages, and editors.
7-
85
- Declare groups on `ObjectSchema.fieldGroups` — **array order is the display order**.
96
- Assign each field to a group via `Field.group`, which references an
107
`ObjectFieldGroup.key`. In-group display order equals the traversal order
118
of `fields`.
12-
- Group keys must be `snake_case`; group labels are human-readable.
9+
- Group keys must be `snake_case`.
1310
- Optional per-group: `icon`, `description`, and `collapse`
1411
(`'none'` always open · `'expanded'` collapsible, starts open ·
15-
`'collapsed'` collapsible, starts closed — replaces the deprecated
16-
`defaultExpanded` flag, ADR-0085). Groups render identically on forms,
12+
`'collapsed'` collapsible, starts closed). Groups render identically on forms,
1713
modals, and detail pages; for a bespoke single-page layout assign a
1814
custom Page instead.
15+
- Hide a whole group, header included, with `visibleWhen` (CEL over
16+
`record.*`; FALSE or a fault hides it) or `requiresFeature` (a deployment
17+
feature flag from `PUBLIC_AUTH_FEATURES`; an unknown flag is refused). At
18+
parse `requiresFeature` is lowered into the group's `visibleWhen` and
19+
stripped, AND-combined after an authored `visibleWhen`. Presentation only:
20+
the fields stay readable through the API. `sys_organization` hides Parent
21+
Organization and Sort Order on one organization:
22+
`{ key: 'group_structure', label: 'Group Structure', requiresFeature: 'multiOrgEnabled' }`.
1923

2024
<!-- os:check -->
2125
```typescript
@@ -44,10 +48,6 @@ export default ObjectSchema.create({
4448
});
4549
```
4650

47-
**Supported migrations at this layer:** add / rename / delete / reorder groups
48-
(edit the `fieldGroups` array), assign a field to a group (edit `Field.group`).
49-
Explicit per-field in-group ordering is deferred to a future iteration.
50-
5151
## Quick-Start Template
5252

5353
<!-- os:check -->
@@ -60,7 +60,7 @@ export default ObjectSchema.create({
6060
pluralLabel: 'Support Cases',
6161
description: 'A customer-reported issue tracked to resolution.',
6262
icon: 'life-buoy',
63-
sharingModel: 'private', // required in practice — see above
63+
sharingModel: 'private', // required in practice
6464
highlightFields: ['subject', 'status', 'priority'],
6565
enable: {
6666
trackHistory: true,
@@ -160,9 +160,6 @@ protection?: {
160160
}
161161
```
162162

163-
The block is `.strict()`: `reason` is **required** (min 1 / max 500 chars) and
164-
unknown keys are rejected.
165-
166163
| `lock` | Edit | Delete | Typical use |
167164
|:---|:---:|:---:|:---|
168165
| `none` (default) | ✅ | ✅ | Normal authored metadata |
@@ -174,7 +171,6 @@ unknown keys are rejected.
174171

175172
<!-- os:check -->
176173
```typescript
177-
// src/objects/sys-user.object.ts
178174
import { ObjectSchema } from '@objectstack/spec/data';
179175

180176
export const SysUserObject = ObjectSchema.create({

0 commit comments

Comments
 (0)