Skip to content

docs(skills): objectstack-data security.md teaches that a package's sharing rule resolves its queue recipient from its package - #31777

Merged
os-zhuang merged 5 commits into
mainfrom
claude/project-thread-tsp3q0
Nov 9, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/project-thread-tsp3q0

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

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 feat(plugin-sharing)!: declared sharing rules, queues and assignment rules resolve on (package, name) #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 feat(plugin-sharing)!: declared sharing rules, queues and assignment rules resolve on (package, name) #31728's acceptance note, carrier spec: IOwnershipQueueService reads take the caller package, so a queue recipient resolves by D3 from its rule (ADR-0150, follow-up of E4) #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 — —
Derived gates (dispatch-gates --commands, 44 families)

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).


Generated by Claude Code

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 9, 2026
…et restored (36 B over ceiling)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jRBKizw1wwxaE5fdqj
…and definePermissionSet comment; changeset lists every cut

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jRBKizw1wwxaE5fdqj
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · zhuangjianguo · session_01QsR2jT34CXs5fCn3BDirZw

维护者速读

  • 改了什么:数据技能的 rules/security.md 补上一条:软件包里声明的共享规则,用 sharedWith: { type: 'queue', value } 引用队列时,按规则所在的包来找队列。先找本包,再找它声明的依赖闭包(加 sys)里唯一持有这个名字的包,都没有就用组织自己的 sys_queue 行。找不到或有歧义时会被拒绝,原因分三种:outside-closure、ambiguous-in-closure、ambiguous-in-environment,都会报 RESOURCE_CONFLICT 警告,规则也不会给任何新的人授权。评测集新增第 18 题,另附一个 changeset(@objectstack/skills patch)。
  • 为什么改:ADR-0150 E4(PR feat(plugin-sharing)!: declared sharing rules, queues and assignment rules resolve on (package, name) #31728)已经让共享插件按包解析队列名,技能文档还没写,AI 写出来的规则能加载,运行时却会被拒。
  • 风险与回滚:只动技能文本、一条评测和 changeset。security.md 的 token 已经顶到上限,为腾地方删了 9 处共 459 B 的文字,每一处都在 PR 正文和 changeset 里列明了删了什么、对应的内容还在哪里。只有一处是真删内容:旧 SQL 写法谓词那条「已弃用但仍可编译」的说明。回滚即 revert 本 PR。
  • 先看:security.md 新增的那条(L171 附近),以及 PR 正文里的删减清单。
  • 两分钟验证:node scripts/check-skills-token-ratchet.mjs 退出 0(3764/3768)。
  • 需要你做的:批准并入队(Tier H,因为改了 skills/**)。
  • 席位意见:ACCEPT。三种拒绝的条件,席位已逐条对过引擎代码(package-scoped-resolver.ts 的第 2、3 步,以及队列服务不带调用方包、在全环境范围内的读取)。首版把 ambiguous-in-environment 的条件写含糊了,返工后已改正。

席位核对

Head-sha: bdbe806f5473a79d860325ca1d8afb23432b42fc

  1. Shape: draft, base main, body carries Fixes #31735. 3 files: skills/objectstack-data/rules/security.md, skills/objectstack-data/evals/hooks-security-seeds-datasources.json (case 18), .changeset/31735-data-security-queue-recipient-package.md ('@objectstack/skills': patch, Clause-②: no, Metadata-protocol: none). Inside the claim's surface. Tier H (skills/**).
  2. Premise measured: on main 9e1f1f90 the queue-recipient lines said only that the rule reaches a queue's members. sharing-rule-service.ts assertQueueRecipientReachable (merged with feat(plugin-sharing)!: declared sharing rules, queues and assignment rules resolve on (package, name) #31728) resolves the name from the rule's package, and the queue service then reads it environment-wide with no caller package.
  3. Content read against code: the order is own package, then the unique holder in the closure plus sys, then a refusal naming every holder (step 3 adds an environment item to the candidates, so outside-closure), then no holder, which falls to the org's sys_queue row. Two holders in the closure: ambiguous-in-closure (step 2). One holder reached plus a non-dependency holder: the closure resolves, and the queue service's environment-wide read refuses with ambiguous-in-environment (listingRefusal / resolveDeclaredName). The refusal throws PackageScopedNameRefusedError (RESOURCE_CONFLICT, 409), and the caller keeps the rule's existing grants. So "grants no one new" is right.
  4. Gates: dev derived 44 gates on this head; 43 exit 0, and check:dual-build-cjs-loads exit 3 NOT MEASURED (needs a full build; CI runs it). Body gates exit 0. Token ratchet 3764/3768. Check-runs on this head: 27 success, 17 skipped, 2 in progress, none red. K = 5.
  5. Accepted deviations: nine cuts (459 B) to pay for the new bullet and the two restored pointers (the field-level-security recipe link and the definePermissionSet comment). Eight are restatements whose survivor the body names, and one is the deprecated SQL-predicate bridge sentence. Eval case 18 sits after case 8, so the ids no longer ascend (cases are cited by id).
  6. Landing: Tier H. pm:awaiting-merge plus reviewers os-zhuang and hotlong. The PR stays draft until an authorized approval or a maintainer enqueue.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 9, 2026 03:52
@os-zhuang
os-zhuang enabled auto-merge November 9, 2026 03:52
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit cd6c807 Nov 9, 2026
53 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-tsp3q0 branch November 9, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills: security.md says a declared sharing rule's queue recipient resolves from the rule's package (ADR-0150 E4 Skills-docs follow-up)

2 participants