Skip to content

Commit 0c77ea4

Browse files
os-zhuangclaude
andauthored
docs(spec): wrong-layer guidance for group/hideFields/rowColor on object userActions (#11459) (#12606)
Add three curated `guidance` entries to the object-level `userActions` strictObject in packages/spec/src/data/object.zod.ts, mirroring the existing sort/search/filter/editInline wrong-layer wording convention: group, hideFields and rowColor are VIEW `userActions` keys (adopted at #11195) that share a name with nothing on the object block, so an author who learned them on the view writes them here and previously got only the generic unknown-key rejection. Nothing changes about what parses — all three keys were already refused by name on the object block; only the refusal's message gains the same curated pointer the other four wrong-layer keys already carry. Mirrors the existing pin for `sort` with a new test asserting the "VIEW" pointer for all three keys, alongside the pre-existing disjoint-vocabulary check. The #5013 alias-integrity audit judges the three new entries automatically (each is a key the object shape rejects). Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7af4a20 commit 0c77ea4

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
docs(spec): wrong-layer guidance for `group` / `hideFields` / `rowColor` on the object `userActions` block (#11459)
6+
7+
`data/object.zod.ts`'s object-level `userActions` block already curated
8+
`sort` / `search` / `filter` / `editInline` with a pointer at the VIEW
9+
`userActions` block they actually belong to. `group` / `hideFields` /
10+
`rowColor` — adopted onto the view's vocabulary at #11195 — shared the same
11+
wrong-layer trap but got only the generic unknown-key rejection with an
12+
edit-distance suggestion, which has nothing useful to offer over the object
13+
block's `create`/`import`/`edit`/`delete`/`exportCsv` shape.
14+
15+
**Nothing changes about what parses.** All three keys were rejected on the
16+
object block before this change and are rejected after it; only the message
17+
gains the same curated pointer the other four wrong-layer keys already carry.

packages/spec/src/data/object-strictness-batch20.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,18 @@ describe('#4001 批 20 — curation is anchored to the sibling contract that mak
436436
}
437437
});
438438

439+
it('`userActions.group` / `.hideFields` / `.rowColor` name the VIEW block, same as `sort` (#11459)', () => {
440+
// The three keys adopted onto the view's vocabulary at #11195 got only
441+
// the generic unknown-key rejection on the object block — no curated
442+
// pointer — until this card added one, mirroring `sort`/`search`/
443+
// `filter`/`editInline` above.
444+
for (const k of ['group', 'hideFields', 'rowColor']) {
445+
const msg = rejectOnObject({ userActions: { [k]: true } });
446+
expect(msg).toContain('VIEW');
447+
expect(msg).toContain(k);
448+
}
449+
});
450+
439451
it('`userActions.clone` points at the `enable` capability block, which really does declare it', () => {
440452
const msg = rejectOnObject({ userActions: { clone: false } });
441453
expect(msg).toContain('enable');

packages/spec/src/data/object.zod.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,9 @@ const ObjectSchemaBase = strictObject(
17361736
// disjoint vocabulary (sort/search/filter/refresh/rowHeight/group/
17371737
// addRecordForm/editInline/hideFields/rowColor/buttons — the last three
17381738
// adopted at #11195), so an author who learned that block writes these
1739-
// here and gets a shape that has never heard of them.
1739+
// here. `group`/`hideFields`/`rowColor` were refused by name but without
1740+
// a curated pointer until #11459 gave them one too, mirroring the other
1741+
// four.
17401742
sort:
17411743
'`sort` is a VIEW `userActions` key, not an object one — the two blocks share a ' +
17421744
'name and nothing else. The object block governs CRUD affordances ' +
@@ -1752,6 +1754,15 @@ const ObjectSchemaBase = strictObject(
17521754
'`editInline` is a VIEW `userActions` key. The object-level `edit` flag decides ' +
17531755
'whether editing is offered AT ALL; how it is offered (inline vs form) is the ' +
17541756
"view's call.",
1757+
group:
1758+
'`group` is a VIEW `userActions` key. This object block governs CRUD affordances ' +
1759+
'only — put toolbar controls on the view that renders the records.',
1760+
hideFields:
1761+
'`hideFields` is a VIEW `userActions` key. This object block governs CRUD ' +
1762+
'affordances only — put toolbar controls on the view that renders the records.',
1763+
rowColor:
1764+
'`rowColor` is a VIEW `userActions` key. This object block governs CRUD ' +
1765+
'affordances only — put toolbar controls on the view that renders the records.',
17551766
clone:
17561767
'`clone` is a CAPABILITY, not a user action — write `enable: { clone: false }`. ' +
17571768
'The `enable` block (ObjectCapabilities) is where record deep-cloning is governed.',

0 commit comments

Comments
 (0)