From df1e9b4764e6a3aadf80e1a39c19f1554efe2c38 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 23:33:21 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- ...-skills-rollup-source-unreadable-reason.md | 14 ++++++++ scripts/check-skills-token-ratchet.mjs | 17 +++++++++- .../hooks-security-seeds-datasources.json | 12 ++++++- .../objectstack-data/rules/relationships.md | 33 ++++++++----------- 4 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 .changeset/34742-skills-rollup-source-unreadable-reason.md diff --git a/.changeset/34742-skills-rollup-source-unreadable-reason.md b/.changeset/34742-skills-rollup-source-unreadable-reason.md new file mode 100644 index 00000000000..26d0b139dc9 --- /dev/null +++ b/.changeset/34742-skills-rollup-source-unreadable-reason.md @@ -0,0 +1,14 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): `objectstack-data` teaches `rollupSourceUnreadableReason` beside `security-rollup-source-unreadable` + +Clause-②: no +Metadata-protocol: none + +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. + +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. + +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. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 0d7cc4e5f80..cfd2beb27fe 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1090,7 +1090,22 @@ export const CEILINGS = new Map([ // now carries it), the related-list example's "write side" comment (the paragraph above // says it) and "(no UI config)" (the sentence says "purely from how you model"). 16925 -> // 16916 bytes -> ceil(16916 / 4) = 4229; the row follows the measurement down. - ['skills/objectstack-data/rules/relationships.md', 4229], + // 4229 -> 4221: the roll-up section names the third way out of + // `security-rollup-source-unreadable` (the set is meant to see the total but not the + // children: keep the column readable and add `rollupSourceUnreadableReason` to the set's + // entry; refused blank or beside `readable: false`), with the acknowledged entry in the + // `client_viewer` example, and its mask sentence names Modify All alone (a set's own mask + // binds beside its own View All). +419 bytes, PAID IN FULL by restatement cut from the + // same file (-451), each keeping a home: the `'grid'` / `'form'` bullets (the code + // comments beside the three `inlineEdit` values and the smart-default sentence), the + // "`inlineEdit` is the write side, the related list is the read side" lead-in (the + // heading's "read-side mirror" and the `relatedList` comment), "part of the record's main + // content" (the same bullet's "full-width table in the record's detail body") and four + // code comments the code or the prose above them states (the junction index's "one + // assignment per pair", "On the PARENT object", the second "On the CHILD object's FK + // field", the contact example's "independent lifecycle"). 16916 -> 16884 bytes -> + // ceil(16884 / 4) = 4221; the row follows the measurement down. + ['skills/objectstack-data/rules/relationships.md', 4221], // NEW FILE (#14296 item 1 = A, condition (b)): the entry's Security & Access // Control block moved here whole. Pinned at its landed count — no headroom, // because a split that arrives with budget is a raise wearing a new path. diff --git a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json index 6bccdabab0c..b044bee2669 100644 --- a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json +++ b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json @@ -194,13 +194,23 @@ { "id": 20, "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.", - "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.", + "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.", "files": [], "assertions": { "must_contain": ["function: 'count'", "'project.task_count': { readable: false }"], "must_not_contain": ["task: { allowRead: true }"] } }, + { + "id": 27, + "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.", + "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.", + "files": [], + "assertions": { + "must_contain": ["summary", "project.task_count", "rollupSourceUnreadableReason"], + "must_not_contain": [] + } + }, { "id": 21, "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.", diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 1946ba804d2..347e846b4a7 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -19,7 +19,6 @@ ### One-to-Many: lookup ```typescript -// Child: Contact (independent lifecycle) of an account export default ObjectSchema.create({ name: 'contact', sharingModel: 'public_read_write', @@ -138,7 +137,6 @@ export default ObjectSchema.create({ hours_allocated: { type: 'number' }, }, indexes: [ - // One assignment per (project, employee) pair. { fields: ['project_id', 'employee_id'], unique: 'organization' }, ], }); @@ -186,7 +184,6 @@ A parent `summary` field aggregates a child collection. The engine recomputes it transaction as the write, so it's consistent). ```typescript -// On the PARENT object: { type: 'summary', summaryOperations: { @@ -228,16 +225,21 @@ where you can; declared late, run the migration before you call the number ready **Never finish with `security-rollup-source-unreadable` standing.** The total covers every child row and answers only to the parent field's own access, so `os build` warns for each permission set that reads the summary but not the -child object, the aggregated field, or a field `filter` tests. Decide per set: -it should see the children → grant the read; it should not → mask the summary -on that set, after removing any View All / Modify All it holds on the parent -(either overrides the mask). +child object, the aggregated field, or a field `filter` tests. Decide per set +from the request: it sees the children → grant the read; 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; refused +blank or beside `readable: false`); neither → mask the summary on that set, +after removing any Modify All it holds on the parent (it overrides the mask). +Never add the reason to silence a total the request withholds: mask it. ```typescript definePermissionSet({ name: 'client_viewer', objects: { project: { allowRead: true } }, // no `task` read: warned fields: { 'project.task_count': { readable: false } }, // the mask: resolved + // or, clients are meant to see the count: acknowledged, a note + // fields: { 'project.task_count': { readable: true, rollupSourceUnreadableReason: 'Clients see progress counts, not tasks' } }, }) ``` @@ -288,13 +290,9 @@ inlineEdit: 'grid' // editable line-item grid (fast bulk entry; thin childre inlineEdit: 'form' // read-only list; "Add" / per-row edit opens the FULL form ``` -- **`'grid'`** — best for *thin* line items - (invoice/order lines): few columns, high volume, keyboard-fast. -- **`'form'`** — best for *fat* children (long text, attachments, many fields) - that don't fit a narrow grid cell. -- **`true`** / omitted — **smart default**: picks `form` when the child has - rich/form-only fields (textarea, file, image, json, location…) or more than ~8 - editable fields, else `grid`. Set the string to override. +**`true`** / omitted — **smart default**: picks `form` when the child has +rich/form-only fields (textarea, file, image, json, location…) or more than ~8 +editable fields, else `grid`. Set the string to override. **Modeling a `'grid'` line item for the full editor.** The grid lights up extra behaviors purely from how you model the child + parent: @@ -344,14 +342,12 @@ InvoiceLine = { ### Detail-page related lists (the read-side mirror) -Where `inlineEdit` is the **write** side, the **related list** on the parent's record detail page is the **read** -side. You usually don't declare it: every child relationship +You usually don't declare the **related list** on the parent's record detail page: every child relationship (`master_detail` and `lookup`) is shown **by default** — owned (`master_detail`) children first. The relationship flags exist to *refine* that: ```typescript -// On the CHILD object's FK field: project: { type: 'master_detail', reference: 'project', @@ -367,8 +363,7 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false }, `relatedList` is tri-state — placement: -- `'primary'` — part of the record's main content: a full-width table in the - record's detail body. Default for a `master_detail` FK with `inlineEdit`. +- `'primary'` — a full-width table in the record's detail body. Default for a `master_detail` FK with `inlineEdit`. - `false` — the child object is not shown on the parent record page. - `true`, or omitted (except inline-edited `master_detail`) — an auxiliary panel on the record page.