Repository navigation
Commit 7c70f91
docs(skills): objectstack-data teaches the field permission
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ89XwmVLX9dBejfHmWEYgMwG)_
Fixes #26179
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:`skills/objectstack-data/rules/security.md` 新增一节「字段权限的行条件
`when`」:先写选择规则(所有人都锁 → 验证规则;按角色锁 → 该权限集字段项上的
`when`,二者不并用),再给合同示例,再列四条边界(只管编辑、仅同对象字段、按更新前的行判定、只锁不授),末尾指向文档与配方。`SKILL.md`
的 `readonlyWhen` 一行加一句「对所有人;按角色用 `when`」(在余量内,不抬上限)。eval 文件加第 5
题(合同提示,期望 `when` + `readable: true`,不得出现验证规则或 `readonlyWhen`)。两行 token
上限按实测抬高,裁决原文写在行旁。首轮门禁 `check:role-word` 拒了「按角色」的英文拼法(保留词),已改为 permission
set。
- **为什么改**:客户的 AI 作者按技能建应用,遇到「财务审批后不得改合同法律条款」会写验证规则,把字段对所有人锁死;`when` 已随
18.2 发布但技能没教「选它」,能力就一直用不上。
- **风险与回滚**:只改发布技能包的文字与一个 eval 夹具,不改运行时;回滚即 revert 本 PR(两行上限随之回落)。
- **先看**:① `skills/objectstack-data/rules/security.md`
新节(选择规则两条、示例一段、边界四条);② `scripts/check-skills-token-ratchet.mjs`
两行上限及其注释引的裁决;③ `evals/hooks-security-seeds-datasources.json` 第 5 题。
- **两分钟验证**:`node scripts/check-skills-token-ratchet.mjs` → 末行 `81
authored bundle file(s) within their ceilings`,其中 `rules/security.md is
2956 tokens (ceiling 2956; headroom
0)`、`hooks-security-seeds-datasources.json is 1095 tokens (ceiling 1095;
headroom 0)`。
- **需要你做的**:Tier H(`skills/**`),请 approve 或直接 Merge when ready。
## What changes
Card #26179, items 1–4:
1. **`rules/security.md` — a `when` section** (placed before "Sensitive
fields"): what it is (a row condition on a field entry's **edit** vote,
in the canonical CEL of `rowLevelSecurity[].using`), the choice rule
stated first, the contract example from the card
(`'clm_contract.governing_law': { readable: true, editable: false, when:
"status in ['approved', 'signing', 'active']" }`), then the boundaries:
edit vote only (`readable: false` beside `when` is refused), same-object
fields (no relation reach; refused at `os validate` / publish),
pre-image on update (a write cannot unlock itself by moving `status`
back; an insert on the row as sent), locks and never grants (unmatched
rows fall back to the other grants; another held set's `editable: true`
still wins).
2. **The choice rule, as a rule:** a lock that holds for everyone is a
validation rule (and `readonlyWhen` likewise strips the write for
everyone); a lock that depends on who edits is `when` on the field
entries of each permission set that loses the edit. Never both for one
need. (`check:role-word`, ADR-0090 D3, refuses the reserved word in
prose, so the teaching says "permission set" where the card says role.)
3. **Eval 5** in `evals/hooks-security-seeds-datasources.json`, in the
file's existing shape: the contract prompt; expected output names `when`
on the finance set's entries with `readable: true` and no validation
rule / `readonlyWhen`; `must_not_contain` pins `validations:` and
`readonlyWhen`.
4. **Pointers**: the section ends with the docs anchor
`field-level-security#row-conditioned-edit-locks-when` and the recipe
anchor
`access-recipes#data-lock-fields-for-a-position-once-a-record-reaches-a-stage`
(both exist on `main`). `references/_index.md` is generator-owned
(`gen:skill-refs` from `SKILL_MAP`; `permission.zod.ts` is already
listed), so the pointer lives in `security.md`, not the index.
Also: one clause on `SKILL.md`'s `readonlyWhen` line — the place an
author reaches for the lock-for-everyone — naming the per-set
alternative. It lands inside the file's headroom (raw 6104 → 6125
tokens; the ratchet's priced count 6120, ceiling 6123), no raise.
**Token-ratchet rows** (`scripts/check-skills-token-ratchet.mjs`), per
the maintainer's ruling on the seat's decision card 「skills 修复卡的教学和 eval
都撞 token 天花板,怎么付?」, tap **A** (2026-10-27 01:21Z), verbatim and
untranslated: 「A:先削重复,余额按实测提高」. Step one, cut duplicates first: measured
on `origin/main` `756220c4`, `rules/security.md` carries no repeated
sentence and nothing the package states twice (its `secret` /
`requiredPermissions` teaching is the only full one; `SKILL.md:305` and
`field-types.md:45` are one-line table cells), and the eval file repeats
nothing — so there was nothing to cut and no surviving-home list to
give. Step two, raise by the measured remainder: `rules/security.md`
2563 → 2956 (+395 landed on 2561, 2 absorbed by headroom, ceiling +393);
`evals/hooks-security-seeds-datasources.json` 894 → 1095 (+201, zero
headroom). Both rows re-pinned at zero headroom; the comments beside
them quote the ruling.
**Two readings** (lines, and tokens as the ratchet counts them,
`ceil(utf8 bytes / 4)`; the SKILL.md token reading here is the raw file,
the ratchet's priced count excludes the version line):
| File | Lines before → after | Tokens before → after |
|:--|:--|:--|
| `rules/security.md` | 220 → 249 (+29) | 2561 → 2956 (+395) |
| `SKILL.md` | 465 → 466 (+1) | 6104 → 6125 (+21) |
| `evals/hooks-security-seeds-datasources.json` (not .md, reported for
the raise) | 45 → 55 (+10) | 894 → 1095 (+201) |
| **Whole package** (`SKILL.md` + `references/**/*.md` +
`rules/**/*.md`, 14 files) | **3705 → 3735 (+30)** | **39046 → 39462
(+416)** |
Nothing removed: the card names no stale line in this package.
Sequencing (zero verbs beside these numbers): #26297 edits the same
`rules/security.md` and is dispatched after this lands; #26244 adds a
line to `references/_index.md`, which this PR does not touch; #26178 is
the companion docs card, already closed.
`skip-changeset`: the published skills packages carry no `package.json`;
nothing is released from any package.
## Tests
- `node scripts/check-skills-token-ratchet.mjs` — exit 0: `81 authored
bundle file(s) within their ceilings`, the two raised rows at headroom
0, `SKILL.md` at headroom 3.
- `node scripts/check-skills-token-ratchet.mjs --self-test` — exit 0,
`79 cases pass`.
- `pnpm --filter @objectstack/spec run check:skill-docs`,
`check:skill-refs`, `check:skill-examples` — see Verification (the new
code block is a fragment, deliberately not marked `os:check`, like the
file's RLS block).
- Eval 5 is a fixture (the repo has no eval runner): its assertions were
checked by hand against the expected output — every `must_contain`
string occurs in it, neither `must_not_contain` string does.
## Acceptance notes
- `evals/README.md` (headroom 1 token) was not updated to name `when` in
its topic list; a one-line mention would need another raise for five
tokens. Not filed: observation only.
- The dispatch order's "`skills/**` inside the package's ceilings"
cannot hold at the measured headroom (security.md 2, eval 0); the seat
widened the surface to the two ratchet rows under the ruling above.
- The PR body's first two lines are the harness-written attribution
block (the os-dev exception); `Fixes #26179` follows immediately.
## Verification
Gate list derived with `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` on the final tree (`756220c4` base,
head `5f62d15b`), each run locally with the exit code captured before
any pipe; `--ran` reconciliation below.
**Reconciliation** (`node scripts/pm/dispatch-gates.mjs --ran ran.list
--repo objectstack-ai/objectstack`, exit 0): `52 derived, 51 run, 1
NOT-MEASURED, 0 UNRUN`. The one NOT MEASURED is `pnpm
check:dual-build-cjs-loads`: its prerequisite is a whole-repo build (111
packages without `dist/` on this fresh worktree); this diff touches no
package source, and CI's `Lint & Repo Gates` runs it — a declared
narrowing. Three derived gates refused on a missing build on the first
pass (`check:doc-formula-expressions`, `check:lean-entry-closure`,
`check:skill-examples`); the named closures were built under
`scripts/pm/os-verify-lock.sh` (slot `issue-26179`: formula+lint 94 s,
objectql 61 s, client-react 149 s) and the gates then exit 0 on the
final head. `check:role-word` was red on the first head (the reserved
word in the new prose, ADR-0090 D3) and is green on `5f62d15b`.
`check:pm-dispatch-gates` ran detached on the final head: 332.2 s fast
tier, 1901 cases, exit 0.
<details><summary>Every derived command with its exit code on 5f62d15
(54 lines: the 52 derived, plus `check:skill-refs` and
`check:skill-examples` the dispatch order asked for)</summary>
- `node scripts/check-ci-filter-parity.mjs` — exit 0
- `node scripts/check-closing-keyword-parity.mjs` — exit 0
- `node scripts/check-closing-keyword-parity.mjs --self-test` — exit 0
- `node scripts/check-comment-mask-corpus.mjs` — exit 0
- `node scripts/check-declaration-mirrors.mjs` — exit 0
- `node scripts/check-declaration-mirrors.mjs --self-test` — exit 0
- `node scripts/check-doc-route-spelling.mjs --advisory` — exit 0
- `node scripts/check-doc-route-spelling.mjs --self-test` — exit 0
- `node scripts/check-dts-emitted.mjs --self-test` — exit 0
- `node scripts/check-scripts-symbol-anchors.mjs` — exit 0
- `node scripts/check-scripts-symbol-anchors.mjs --self-test` — exit 0
- `node scripts/check-self-test-wired.mjs` — exit 0
- `node scripts/check-self-test-wired.mjs --self-test` — exit 0
- `node scripts/check-self-test-workflow-commands.mjs` — exit 0
- `node scripts/check-self-test-workflow-commands.mjs --self-test` —
exit 0
- `node scripts/check-skills-token-ratchet.mjs` — exit 0
- `node scripts/check-skills-token-ratchet.mjs --self-test` — exit 0
- `node scripts/check-whole-set-label-write.mjs` — exit 0
- `node scripts/check-whole-set-label-write.mjs --self-test` — exit 0
- `node scripts/ci/assert-turbo-remote-cache.mjs --self-test` — exit 0
- `node scripts/ci/prune-turbo-cache.mjs --self-test` — exit 0
- `node scripts/pm/bare-root-worklist.mjs --self-test` — exit 0
- `pnpm --filter @objectstack/lint run check:doc-formula-expressions` —
exit 0
- `pnpm --filter @objectstack/spec run check:skill-docs` — exit 0
- `pnpm check:agent-test-spelling` — exit 0
- `pnpm check:bash32-floor` — exit 0
- `pnpm check:cli-command-ids` — exit 0
- `pnpm check:corpus-claim-drift` — exit 0
- `pnpm check:cross-package-test-inputs` — exit 0
- `pnpm check:doc-authoring` — exit 0
- `pnpm check:driver-memory-census` — exit 0
- `pnpm check:dts-closure` — exit 0
- `pnpm check:dual-build-cjs-loads` — NOT MEASURED (exit 3, PREREQUISITE
NOT MET)
- `pnpm check:entry-guard` — exit 0
- `pnpm check:gitlink-declared` — exit 0
- `pnpm check:lean-entry-closure` — exit 0
- `pnpm check:merge-driver` — exit 0
- `pnpm check:nul-bytes` — exit 0
- `pnpm check:parse-guard` — exit 0
- `pnpm check:pm-governed-merges` — exit 0
- `pnpm check:pm-skill-id-lint` — exit 0
- `pnpm check:pnpm-filter-targets` — exit 0
- `pnpm check:pnpm-flag-spellings` — exit 0
- `pnpm check:ratchet-remedy-authority` — exit 0
- `pnpm check:refd-timer-probe` — exit 0
- `pnpm check:role-word` — exit 0
- `pnpm check:skill-compatibility` — exit 0
- `pnpm check:skill-frame-sync` — exit 0
- `pnpm check:skill-identifier-liveness` — exit 0
- `pnpm check:sourcemap-no-sources-content` — exit 0
- `pnpm check:watch-hint-literal` — exit 0
- `pnpm --filter @objectstack/spec run check:skill-refs` — exit 0
- `pnpm --filter @objectstack/spec run check:skill-examples` — exit 0
- `pnpm check:pm-dispatch-gates` — exit 0
</details>
<details><summary>Token ratchet on 5f62d15</summary>
- `skills/objectstack-data/rules/security.md is 2956 tokens (ceiling
2956; headroom 0)`
- `skills/objectstack-data/evals/hooks-security-seeds-datasources.json
is 1095 tokens (ceiling 1095; headroom 0)`
- `skills/objectstack-data/SKILL.md is 6120 tokens (ceiling 6123;
headroom 3)`
- `81 authored bundle file(s) within their ceilings; 10 generator-owned
file(s) measured, not ratcheted.`
- `--self-test`: `79 cases pass.`
</details>
<details><summary>check:skill-examples on 5f62d15</summary>
`264 prose examples type-check across 3 surface(s) — every marked block
parsed, so tsc ran the SEMANTIC pass on all of them` (the new block in
`security.md` is a fragment and is deliberately unmarked, like the
file's RLS block).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbakp4nDuCkULsj7Fyr)_
---------
Co-authored-by: objectstack-fleet[bot] <objectstack-fleet[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>when and when to pick it over a validation rule (#26393)1 parent 671df26 commit 7c70f91
4 files changed
Lines changed: 60 additions & 3 deletions
File tree
- scripts
- skills/objectstack-data
- evals
- rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
556 | 565 | | |
557 | 566 | | |
558 | 567 | | |
| |||
651 | 660 | | |
652 | 661 | | |
653 | 662 | | |
654 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
655 | 672 | | |
656 | 673 | | |
657 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
119 | 148 | | |
120 | 149 | | |
121 | 150 | | |
| |||
0 commit comments