Repository navigation
Commit cd6c807
docs(skills): objectstack-data security.md teaches that a package's sharing rule resolves its queue recipient from its package (#31777)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbFxEKiXgxakmwSrdiRAhytb)_
Fixes #31735
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:发布的 `objectstack-data` 技能 `rules/security.md`
补了一条:软件包里声明的共享规则把队列当接收方时,队列名先找本包的队列,再找它声明依赖的包(加
`sys`)里唯一的那个;都没有包声明时才落到组织自建的 `sys_queue` 行。三种拒绝各带例子和引擎的拒绝码:范围外
`outside-closure`(含只有环境项持有);两个依赖都持有
`ambiguous-in-closure`;规则能找到的那个之外还有一个非依赖包持有
`ambiguous-in-environment`。eval 加了第 18 个用例。
- 为什么改:ADR-0150 E4(PR #31728)合并后引擎已这样解析,但技能没写,AI 会写出能加载、运行时却被拒、谁也不授权的规则。
- 风险与回滚:只改技能文字和 eval,不改任何运行时代码。为不超 token 上限,删了 9 处(共 459 字节)来抵付新段落(446
字节):8 处是文件内别处已讲过的重复或作者用不到的包名指针,1 处是实质删减「旧 SQL 风格谓词仍经弃用桥编译」。逐条清单见下文和
changeset。回滚即 revert 本 PR。
- 先看:`skills/objectstack-data/rules/security.md` 第 169–175
行新段落;同文件其余删减;`evals/hooks-security-seeds-datasources.json` 的 id 18。
- 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 security.md
一行显示 3764 tokens、ceiling 3768,退出 0。
- 需要你做的:审阅后批准本 PR(Tier H,`skills/**`)。
## What changes
- **`skills/objectstack-data/rules/security.md`** gains one bullet under
the membership-key "Choose by what the rows are keyed on" bullet, the
one that sends a team's records to a sharing rule with `sharedWith: {
type: 'queue', value: QUEUE_NAME }`. It teaches what the merged engine
does (`packages/plugins/plugin-sharing/src/sharing-rule-service.ts`
`assertQueueRecipientReachable`,
`packages/objectql/src/package-scoped-resolver.ts`
`resolvePackageScopedName`):
- a package's rule reads the queue name as its own package's queue, else
the one holder in its declared `dependencies` closure plus `sys`, else,
when no package or environment item declares the name, an organization's
`sys_queue` row (the resolver's not-found passes through to the queue
service);
- refusal `outside-closure` (resolver L198, L408): the only holder is a
package outside the closure, or an environment-authored item (D3 (a));
example: only a non-dependency holds `support`;
- refusal `ambiguous-in-closure` (resolver L194, L399): two dependencies
hold the name, and step 2 refuses before anything else is asked;
- refusal `ambiguous-in-environment` (resolver L196, L360): the holder
the rule reaches (its own package or one dependency) and a
non-dependency both hold it; the package check passes, then the queue
service, which has no caller package, refuses a name two packages hold
(`package-scoped-declarations.ts` `resolveDeclaredName`; PR #31728's
acceptance note, carrier #31734);
- a refused rule grants no one new; the throw is
`PackageScopedNameRefusedError`, `code = 'RESOURCE_CONFLICT'`
(`package-scoped-declarations.ts` L181), warned once
(`reportRefusedDeclaration`), and each recompute keeps the rule's
standing grants (`sharing-rule-service.ts` L1511–1527).
- **Paid inside the file.** The token ceiling is 3768 and had 0 headroom
on main. The new bullet (446 B) is paid for by nine cuts in the same
file (459 B; 15069 → 15056 bytes, 3764 tokens):
- `(PermissionSetSchema.rowLevelSecurity)` after "permission set /
profile" (41 B). Survivor: the same sentence names `rowLevelSecurity` on
a permission set.
- "(the tenant wall still applies)" in the RLS default-deny sentence (32
B). Survivor: the Layer 0 bullet, "AND-composed ahead of all business
RLS".
- The sentence that a legacy SQL-style `=` / `IN (...)` predicate still
compiles through a deprecated bridge (98 B). **Not a restatement**: the
file now teaches canonical CEL only.
- The four "(for `IN`)" notes in the `current_user.*` table (42 B).
Survivor: `field in current_user.ARRAY` in the predicate list above.
- The membership-key section intro, shortened to "Declare the set on the
roster object, not one policy per record." (80 B). Survivors: the
section heading and the "Choose by" bullet's "a named record → a
membership key".
- "(`isDefault` sets)" after the `everyone` baseline in the Positions
section (19 B). Survivor: the `isDefault: true` bullet that defines it.
- The admin-only recipe's `tenancy` comment "not a tenant object → Layer
0 contributes nothing" (55 B). Survivor: the blockquote below it.
- The blockquote's "it is the half that holds however permissive the
grants" (59 B). Survivor: the `requiredPermissions` paragraph (AND-gate,
strictest-wins).
- "(`@objectstack/plugin-security`)" after `sys_user_permission_set` (33
B), a package pointer an author never writes (seat ruling A).
- Kept on the seat's rework: the `(definePermissionSet)` example comment
and the field-lock recipe docs link.
-
**`skills/objectstack-data/evals/hooks-security-seeds-datasources.json`**
gains case **18**, placed right after the queue case 8: `com.acme.crm`
shares escalated cases with `support_tier2`, the queue
`com.acme.helpdesk` ships. `must_contain`: `type: 'queue'`,
`dependencies`, `outside-closure`; `must_not_contain`: `name:
'support_tier2'` (redeclaring the queue in the rule's package makes a
second holder, refused too). Ids 1–17 keep their numbers because
changesets cite them.
- `SKILL.md` § Ownership queues (L425) read, not edited: no sentence
there is false after E4 (it names the queue, the claim and the move; it
says nothing about how a rule resolves the name).
- Changeset: `'@objectstack/skills': patch`.
## Tests
Docs and eval only; no runtime code moved, so no package suite is owed.
## Acceptance notes
- `ui/scripts/check-skill-eval-tokens.mjs` (exit 0) reads
`skills/objectui/evals` only, so it does not grade case 18. Its three
`must_contain` tokens were checked by hand as whole tokens of the
bundle: all three are in `rules/security.md`, `dependencies` also in
`references/_index.md`.
- Case 18 sits between ids 8 and 9 in the array, so the file's ids are
no longer ascending; no reader in the repo indexes evals by position.
- `check:skill-examples` is not in the derived set and was not run: no
`os:check` block was touched (the one edited code block, the admin-only
recipe, is unmarked).
- Eval case 18 asserts `outside-closure` only, so the rework's split of
the two ambiguity codes leaves it unchanged.
## Verification
Readings at head `bdbe806f` (`objectstack-ai/objectstack`; `origin/main`
`c2bb879f`):
| file | lines before → after | bytes before → after | tokens / ceiling
|
|:--|:--|:--|:--|
| `skills/objectstack-data/rules/security.md` | 314 → 317 | 15069 →
15056 | 3768 → 3764 / 3768 |
| `skills/objectstack-data/evals/hooks-security-seeds-datasources.json`
| 175 → 185 | 14669 → 15672 | eval fixture, not ratcheted |
| all `skills/**/SKILL.md` | 4599 → 4599 | unchanged | — |
| `skills/objectstack-data/**/*.md` | 3803 → 3806 | — | — |
<details><summary>Derived gates (dispatch-gates --commands, 44
families)</summary>
43 exit 0. `pnpm check:dual-build-cjs-loads` exits 3 (PREREQUISITE NOT
MET, needs every package's dist): NOT MEASURED, left to CI. `pnpm
check:lean-entry-closure` exited 3 first and 0 after building
`@objectstack/objectql`. `dispatch-gates --ran`: 44 derived, 43 run, 1
NOT-MEASURED, 0 UNRUN. Prerequisite builds: formula + lint (5 tasks),
objectql (14 tasks).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jRBKizw1wwxaE5fdqj)_
<!-- signed: domain:skills#2 · zhuangjianguo ·
session_01QsR2jRBKizw1wwxaE5fdqj -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f25414e commit cd6c807
3 files changed
Lines changed: 53 additions & 16 deletions
File tree
- .changeset
- skills/objectstack-data
- evals
- rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
| 97 | + | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 116 | + | |
120 | 117 | | |
121 | 118 | | |
122 | 119 | | |
| |||
169 | 166 | | |
170 | 167 | | |
171 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
172 | 176 | | |
173 | 177 | | |
174 | 178 | | |
| |||
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | | - | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
| |||
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
293 | | - | |
| 297 | + | |
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
| |||
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
302 | | - | |
303 | | - | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
0 commit comments