Skip to content

Commit c21945d

Browse files
docs(skills): objectstack-data teaches rollupSourceUnreadableReason beside security-rollup-source-unreadable (#35042)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34742 Clause-②: no Metadata-protocol: none Served-tier: CONTRACT_REVIEW_TIER ## 维护者速读 - 改了什么:`objectstack-data` 技能的汇总可见性规则多教一条出路。权限集「该看汇总、不该看明细」时,保留该列可读,并在该集的字段条目上写 `rollupSourceUnreadableReason` 说明原因;评测集加一道对应的题。 - 为什么改:这个键已随平台落地,但技能只教「给子对象读权限」或「遮掉汇总列」两条路,AI 仍会用需求禁止的读授权去压警告,或把需求要给的汇总遮掉。 - 风险与回滚:只改技能文字、一道评测题和该文件的 token 上限行,不动产品代码。同文件删了 6 处重复付账,上限不升反降(4229 → 4221)。回滚即 revert 本 PR。 - 先看:`skills/objectstack-data/rules/relationships.md` 的「Never finish with …」一段及其示例(新教学,另把「先摘掉 View All / Modify All」改为只说 Modify All);同文件被删的 6 处重复;`scripts/check-skills-token-ratchet.mjs` 里 `relationships.md` 那一行及注释。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期末行以 `✓ check-skills-token-ratchet: 58 authored bundle file(s) within their ceilings` 开头。 - 需要你做的:请审阅并批准。`check-governed-merges` 判为 Tier H(`skills/**`);席位达档合同审 6964794395 判 `Security-touching: yes`(本 PR 讲授权限集字段遮罩与 Modify All 的覆盖关系),低风险 skills 通道不适用,需 os-zhuang 批准后由席位落地。合同审 PASS,L1 ACCEPT,无 must-fix / should-fix。 ## What changes **`skills/objectstack-data/rules/relationships.md`** (§ Roll-up Summaries, the "Never finish with `security-rollup-source-unreadable` standing" paragraph and its example). The paragraph named two ways out per permission set. It now names three, chosen from the request: - the set sees the children: grant the read (unchanged); - the set sees the total but not the children: keep the column readable and add `rollupSourceUnreadableReason` to the set's entry for it. The warning becomes a note quoting the reason. The reason is refused blank or beside `readable: false`; - neither: mask the summary on that set (unchanged, see the Modify All note below). It ends with the card's guard: never add the reason to silence a total the request withholds; mask it. The `client_viewer` example gains the acknowledged entry as a commented alternative to the mask line: `fields: { 'project.task_count': { readable: true, rollupSourceUnreadableReason: 'Clients see progress counts, not tasks' } }`. **The mask sentence names Modify All alone.** It said to remove "any View All / Modify All it holds on the parent (either overrides the mask)". That is no longer true for View All: under the ADR-0066 D2 ⑧ note of 2026-11-15 a set's own `readable: false` row binds beside that set's own View All, and only its Modify All unbinds it. The lint rule's own hint names Modify All only. The sentence I was extending would have kept teaching an unneeded removal, so it now reads "after removing any Modify All it holds on the parent (it overrides the mask)". The same parenthetical in the existing mask eval case (id 20) is brought in line; its assertions are untouched. **`skills/objectstack-data/evals/hooks-security-seeds-datasources.json`**. The mask case (id 20) stays. One case is added after it (id 27): the request says clients should see how many tasks each project has but never read the tasks, so the answer keeps the column readable and acknowledges it with a reason. Ids 25 and 26 are left for the open PR #34964, which appends them at the end of the file; this case sits mid-file so the two do not touch the same lines. **`scripts/check-skills-token-ratchet.mjs`**: the `relationships.md` row follows the measurement down, 4229 to 4221, with the arithmetic in its comment. **`.changeset/34742-skills-rollup-source-unreadable-reason.md`**: `@objectstack/skills` patch. No version caveat is taught: `@objectstack/skills` is versioned and published with the other packages, so the text ships in the release that carries the key. ### How the file is paid for The row had zero headroom (16916 bytes, ceiling 4229 = ceil(16916 / 4)). The teaching adds 419 bytes. Six restatements are cut from the same file, 451 bytes, each with the text that still carries it: | Cut | Bytes | Still carried by | |:---|---:|:---| | The `'grid'` and `'form'` bullets under "Inline-edit form factor" | 236 | The code comments beside the three `inlineEdit` values ("editable line-item grid (fast bulk entry; thin children)", "read-only list; … opens the FULL form") and the smart-default sentence (rich or form-only fields, or more than ~8 editable fields, pick `form`) | | "Where `inlineEdit` is the write side, the related list … is the read side" lead-in | 67 | The heading "Detail-page related lists (the read-side mirror)" and the `relatedList: 'primary'` comment "read side: a body table" | | "part of the record's main content:" in the `'primary'` bullet | 37 | The same bullet: "a full-width table in the record's detail body" | | Comment "One assignment per (project, employee) pair." | 52 | The index line under it: `{ fields: ['project_id', 'employee_id'], unique: 'organization' }` | | Comment "Child: Contact (independent lifecycle) of an account" | 55 | The Relationship Types table (`lookup`: Independent) and the example's own `account_id` lookup | | Comments "On the PARENT object:" (roll-up block) and the second "On the CHILD object's FK field:" (related-list block) | 60 | "A parent `summary` field aggregates a child collection" directly above; the first "On the CHILD object's FK field:" comment in Inline Editing, and "The relationship flags" lead-in | Net: 16916 to 16884 bytes, ceil(16884 / 4) = 4221. No raise. ### Size readings (`skills/**`) | Reading | Before (`6d2db1d7ef`) | After (`df1e9b4764`) | |:---|---:|---:| | `rules/relationships.md`, lines | 414 | 409 | | `rules/relationships.md`, bytes / tokens | 16916 / 4229 | 16884 / 4221 | | All `SKILL.md` files, lines (none touched) | 4730 | 4730 | | All authored `.md` under `skills/` outside `evals/`, lines | 18036 | 18031 | | Eval file (unpriced), lines / bytes | 245 / 22460 | 255 / 23747 | ## Tests All on head `df1e9b4764`. <details><summary>Premise, re-measured on <code>origin/main</code> 6d2db1d</summary> - `relationships.md:228-234` named grant or mask only. - `git grep -n rollupSourceUnreadableReason -- skills` answered zero lines (control: the same word hits `packages/lint/src/validate-rollup-source-visibility.ts` and `packages/spec/src/security/permission.zod.ts`). </details> <details><summary>Every taught clause, probed against the built lint rule and the spec schema</summary> One throwaway script (not committed) ran `validateRollupSourceVisibility` from the rebuilt `packages/lint/dist` over a `project` / `task` stack with a `client_viewer` set, and `FieldPermissionSchema.safeParse` from `@objectstack/spec/security`: ```text none [["warning","security-rollup-source-unreadable", …]] mask [] reason [["info","security-rollup-source-unreadable","… Acknowledged on the set: \"Clients see progress counts, not tasks\""]] parse reason+readable:true ok parse blank refused: rollupSourceUnreadableReason parse reason+readable:false refused: rollupSourceUnreadableReason mask + View All [] mask + Modify All ["warning"] ``` So: the reason drops the finding to `info` (the "note" the docs name) under the same id and quotes it; it is judged per set and per column entry (`acknowledgedReason` reads the set's own entry for that column only); a blank reason and a reason beside `readable: false` are refused at parse; the set's own mask binds beside its own View All and not beside its own Modify All. </details> <details><summary>Eval assertions, checked by script</summary> No gate reads eval assertions outside `ui/`, so a script checked the file: 25 cases, 25 distinct ids, every `must_contain` token is in its `expected_output`, no `must_not_contain` token is, 0 violations. The new case's tokens are layout-independent, because `packages/qa/scenarios/src/skill-evals/grade.ts` matches literal, case-sensitive substrings with no normalisation: `summary`, `project.task_count`, `rollupSourceUnreadableReason`. Two checks are left out on purpose, since neither can be spelled without depending on whitespace or quoting: that the entry is not `readable: false`, and that the set carries no `task` read grant. A wrong answer of either kind (mask, or grant the read) still fails the case, because it has no reason to carry `rollupSourceUnreadableReason`. </details> No ablation: the diff changes skill prose, an eval fixture and a ratchet row, and no tested behaviour. ## Acceptance notes - The card's proposed text is fitted to the skill's style and to the measured behaviour; the one departure from it is the Modify All correction above. - The existing mask case (id 20) keeps its layout-dependent tokens; only the new case follows the layout-independent rule. - The eval file is also edited by open PRs #35022 and #34964. `node scripts/pm/overlap-check.mjs` against `origin/main` 65ec3c5 and the open PR heads answered `VERDICT clean exit 0` (#35038, #35022 and #34964 each merge cleanly with this branch). ## Verification <details><summary>Local gates: 64 derived, 62 run, 2 NOT MEASURED</summary> - `pnpm --workspace-concurrency=2 --filter '@objectstack/lint...' build` under the verify lock: `VERDICT command-exit 0`. - `node scripts/pm/dispatch-gates.mjs --commands` then `--ran`: `✓ dispatch-gates --ran: 64 derived famil(ies) accounted for — 62 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).` Every run family exited 0. - NOT MEASURED: `check:dual-build-cjs-loads`, reason: exit 3, prerequisite not met (needs a full build); `check:lean-entry-closure`, reason: the same. Both are left to CI. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, `✓ check-skills-token-ratchet: 58 authored bundle file(s) within their ceilings; 10 generator-owned file(s) and 30 eval fixture(s) measured, not ratcheted.` Its `--self-test`: exit 0. - `pnpm check:skill-links`: exit 0, `✓ check-skill-links: 256 relative link(s) in 72 published skill file(s) resolve; 130 fragment(s) name a real heading under GitHub's slug rule.` - `test:repo` and the repo-wide lint are CI's runs, not run locally. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 990d063 commit c21945d

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)