Skip to content
10 changes: 10 additions & 0 deletions .changeset/39713-data-skill-position-write-selfcheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/skills': patch
---

docs(skills): the data skill checks every position's writes after writing permission sets

Clause-②: no
Metadata-protocol: none

An app built from a business description often left out one write the description gave a position: the person who was promised it got `PERMISSION_DENIED` on save. `skills/objectstack-data/rules/security.md` now has a short ordered self-check, run after writing the sets: list each position's writes from the description, find each in a set it names (or the `isDefault` set), and once published confirm each with `GET /api/v1/security/explain?object=&operation=&userId=`. The explain paragraph under "Grant looks inert?" moved into that step. `objectstack-mcp-build` points at the check before the hand-over, and a new eval case covers it.
25 changes: 23 additions & 2 deletions scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,19 @@ export const CEILINGS = new Map([
// deleted directly. REPLACED, nothing kept beside it. 19868 -> 19861 bytes, pinned AT the
// measurement.
// ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(19861 / 4)
['skills/objectstack-data/rules/security.md', 4966],
// 4966 -> 5163 (objectstack#39713): § Built from a description? Check every position's writes,
// an ordered self-check (list each position's writes, find each in a set it names, confirm
// with `security/explain` once published, for `update` / `delete` on a row another user owns
// too, read by `record.visible`); five of nine haiku-built scenario apps denied a persona a
// write its description gave it. The ruling of record that orders this text is the
// maintainer's 「做」 on the eval seat's proposal (quoted in the card body, 2026-12-04), which
// authorises its own measured delta; raise path also the standing ruling
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068). Nothing was paid down: the explain
// paragraph under 'Grant looks inert?' (the route, the enforcing-path clause and the caller
// gate) was RELOCATED into step 3, not restated, leaving a pointer, so the whole delta is the
// new text. 19864 -> 20651 bytes, ceiling +197, the measured delta, pinned AT the measurement.
// ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(20651 / 4)
['skills/objectstack-data/rules/security.md', 5163],
// 3024 -> 3109 (2026-08-31 app-repo-principles raise, see the block above).
// Severity Levels listed the three values and left the CHOICE unstated: a
// block rests on a judgement a person made, so a machine-inferred signal — a
Expand Down Expand Up @@ -3202,7 +3214,16 @@ export const CEILINGS = new Map([
// ceil(($(wc -c < skills/objectstack-mcp-build/SKILL.md) - 27) / 4) == ceil(4915 / 4)
// = 1229 (+3), the measured remainder only. Pinned AT the measurement, zero
// headroom; no other row moves.
['skills/objectstack-mcp-build/SKILL.md', 1229],
// 1229 -> 1269 (objectstack#39713): one § 4 bullet before the hand-over pointing a session
// that wrote permission sets at the objectstack-data `rules/security.md` write self-check,
// and handing its explain step to the person for after publishing (the door has no explain
// tool and explain reads published metadata). Same ruling of record (the maintainer's 「做」)
// and standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068) as the
// security.md row; nothing in the file restates it, and nothing is paid down here or there
// (the security.md paragraph was relocated, not cut). 4942 -> 5100 bytes, less the 27-byte stamp line:
// ceil(($(wc -c < skills/objectstack-mcp-build/SKILL.md) - 27) / 4) == ceil(5073 / 4)
// = 1269 (+40), the measured remainder only. Pinned AT the measurement, zero headroom.
['skills/objectstack-mcp-build/SKILL.md', 1269],

// ── the objectstack-project skill joins the catalog ──
// A new published process skill: how a change moves through a metadata-app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,16 @@
"must_contain": ["allowExport: true", "allowRead: true", "fin_accountant"],
"must_not_contain": []
}
},
{
"id": 40,
"prompt": "Build the permissions for our asset app from this description. Employees request an asset checkout. The asset administrator approves each checkout and, when the asset comes back, records the return date and its condition on the checkout record. Objects: `asset` and `asset_checkout`. Positions: `asset_employee` and `asset_admin`. Before you hand over, how do you confirm each position can do what the description says?",
"expected_output": "Reconcile each position's writes with its sets before handing over. From the description: employees create `asset_checkout` (and read `asset`); the asset administrator edits `asset_checkout` (approves it, records the return date and condition). So the set the `asset_admin` position names carries `asset_checkout: { allowRead: true, allowEdit: true }`, and the employee's set carries `asset_checkout: { allowRead: true, allowCreate: true }`; a position grants only the sets its `permissionSets` names. Leaving `allowEdit` off the administrator's set is the miss that refuses the return with `PERMISSION_DENIED`; the verb may be withheld only when a `runAs: 'system'` flow alone makes that write. Then, once published, ask `GET /api/v1/security/explain?object=asset_checkout&operation=update&userId=ID` for a user holding `asset_admin` (and `operation=create` for an employee) and expect `allowed: true`; `allowed: false` names the layer that denies. That answers the object only: the checkout is a row an employee owns, so ask the update again with `&recordId=` of such a checkout and expect `record.visible: true`. On a `private` checkout the administrator's set also needs a `writeScope` reaching the owner (or `modifyAllRecords: true`), else that row is refused.",
"files": [],
"assertions": {
"must_contain": ["allowEdit: true", "allowCreate: true", "security/explain", "operation=update", "recordId"],
"must_not_contain": []
}
}
]
}
23 changes: 18 additions & 5 deletions skills/objectstack-data/rules/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@ for that set and user, may `POST /api/v1/data/sys_user_permission_set`; plain
CRUD bits on the table do not.

**Grant looks inert?** Check in order: the set is switched off; the validity
window has passed; `organization_id` mismatch.
`GET /api/v1/security/explain?object=&operation=&userId=` answers from the
enforcing code path. Explaining another user takes `manage_users`,
administering one of their organizations, or a delegated `adminScope` covering
them.
window has passed; `organization_id` mismatch; then explain (step 3 below).

## Built from a description? Check every position's writes

The commonest build miss is a position refused a write the description gives it.
After writing the sets, in order:

1. List each position's writes from the description: object and verb.
2. Find each in a set it names, or the `isDefault` one:
`allowCreate` / `allowEdit` / `allowDelete` beside `allowRead`. Missing ⇒ add it,
unless only a `runAs: 'system'` flow makes that write.
3. Once published, for a user holding each position, ask per verb
`GET /api/v1/security/explain?object=&operation=&userId=` (`create`, `update`,
`delete`): it answers from the enforcing code path, and `allowed: false` names the
layer that `denies`. That is the object; for `update` / `delete` add `&recordId=` of a
row another user owns and read `record.visible` (sharing, `writeScope`). Explaining
another user takes `manage_users`, administering one of their organizations, or a
delegated `adminScope` covering them.

## Row-Level Security (RLS)

Expand Down
2 changes: 2 additions & 0 deletions skills/objectstack-mcp-build/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ helper.
- Never clear a refusal by dropping what the user asked for. Where the hint
leaves a choice only the user can make, ask.
- `list_drafts` before you report. Not all its drafts are yours.
- Wrote permission sets? First check every position's writes (objectstack-data
`rules/security.md`); give the person its explain step for after publishing.

## 5. Hand over to a person

Expand Down
Loading