Skip to content

docs(adr): ADR-0046 §6.7 amendment — a book audience can name a capability - #37663

Merged
os-zhuang merged 1 commit into
mainfrom
claude/project-thread-a4oj04
Nov 26, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/project-thread-a4oj04

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Part of #36029 — the ADR half. The code half, #37591, merged as 81c68b3; the seat closes the card once this one has merged too.

Clause-②: no
Metadata-protocol: none
Skills-docs: none — a note to an ADR; the user-facing docs (content/docs/ui/doc-pages.mdx) landed with #37591
Skip-changeset: an ADR note releases nothing — no package changes, so there is no version to bump (skip-changeset label)

维护者速读

  • 给 ADR-0046 §6.7 补一条只增不改的注记:书的可见范围多了一种写法「持有某项系统权限的人」,按你 11-24 选的方案 A 落地,代码已在 feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591 合并。
  • 注记写明三件事:新写法怎么判定(看调用者自己的系统权限,缺失即拒)、为什么不能只写权限集名(setup.access 由多个权限集授予)、以及一条编写规则(受限的书要按名字认领页面,不能用 include: '*')。
  • 只是文档,不改任何行为;出错的最坏情况是 ADR 描述不准,撤回即可。
  • 可能需要你:改的是 docs/adr/**,若座位判为 Tier H,需你批准后才能合并。

What changes

One add-only amendment block in docs/adr/0046-package-docs-as-metadata.md §6.7, placed right after the existing framework#3963 amendment (+32 / −0; no existing line touched, the Status line included, so the generated ADR index is unchanged). It records:

  • book.audience gains a fourth form, { systemPermission: 'TOKEN' } (strict): a signed-in caller whose own systemPermissions holds the capability, through any permission set — the list an app's requiredPermissions is judged on. Anonymous, or an absent / non-list list, is denied (fail closed, ADR-0049). The set form and the capability form read two lists and never satisfy each other. On the MCP docs tools, a delegated OAuth grant is judged on the delegating person's own capabilities (ADR-0090 D10). The §6.7 union rule is unchanged.
  • Why: { permissionSet } names one set, and setup.access comes with several. Ruling of record 7122770897 (「A 按系统权限判定」); first consumers setup_manual / studio_manual.
  • One authoring rule: a gated book claims its pages by name, never include: '*' — an unstamped stored doc is in every package scope (contract review S1 on feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591, 7196156631).

Drafted at the ADR tier the surface mandates, then checked sentence by sentence against the merged code (packages/spec/src/system/book.zod.ts, packages/rest/src/meta-item-read-gate.ts, packages/runtime/src/domains/mcp-package-docs.ts, the two manual files).

Tests

No code. The 21 gate commands dispatch-gates --commands derives for this diff all ran at this head and exited 0 (--ran reconciliation: 21 of 21, 0 NOT-MEASURED), among them check:adr-index, check:adr-anchors, check:adr-symbol-anchors, check-adr-links.mjs, check:doc-authoring and check:pm-governed-merges. overlap-check: clean.

Verification

Read docs/adr/0046-package-docs-as-metadata.md from the > **Amendment (objectstack#36029, 2026-11-26).** line; then the arm in packages/spec/src/system/book.zod.ts (audienceAllows).

Landing: docs/adr/** is a governed surface. The seat judges Tier S (add-only ADR note) or Tier H on check-governed-merges.mjs; ADR-0046 names no decision or status heading, which the add-only reader may refuse.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc


Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 26, 2026
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e5675cff5a4ab128c8055644f22ffa985399d603
Local-runs: none
Scope: docs/adr/0046-package-docs-as-metadata.md + none
Security-touching: yes

First round. Read: card #36029 (its body and all six comments, the ruling record 7122770897 among them), this PR's body, file list and net diff against main (one file, +32 / −0), and the check-runs on the head. The code the block describes was read on main at 82e45276ae, where the code half, #37591, sits as 81c68b31bd. Nothing was built or run.

The yes on the security line is meant: every paragraph of the block teaches who may read a gated book, so the PR stays Tier H and owes the security label.

Check-runs on the head, read at 2026-11-26T18:42Z: 49, all completed. 26 success, 23 skipped, none failed, none pending. Of the eleven required contexts, Lint & Repo Gates, TypeScript Type Check, Test Core, Test UI, Dogfood Regression Gate and Governed Surface Queue Guard read success; Build Core, Lint UI, Type Check UI, Build & E2E UI and Live E2E UI read skipped, the path filter's answer for a diff of one ADR file. Lint · docs & code guards, Check Documentation Links, Check Changeset and PR-body guards read success.

① Derived judgments

  • Accept set: unchanged by this diff, and described right. The block says book.audience has four forms, the fourth { systemPermission } and strict. BookAudienceSchema on main is that union (packages/spec/src/system/book.zod.ts, the fourth arm .strict()). The diff itself parses nothing: no schema, export, lint or runtime line moves.
  • Public surface: none. One governed file, docs/adr/**. No package file, so nothing publishes.
  • Add-only: yes. One hunk, 32 lines added and none removed, placed after the framework#3963 amendment and before the "Two frontend surfaces" paragraph. The Status line, the §6.2 sketch, the §6.7 bullets and the earlier amendment are untouched. The generated index reads the Status line only, so it does not move.
  • Governed rule text: one authoring rule is new to the ADR (a gated book claims its pages by name, never by include: '*'). It is the sentence content/docs/ui/doc-pages.mdx already teaches on main and the shape both shipped manuals use. Right.

② Semver level

No changeset, and none is owed: the diff touches no released package. The skip-changeset label is on the PR and Check Changeset passed. Clause-②: no and Metadata-protocol: none are right for this diff; the widening was declared (Clause-②: yes (widening), Metadata-protocol: added) and released by #37591.

③ Boundary flags

  • The card's one open question (os-dev report 7112446659, options A to D) is answered by ruling record 7122770897, option A. The block quotes it as 「A 按系统权限判定」, which is the quotation on the card, unaltered.
  • The ruling's relay named an ADR-0046 §6.7 note among the deliverables; this PR is that note, split from the code PR as claim 7194108111 says. The split also follows the status-hygiene rule in docs/adr/README.md: the implementing PR left docs/adr/** alone.
  • Holdings source. The relay's route bullet has the callers fill the list from resolvePermissionSetsForContext. main reads the caller's own systemPermissions (resolveAudienceCaller in packages/rest/src/meta-item-read-gate.ts), the list holdsRequiredPermissions reads for an app. The block says what main does ("whose own systemPermissions list"), and that is the ruling's quoted intent: every admin who can open Setup can read it.
  • The PR body's flag, that ADR-0046 has no heading the add-only reader can classify: not a finding. The PR is Tier H on that reading and on the security line above.
  • Author. objectstack-fleet[bot]; no off-relay author to name.
  • SQL push-down. No code in the diff: no id materialisation, no in-app join.
  • Taught, not enforced. No lint flags a gated book that includes '*': the rules in packages/lint/src on main resolve a book audience's set name and its capability token, and none reads include against the audience. The block claims no enforcement, so it is as narrow as the tree. A lint for it is a candidate follow-up card, outside this diff.

④ Design judgment

No must-fix, no should-fix.

docs/adr/0046-package-docs-as-metadata.md, each sentence of the block against main:

  1. One gated form originally, sketched as { profile }, shipped as { permissionSet }. Holds: the §6.7 bullet and the §6.2 sketch say { profile }; BookAudienceSchema carries { permissionSet }.
  2. A fourth form, { systemPermission: 'TOKEN' }, a strict object. Holds: book.zod.ts, the fourth union arm, .strict().
  3. Admits a signed-in caller whose own list holds the capability, through any permission set. Holds: audienceAllows requires authenticated and systemPermissions.includes(token); the list is folded over every set the caller holds (foldCatalogSetBodies, packages/core/src/security/resolve-authz-context.ts).
  4. The list an app's requiredPermissions is judged on. Holds: resolveAudienceCaller and callerSystemPermissions both read systemPermissions off the one caller resolveCaller() returns. See N1 on "exactly".
  5. Anonymous denied; an absent or non-list list denied. Holds: audienceAllows returns false before any form is read when unauthenticated; resolveAudienceCaller leaves the list undefined unless it is an array, and audienceAllows then denies.
  6. The two gated forms read two lists and never satisfy each other. Holds: one reads permissionSets, the other systemPermissions; book.test.ts pins both directions.
  7. MCP docs tools: a delegated OAuth grant is judged on the person's own capabilities, as for the set form. Holds: packageDocsReadGate in packages/runtime/src/domains/mcp-package-docs.ts supplies resolveAudienceSystemPermissions from delegatorHoldingsCaller only when the caller is an agent acting for a person, the same holder the set form's resolver reads. See N3.
  8. Effective audience is still the union over the claiming books. Holds: resolveDocAudiences, docAudienceAllows (some).
  9. setup.access is granted by several sets. Holds: organization_admin (default-permission-sets.ts), admin_full_access (ADMIN_FULL_ACCESS_CAPABILITIES), and the delegated-admin pattern in content/docs/permissions/delegated-administration.mdx.
  10. Ruling A, record 7122770897, implemented by feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591. Holds: the record is on the card; feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591 is 81c68b31bd on main.
  11. First consumers setup_manual and studio_manual, from @objectstack/setup and @objectstack/studio, gated on setup.access and studio.access. Holds: packages/apps/setup/src/setup-manual.book.ts, packages/apps/studio/src/studio-manual.book.ts, both registered in their package's index.ts; the two apps require exactly those tokens (setup.app.ts, studio.app.ts).
  12. Before, no book claimed those docs, so they fell back to org. Holds: it is the card's premise, and the org fallback is resolveDocAudiences' own. The doc arm of the item gate has no author exemption, so "only for callers who can open those apps" holds on every door that gate serves.
  13. A package scope leaves out only a doc stamped with another package; a catch-all gated book would take an unstamped doc. Holds: matchesInclude returns false only when both ids are set and differ; book.test.ts pins the unstamped doc and the catch-all control.

Against the earlier text of ADR-0046: nothing is contradicted. The block opens by naming what the section "originally gave" and what is added, the form the framework#3963 amendment uses. The Status line's "§6.7 audience gating in the REST read gate" stays true. The first amendment's anonymous rule (only 'public' admits an anonymous caller) agrees with sentence 5. First consumer and execution plan: both consumers are on main and the block adds no phase, so nothing is left pending.

Nits, none of which moves this head:

  • N1 (nit): "opens for exactly the callers who can open its app" is exact when the app's gate is that one capability, which is how the jsdoc on main spells it (requiredPermissions: [token]) and what both first consumers are. An app that requires several capabilities needs all of them, and an audience names one, so there the manual is wider than the app. Accepted deviation; "an app gated on that capability" would close it at the next prose touch.
  • N2 (nit): the §6.7 bullet above still reads "The enum never grows; richer gating is just a richer profile reference", and the block says "a fourth form" without saying how the two square. My reading is that they do: the new form is a reference into the permission model, not a new bespoke literal, and it rests on a ruling of record, so no decision is reversed and no Status change is owed. One clause saying so would spare the next reader the comparison. Accepted deviation, and the maintainer's to read otherwise at approval.
  • N3 (nit): the parenthesis cites ADR-0090 D10, whose rule 1 is an intersection. The module header on main gives the reading the code takes (the token's ceiling decides whether the docs tools are reached at all; the person's holdings decide which manuals open), and the block carries only its second half. True as written; accepted deviation.

Implemented-by: claude/project-thread-a4oj04
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head e5675cf · card #36029 · area s2-data · 2026-11-26T18:44Z

L1 checklist

  • Shape and relation. l1-face.mjs --pr 37663 read 13 items and flagged none: 26 success, 23 expected skip, none failed or pending; mergeable_state clean. One file, docs/adr/0046-package-docs-as-metadata.md, +32 / −0; skip-changeset is right for an ADR-only diff.
  • Part of #36029 is right. The card's code landed in feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591; this block records it in ADR-0046 as an add-only amendment, placed after the framework#3963 amendment, with the Status line and every earlier line untouched. The card keeps pm:dispatched until the seat closes it after this merge.
  • Contract review. Record 7200775826 on this head: PASS, no must-fix, no should-fix, nits N1–N3 accepted as deviations. All 13 statements of the block hold against main. Adopted. The record says Security-touching: yes (the block teaches who may read a gated book), so the security label goes on with this hand-off. N2 (the §6.7 "the enum never grows" line beside "a fourth form") is left to the approver's reading; the seat reads no decision reversed, since the fourth form is a reference into the permission model under ruling 7122770897.
  • Follow-up. The reviewer's out-of-scope note (a gated book that claims by include: '*' is taught, not linted) is appended to review follow-ups of PR #37591 #37613, which already holds the matching N4 of PR feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591.
  • Governance. check-governed-merges.mjs: governed (docs/adr/**), Tier H.

Tier: H. Landing: hand-off to the approver by the next stroke; ⛔ the seat does not merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Tier H hand-off · 2026-11-26T18:46Z · head e5675cf · approver os-zhuang

维护者速读

  • 改了什么: 在架构决策记录 ADR-0046(包文档作为元数据)末尾补一段说明,记下 feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591 已上线的做法:一本手册可以按「系统权限」决定谁能看,Setup 和 Studio 两本手册只开给能进对应应用的人,并且只认领自己包的文档。只增不改,原有内容一字未动。
  • 影响: 只是文档,产品行为不变。以后写受限手册的人有据可查。
  • 审核: 席位 L1 已 ACCEPT(本评论前一条)。契约审核 7200775826 PASS,13 句逐句对照已合并代码都成立,没有必须改或建议改的项。三条小问题按接受处理,其中一条请你批准时留意:原文说「这个枚举不会再扩」,这段又写「第四种形式」,我读作没有推翻原决定,因为新形式是引用权限模型、有你 11 月的裁决在先。内容讲的是谁能读受限手册,按规则挂 security 标签。
  • 要你做什么: ADR 是受管面,需要你批准后才能合并。撤回这一次合并即可恢复原文。

@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 26, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 18:58
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit c72ad57 Nov 26, 2026
60 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-a4oj04 branch November 26, 2026 19:43
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 security size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants