Skip to content

Commit df1e9b4

Browse files
committed
docs(skills): objectstack-data teaches rollupSourceUnreadableReason beside security-rollup-source-unreadable
The roll-up rule named two ways out of the warning (grant the child read, or mask the summary). It now names the third: a set meant to see the total but not the children keeps the column readable and gives the reason on its entry for it, and the warning becomes a note quoting the reason. The mask sentence names Modify All alone, since a set's own mask binds beside its own View All. Paid by restatement cut from the same file; the token row follows the measurement down, 4229 to 4221. One eval case added beside the mask case. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz
1 parent 6d2db1d commit df1e9b4

4 files changed

Lines changed: 55 additions & 21 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-data` teaches `rollupSourceUnreadableReason` beside `security-rollup-source-unreadable`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-data's `rules/relationships.md` named two ways to resolve `security-rollup-source-unreadable` on a permission set that reads a roll-up `summary` but not the child data under it: grant the child read, or mask the summary. It now names the third. When the request says the set should see the total but not the children, keep the column readable and add `rollupSourceUnreadableReason` to the set's entry for it: `fields: { 'project.task_count': { readable: true, rollupSourceUnreadableReason: 'Clients see progress counts, not tasks' } }`. The warning for that set and column is then reported as a note quoting the reason. A blank reason, or one beside `readable: false`, is refused at parse time. The reason is never added to silence a total the request withholds: that one is masked.
11+
12+
The mask sentence now names Modify All alone as what must leave the set first. A set's own `readable: false` binds beside its own View All, so the skill no longer asks for View All to be removed.
13+
14+
Six restatements in the same file are cut to pay for it, so the file's token ceiling goes down, 4229 to 4221. The skill's evals gain one case (the set sees the total but not the rows, so the answer acknowledges it with a reason) beside the existing mask case.

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,22 @@ export const CEILINGS = new Map([
10901090
// now carries it), the related-list example's "write side" comment (the paragraph above
10911091
// says it) and "(no UI config)" (the sentence says "purely from how you model"). 16925 ->
10921092
// 16916 bytes -> ceil(16916 / 4) = 4229; the row follows the measurement down.
1093-
['skills/objectstack-data/rules/relationships.md', 4229],
1093+
// 4229 -> 4221: the roll-up section names the third way out of
1094+
// `security-rollup-source-unreadable` (the set is meant to see the total but not the
1095+
// children: keep the column readable and add `rollupSourceUnreadableReason` to the set's
1096+
// entry; refused blank or beside `readable: false`), with the acknowledged entry in the
1097+
// `client_viewer` example, and its mask sentence names Modify All alone (a set's own mask
1098+
// binds beside its own View All). +419 bytes, PAID IN FULL by restatement cut from the
1099+
// same file (-451), each keeping a home: the `'grid'` / `'form'` bullets (the code
1100+
// comments beside the three `inlineEdit` values and the smart-default sentence), the
1101+
// "`inlineEdit` is the write side, the related list is the read side" lead-in (the
1102+
// heading's "read-side mirror" and the `relatedList` comment), "part of the record's main
1103+
// content" (the same bullet's "full-width table in the record's detail body") and four
1104+
// code comments the code or the prose above them states (the junction index's "one
1105+
// assignment per pair", "On the PARENT object", the second "On the CHILD object's FK
1106+
// field", the contact example's "independent lifecycle"). 16916 -> 16884 bytes ->
1107+
// ceil(16884 / 4) = 4221; the row follows the measurement down.
1108+
['skills/objectstack-data/rules/relationships.md', 4221],
10941109
// NEW FILE (#14296 item 1 = A, condition (b)): the entry's Security & Access
10951110
// Control block moved here whole. Pinned at its landed count — no headroom,
10961111
// because a split that arrives with budget is a raise wearing a new path.

‎skills/objectstack-data/evals/hooks-security-seeds-datasources.json‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,23 @@
194194
{
195195
"id": 20,
196196
"prompt": "Each `project` shows a `task_count` — the number of its `task` records (each task has a `project` lookup). Add a `client_viewer` permission set: clients read projects, but must never be able to read tasks.",
197-
"expected_output": "`task_count` is a `summary` on `project` (`summaryOperations: { object: 'task', function: 'count' }`). `client_viewer` grants `project: { allowRead: true }` and no `task` entry — and because a roll-up covers every child row and answers only to the parent field's own access, the set also masks the summary: `fields: { 'project.task_count': { readable: false } }`, with no View All / Modify All on `project` (either overrides the mask). The build then finishes without `security-rollup-source-unreadable`; the warning is resolved, not left standing or explained away, and not silenced by granting the `task` read the request forbids.",
197+
"expected_output": "`task_count` is a `summary` on `project` (`summaryOperations: { object: 'task', function: 'count' }`). `client_viewer` grants `project: { allowRead: true }` and no `task` entry — and because a roll-up covers every child row and answers only to the parent field's own access, the set also masks the summary: `fields: { 'project.task_count': { readable: false } }`, with no Modify All on `project` (it overrides the mask). The build then finishes without `security-rollup-source-unreadable`; the warning is resolved, not left standing or explained away, and not silenced by granting the `task` read the request forbids.",
198198
"files": [],
199199
"assertions": {
200200
"must_contain": ["function: 'count'", "'project.task_count': { readable: false }"],
201201
"must_not_contain": ["task: { allowRead: true }"]
202202
}
203203
},
204+
{
205+
"id": 27,
206+
"prompt": "Each `project` shows a `task_count` — the number of its `task` records (each task has a `project` lookup). Add a `client_viewer` permission set: clients read projects and should see how many tasks each one has, but must never be able to read the tasks themselves.",
207+
"expected_output": "`task_count` is a `summary` on `project` (`summaryOperations: { object: 'task', function: 'count' }`). `client_viewer` grants `project: { allowRead: true }` and no `task` entry. The request says the set sees the total but not the rows, so the column stays readable and the set's entry for it says why: `fields: { 'project.task_count': { readable: true, rollupSourceUnreadableReason: 'Clients see progress counts, not tasks' } }`. `security-rollup-source-unreadable` is then reported as a note quoting the reason instead of a warning, so the build finishes with no warning standing. The count is not masked (that would withhold a total the request grants, and the reason is refused beside `readable: false`), and the warning is not silenced by granting the `task` read the request forbids.",
208+
"files": [],
209+
"assertions": {
210+
"must_contain": ["summary", "project.task_count", "rollupSourceUnreadableReason"],
211+
"must_not_contain": []
212+
}
213+
},
204214
{
205215
"id": 21,
206216
"prompt": "In our project tracker a contractor may create a `task` only when they are its `assignee` (a person field). A contractor asks the assistant \"Add a 'Launch checklist' task to the Website relaunch\" and the create answers 403, because the request names no assignee. Author the field and the contractor permission set's policy so the plain request succeeds, without widening whom a contractor may assign.",

‎skills/objectstack-data/rules/relationships.md‎

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
### One-to-Many: lookup
2020

2121
```typescript
22-
// Child: Contact (independent lifecycle) of an account
2322
export default ObjectSchema.create({
2423
name: 'contact',
2524
sharingModel: 'public_read_write',
@@ -138,7 +137,6 @@ export default ObjectSchema.create({
138137
hours_allocated: { type: 'number' },
139138
},
140139
indexes: [
141-
// One assignment per (project, employee) pair.
142140
{ fields: ['project_id', 'employee_id'], unique: 'organization' },
143141
],
144142
});
@@ -186,7 +184,6 @@ A parent `summary` field aggregates a child collection. The engine recomputes it
186184
transaction as the write, so it's consistent).
187185

188186
```typescript
189-
// On the PARENT object:
190187
{
191188
type: 'summary',
192189
summaryOperations: {
@@ -228,16 +225,21 @@ where you can; declared late, run the migration before you call the number ready
228225
**Never finish with `security-rollup-source-unreadable` standing.** The total
229226
covers every child row and answers only to the parent field's own access, so
230227
`os build` warns for each permission set that reads the summary but not the
231-
child object, the aggregated field, or a field `filter` tests. Decide per set:
232-
it should see the children → grant the read; it should not → mask the summary
233-
on that set, after removing any View All / Modify All it holds on the parent
234-
(either overrides the mask).
228+
child object, the aggregated field, or a field `filter` tests. Decide per set
229+
from the request: it sees the children → grant the read; the total but not the
230+
children → keep the column readable and add `rollupSourceUnreadableReason` to
231+
the set's entry for it (the warning becomes a note quoting the reason; refused
232+
blank or beside `readable: false`); neither → mask the summary on that set,
233+
after removing any Modify All it holds on the parent (it overrides the mask).
234+
Never add the reason to silence a total the request withholds: mask it.
235235
236236
```typescript
237237
definePermissionSet({
238238
name: 'client_viewer',
239239
objects: { project: { allowRead: true } }, // no `task` read: warned
240240
fields: { 'project.task_count': { readable: false } }, // the mask: resolved
241+
// or, clients are meant to see the count: acknowledged, a note
242+
// fields: { 'project.task_count': { readable: true, rollupSourceUnreadableReason: 'Clients see progress counts, not tasks' } },
241243
})
242244
```
243245
@@ -288,13 +290,9 @@ inlineEdit: 'grid' // editable line-item grid (fast bulk entry; thin childre
288290
inlineEdit: 'form' // read-only list; "Add" / per-row edit opens the FULL form
289291
```
290292
291-
- **`'grid'`** — best for *thin* line items
292-
(invoice/order lines): few columns, high volume, keyboard-fast.
293-
- **`'form'`** — best for *fat* children (long text, attachments, many fields)
294-
that don't fit a narrow grid cell.
295-
- **`true`** / omitted — **smart default**: picks `form` when the child has
296-
rich/form-only fields (textarea, file, image, json, location…) or more than ~8
297-
editable fields, else `grid`. Set the string to override.
293+
**`true`** / omitted — **smart default**: picks `form` when the child has
294+
rich/form-only fields (textarea, file, image, json, location…) or more than ~8
295+
editable fields, else `grid`. Set the string to override.
298296
299297
**Modeling a `'grid'` line item for the full editor.** The grid lights up extra
300298
behaviors purely from how you model the child + parent:
@@ -344,14 +342,12 @@ InvoiceLine = {
344342
345343
### Detail-page related lists (the read-side mirror)
346344
347-
Where `inlineEdit` is the **write** side, the **related list** on the parent's record detail page is the **read**
348-
side. You usually don't declare it: every child relationship
345+
You usually don't declare the **related list** on the parent's record detail page: every child relationship
349346
(`master_detail` and `lookup`) is shown **by default** — owned (`master_detail`)
350347
children first. The relationship
351348
flags exist to *refine* that:
352349
353350
```typescript
354-
// On the CHILD object's FK field:
355351
project: {
356352
type: 'master_detail',
357353
reference: 'project',
@@ -367,8 +363,7 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false },
367363
368364
`relatedList` is tri-state — placement:
369365
370-
- `'primary'` — part of the record's main content: a full-width table in the
371-
record's detail body. Default for a `master_detail` FK with `inlineEdit`.
366+
- `'primary'` — a full-width table in the record's detail body. Default for a `master_detail` FK with `inlineEdit`.
372367
- `false` — the child object is not shown on the parent record page.
373368
- `true`, or omitted (except inline-edited `master_detail`) — an auxiliary
374369
panel on the record page.

0 commit comments

Comments
 (0)