Repository navigation
feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps - #37591
Conversation
…o docs open only for callers who can open those apps Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…and the REST docs doors Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…e Studio book preview; document it Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
…dger; record the capability arm on the audience liveness row; changeset; Setup docs dogfood pin Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
📓 Docs Drift CheckThis PR changes 6 package(s): 25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f5afa82e7851602d2a7f6de20f72a0889b445301 && git checkout f5afa82e7851602d2a7f6de20f72a0889b445301
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 87af66e5b6c75af7989ecbdc8820f1ca4a66596a 9d4b627c971081e8acbb07a2fd76340a54bef87c && git checkout -B drift-repro 87af66e5b6c75af7989ecbdc8820f1ca4a66596a && git merge --no-ff 9d4b627c971081e8acbb07a2fd76340a54bef87c
node scripts/docs-audit/affected-docs.mjs --json 87af66e5b6c75af7989ecbdc8820f1ca4a66596a
|
…on audience test; docs: lint resolves book audience capabilities Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Inputs read: card #36029 (body and all six comments, ruling 7122770897 included), PR #37591 (body, 25 files, net diff against ① Derived judgments
② Semver level
Two sentences of the changeset body do not hold as written: "Nothing to migrate: no stored or authored value changes meaning" (S1), and "a key beside ③ Boundary flags
④ Design judgment
The arm is what the ruling asked for: one key, a string, strict, described.
S1 (should-fix) — the two manuals claim docs that are not their package's. Nits (no effect on correctness or the contract; left as accepted deviations or a follow-up card):
Implementing files, sentence by sentence.
Implemented-by: VERDICT: PASS |
…ge-less doc A package scope leaves out only a doc stamped with another package, so a stored doc bound to no package is in every scope: include '*' made both manuals claim it and gate it on setup.access / studio.access. Claim by setup_* / studio_* instead, pin an unstamped control doc on spec, REST and MCP, and correct the docs, jsdoc and changeset sentences that said otherwise. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: DELTA review from Inputs read: card #36029 (body and all six comments, ruling 7122770897 included), PR #37591 (the body as it stands on this head, its 25 files, the net diff against ① Derived judgments
② Semver levelUnchanged and still right: The two changeset sentences the earlier record named now hold. The strict-arm sentence states the parse as the tree does it: ③ Boundary flags
④ Design judgment
Tried against the fix, and held:
No must-fix. No should-fix. Three new nits. Nits (no effect on correctness or the contract at this head; left as accepted deviations or a follow-up card, since a fix outside the prose faces moves the head):
Implementing files, sentence by sentence.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 99447c4 · card #36029 · area s2-data · 2026-11-26T16:40ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 45861150445 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…ging main Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
|
Relay Merge-queue dequeue of #37591 — cause
The relay sends |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 45864597925 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — re-land · head 9d4b627 · card #36029 · area s2-data · 2026-11-26T17:44Z
Tier: S. Landing: ready + auto-merge by this stroke. |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Correction to the re-land note 7199561743: the reviewed head |
…ility (objectstack-ai#37663) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuUXusuGGFSzvb1tSB9KytgS)_ Part of objectstack-ai#36029 — the ADR half. The code half, objectstack-ai#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 objectstack-ai#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 落地,代码已在 objectstack-ai#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 objectstack-ai#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.com/claude-code) https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc)_ Co-authored-by: Claude <noreply@anthropic.com>
…ts pages by name (objectstack-ai#37870) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuKG2Z9TG76Xqkusa81b3qqz)_ Fixes objectstack-ai#37613 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: none — no `skills/` page teaches the book audience forms; `content/docs/ui/doc-pages.mdx` documents both refusals in this change DELIBERATE CORRECTION: `.changeset/36029-book-audience-system-permission.md` (pending, from objectstack-ai#37591). Its sentence "an object that also carries `permissionSet` still parses as the older, non-strict `{ permissionSet }` arm with the other key dropped, as before." is false after this PR and now reads "and an object that also carries `permissionSet` is refused too: an audience names one gate." `Check Changeset` is red on this by design until the seat's record confirms it. ## 维护者速读 - 手册(book)的可见范围以后只能写一种门槛:同时写了「某个权限集」和「某项系统权限」会被直接拒绝,并告诉作者留哪一个。以前这种写法会悄悄只按权限集放行,作者以为是按系统权限。 - 设了可见范围的手册,如果用 `include: '*'` 把所有文档都揽进来,`os validate` / `os build` / `os lint` 和 Studio、REST、MCP 保存时都会报错,因为它会把不属于任何包的文档也藏起来。 - Setup 和 Studio 两个包各加了一个测试:它们注册的每篇文档都必须被自己的手册认领;文档名换了前缀、或手册改回 `'*'`,测试就会变红。 - 这是收严(narrowing),走 Tier H。存量数据不改写、开机也不拒;只有下次保存这类手册时才报错。仓库和 hotcrm 里没有一处这样写。 ## What changes - **`@objectstack/spec` — an audience names one gate.** `BookAudienceSchema`'s `{ permissionSet }` arm now declares `systemPermission` only to refuse it (`z.never`, message `BOOK_AUDIENCE_ONE_GATE`), and the `{ systemPermission }` arm moves from `.strict()` to `strictObject` with a `guidance` entry for `permissionSet`, so the union's chosen branch prints the same prescription. Rendered by `defineStack`: ```text ✗ books.0.audience: Unrecognized key(s) on this book audience: `permissionSet`. • A book audience names ONE gate, and this one names two: `permissionSet` and `systemPermission`. Keep `systemPermission` when the readers are everyone who holds a capability through any permission set (…); keep `permissionSet` when the readers are the holders of that one set. Delete the other key. … ``` Only the second gate key is refused: `{ permissionSet, label }` still parses to `{ permissionSet }` exactly as before, and `{ systemPermission, label }` is still refused as before. Regenerated: `content/docs/references/system/book.mdx`. New upgrade-guide entry `book-audience-two-gates-and-catch-all-claim-refused` (ADR-0087 D3, notice only). - **`@objectstack/lint` — `book-gated-catch-all-include` (error).** `validateBookAudienceClaims` refuses a book whose `audience` is `{ permissionSet }` or `{ systemPermission }` with a group whose `include` is the catch-all (a glob of `*` alone: `'*'`, `'**'`). Namespace globs, tag includes and pinned `pages` pass; `'org'` / `'public'` / no audience are out of scope. Registered `gating` on all three commands and on the runtime publish gate for `book` writes. - **`@objectstack/setup`, `@objectstack/studio` — N4.** Each package gets `src/manual-claims-docs.test.ts`: it calls the plugin's own `start()` with a capturing manifest service, so it reads the docs and the book the package really registers, and resolves them with the spec's `resolveDocAudiences`. Every registered doc must carry exactly the manual's audience, and a control doc bound to no package must stay `org`. Wiring that came with it: a `test` script, `**/*.test.ts` dropped from `tsconfig.json`'s `exclude` so `typecheck` reads the tests (`check:type-check-coverage`), and a `vitest.config.ts` aliasing `@objectstack/spec/system` and `@objectstack/platform-objects/apps` to source (`check:test-source-alias`). - **`packages/spec/liveness/book.json` — N5.** `name` goes back to `2026-09-27` (its evidence did not change in objectstack-ai#37591); `audience` moves to `2026-11-27`, re-closed here against both refusals. - **Docs.** `content/docs/ui/doc-pages.mdx` names both refusals where it already teaches the forms. Decided in the thread (small, listed per the standing rule): - **Route for item 1: the schema, not a lint rule.** Measured: `defineStack` parses a book at definition time, and `{ permissionSet: 'xy_admin', systemPermission: 'setup.access' }` comes out as `{ permissionSet: 'xy_admin' }` (probe against the built `dist` of `main` @ `adb65d16`). So for a TS config, the documented authoring path, every authoring rule receives the value with the key already gone, whatever its input tier (`authoring-rules.ts` § "What `normalized` does NOT buy" says the same). Only the runtime save door hands the rules the authored body. A lint rule would therefore miss the main path; the parse refusal reaches `defineStack`, `os validate` and the `/meta` save alike. - **Narrow refusal, not a strict `{ permissionSet }` arm.** A strict arm refuses every stray key, and a stored book row is kept verbatim (`protocol-save.ts`: "Every other type keeps its body verbatim"), so nothing proves no stored `{ permissionSet }` audience carries some other stray key. The narrow form refuses only the pair the card names. The pair cannot have been meaningful in any stable release: `{ systemPermission }` first shipped in `19.0.0-next.0` (2026-11-26T19:13Z, after objectstack-ai#37591 merged at 18:15Z); `latest` is `18.6.0`. A repo and hotcrm grep finds no audience with both keys (hotcrm's one gated book is `{ permissionSet }` claiming `crm_admin_*`). - **What a stored two-gate row does after this lands** (source read, not measured): the docs gate lists stored books without re-parsing them, and `audienceAllows` reads `permissionSet` first, so such a row keeps the set gate it has today. The read-time diagnostics pass (`metadata-diagnostics.ts`) parses with the same schema, so Studio shows it as invalid; its next save is refused with the fix named. - The catch-all rule is `gating` (error) and also runs at the runtime publish door, because a Studio, REST or MCP author of a book has no other door. - The refusing key appears in the generated JSON schema as `"systemPermission": { "not": {} }` on the set arm, the same shape every `retiredKey` tombstone already emits (this schema's own `groups[].translations` among them). ## Why Card objectstack-ai#37613, three review follow-ups of objectstack-ai#37591 / objectstack-ai#37663: an audience written with both keys was accepted and silently gated on the set alone (an admin manual opening to a different group than its author meant); the authoring rule "a gated book never claims by `include: '*'`" was taught by the ADR-0046 §6.7 amendment and enforced nowhere; and nothing held the Setup and Studio docs to their manuals' name prefix. ## Tests Local runs on head `8143254075`. The two later heads are docs only: the `book-gated-catch-all-include` row in `validating-metadata.mdx`, and the author-time rule count `83` → `84` in the four CLI transcripts (`check:docs-transcript-drift` green locally). CI on head `b9998850`: every check green except **Check Changeset**, the DELIBERATE CORRECTION declared above. Test Core (4/10) failed once on a driver-sql timeout outside this diff (PR comment 7213999688) and passed on re-run. - `packages/spec` `src/system src/migrations src/shared src/kernel`: 191 files, 5601 passed. `book.test.ts` 52/52 (2 new: the two-gate refusal in both key orders with the prescription text; every shape accepted before still accepted, `{ permissionSet, label }` still stripped). - `packages/lint` full suite: 241 files, 9749 passed. `validate-book-audience-claims.test.ts` 9/9: positive and negative pin per gated form, `'**'`, ungated audiences, map-shaped `books`, the three commands, and the runtime gate refusing a catch-all book write while passing a named claim. `authoring-rule-wiring.test.ts` green with the new entry. - `packages/apps/setup`, `packages/apps/studio`: 2/2 each; `typecheck` green in both and in `packages/lint`. - `check:generated` (spec): all 14 current after `--fix` regenerated `book.mdx` only. `check:liveness`, `check:strictness-ledger` green inside it. `check:adr-0087-registration` green (registered). `check:test-source-alias`, `check:type-check-coverage`, `check:doc-authoring`, `check:changeset-fixed`, console-intercept disarm: green. eslint on every touched TS file: clean. - Not run here: `rest`, `runtime`, dogfood and `ui/` suites (CI carries them; the only cross-package fixtures naming a catch-all are REST's catch-all control book, which is served through a stub, not a lint run). <details><summary>Ablations (each restored, tree clean after)</summary> - Spec: the refusing `systemPermission` field removed → `book.test.ts` 1 red (the two-gate refusal), 51 pass. - Lint: the catch-all test disabled → 6 of 9 red. - Setup: `include: 'setup_*'` → `'*'` → the control-doc pin red ("the manual claims a doc bound to no package"). - Setup: `setup_overview` renamed `admin_overview` → the claim pin red ("admin_overview is not claimed by setup_manual"). </details> ## Acceptance notes - File surface vs the claim: the claim listed `packages/lint`, the pins, `liveness/book.json`, and `book.zod.ts` "only if the lint route cannot reach the authored value" — it cannot (above). Also touched: `packages/apps/{setup,studio}` (the N4 pins, their wiring), `packages/spec/src/migrations/entries/semantic/` (the ADR-0087 entry this narrowing owes), `content/docs/ui/doc-pages.mdx`, the rule row in `content/docs/deployment/validating-metadata.mdx`, the rule count in four CLI transcripts, the regenerated `book.mdx`, and the pending `36029` changeset (DELIBERATE CORRECTION above). The claim's declarations were `Clause-②: no` / `Metadata-protocol: none`; this PR declares `yes (narrowing)` / `narrowed`. - A security item found while reading this surface is with the owner seat. - The prescription arrives under the union's "Unrecognized key(s) on this book audience: `permissionSet`" line, because branch ranking prefers an unknown-key branch (`union-branch-policy.ts`); the bullet under it carries the whole fix. ## Verification Read first: `packages/spec/src/system/book.zod.ts` (`BOOK_AUDIENCE_ONE_GATE`, `BookAudienceSchema`), then `packages/lint/src/validate-book-audience-claims.ts`, then `packages/apps/setup/src/manual-claims-docs.test.ts`. Two-minute check: `pnpm --filter @objectstack/lint exec vitest run src/validate-book-audience-claims.test.ts` (9 passed) and `pnpm --filter @objectstack/setup test` (2 passed). Tier H: `Clause-②: yes (narrowing)` on `packages/spec/src`. Contract review at CONTRACT_REVIEW_TIER owed by the seat; not self-reviewed here. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (eslint on every touched file). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgTbkZmKG1Moic2iU5K --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgTbkZmKG1Moic2iU5K)_ <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgTbkZmKG1Moic2iU5K --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Part of #36029 — the code half. The ADR-0046 §6.7 note the ruling also names lands in its own seat-run PR (Tier H); the seat closes the card when both have merged.
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — no
skills/page teaches the book audience forms;content/docs/ui/doc-pages.mdxdocuments the new form in this change维护者速读
What changes
Ruling of record: the maintainer's answer to the decision card, relayed in comment 7122770897 (「A 按系统权限判定」).
@objectstack/spec—BookAudienceSchema/BookAudiencegain a fourth, strict arm{ systemPermission: string }.AudienceCallergainssystemPermissions?: readonly string[];audienceAllowsadmits the arm only for an authenticated caller whose list holds the token, and denies when the list is absent (fail closed, ADR-0049). The other three forms answer exactly as before. Regenerated:content/docs/references/system/book.mdx, the strictness-ledger count (system/409 → 410, the new strict arm). Liveness rowbook.audiencere-verified with the new evidence.@objectstack/rest—resolveDocsAudiencetreats a{ systemPermission }book as gated (no fast path), andresolveAudienceCallerfillssystemPermissionsfrom the caller's own context — the same listholdsRequiredPermissionsreads for an app'srequiredPermissions, so the Setup manual opens for exactly the callers the Setup app opens for. Holdings are read only when such a book exists; a capability-only gate never asks the security service for permission sets. New exportanySystemPermissionAudience; new optional portMetaReadGateAudienceSources.resolveAudienceSystemPermissionsfor a transport whose audience reads someone else's holdings.@objectstack/runtime— the MCP docs door (search_package_docs,read_package_doc) supplies that port on a delegated OAuth envelope, so the delegating person's own capabilities decide, never the token's ceiling (the same rule its{ permissionSet }reading already follows, ADR-0090 D10).@objectstack/setup,@objectstack/studio— each registers a manual (setup_manual,studio_manual) claiming its own doc namespace (include: 'setup_*'/'studio_*') withaudience: { systemPermission: 'setup.access' }/'studio.access', the token each app'srequiredPermissionsnames.@objectstack/lint—capability-reference-unknownalso resolvesbooks[].audience.systemPermission; itsos explaintext names the new position.ui/(@object-ui/app-shell,@object-ui/i18n) — Studio's book preview shows a capability-gated book as "Capability: TOKEN" / 「系统权限:TOKEN」 instead of "Org", and the book form's JSON schema round-trips the new form.content/docs/ui/doc-pages.mdxdocuments the form, when to use it, and why a gated book claims by name rather thaninclude: '*';content/docs/permissions/capabilities.mdxnames the new lint position.Decided in the thread (small, listed here per the standing rule):
systemPermission(the ruling left it to the spec lane): it is the same word as the grant side,systemPermissions, which is what an author writes on the permission set.systemPermissions(what the app gate reads) rather than a freshresolvePermissionSetsForContextpass — the ruling's intent is "every admin who can open Setup can read it", and this is that predicate exactly, with no second resolution to drift from it. The MCP door's delegated envelope reads the person's resolved grants, as before.Why the manuals claim by namespace, not
include: '*'(contract review S1, 7196156631): a package scope leaves out only a doc stamped with another package, so a stored doc bound to no package is in every scope. A catch-all manual would claim every such doc and take it from members.setup_*/studio_*claim exactly the package's pages; pinned in spec, REST and MCP with an unstamped control doc that stays readable by a member, and a catch-all control that shuts it.Item 2 of the card (the other
com.objectstack.*docs): exactly two exist onorigin/main,setup_overviewandstudio_overview; both are now gated. No end-user platform help exists today, so nothing stays readable by everyone.Tests
All run against this branch's head; each pinned behaviour was ablated once (rebuild, change, watch it red, restore).
Targeted suites
packages/specsrc/system/book.test.ts— 50/50 (parse of the arm, strictness,audienceAllows, set ≠ capability both ways, fail closed,resolveDocAudiencesunion with a{ systemPermission }book).packages/lintsrc/validate-capability-references.test.ts— 22/22 (typo atbooks[2].audience.systemPermissionwarns; built-in and granted tokens pass; other forms resolve nothing).packages/restsrc/meta-doc-system-permission-audience.test.ts(new) — 14/14 (2 added for S1: an unstamped doc beside both manuals is listed, carried with content and read by a member; a catch-all control 403s it): a member without the capability gets the Setup doc in neitherGET /meta/docnor?include=content(body absent from the whole answer),403 PERMISSION_DENIEDonGET /meta/doc/:name, the book absent fromGET /meta/bookand403on its tree, nothing from the implicit package book either; a holder reads all of it; a non-listsystemPermissionsdenies; anonymous 401; no permission-set resolution for a capability-only gate; fast-path control.packages/runtimesrc/domains/mcp-package-docs.test.ts— 28/28 (7 new; S1: unstamped doc found and read beside a namespaced manual, catch-all control closed; session holder / non-holder, set-named-like-capability stays closed, no list fails closed, OAuth person decides, OAuth envelope capability opens nothing — no union).packages/qa/dogfoodtest/setup-docs-audience.dogfood.test.ts(new) — 3/3 on a real boot with the realcreateSetupAppPlugin(): precondition (member 403 on the Setup app, admin 200), member refused on all three doors, admin reads all three plus the manual's tree.uipackages/app-shell/.../adminPreviews.i18n-10862-s2.test.tsx— 42/42 (new case per language for the capability chip).Ablations
needSystemPermissions: false→ the 3 holder pins red (12 → 9 pass).books: []→ both dogfood door pins red (the member reads the doc again — the pre-fix behaviour reproduced on a real boot).Acceptance notes
/apps/com.objectstack.setup/docs/com.objectstack.setup/setup_overview) to the manual (.../docs/setup/setup_overview). No link in the repo names the old one; the flat/docs/setup_overviewpermalink still finds the page.Setup/Studio, English) where the implicit book borrowed the app's translated label. Platform packages ship nobooks.*.labelbundle today; noted, not filed.allReadableis false and every doc read, doc list and app-nav doc gate reads the doc corpus and runs the audience pass. Correct, and the price of the ruling; a follow-up if the docs doors show up in a profile.{ permissionSet, systemPermission }object (both keys) parses as the{ permissionSet }arm with the other key dropped, because that older arm is not strict; making it strict is a narrowing and out of scope.packages/apps/setup/src/index.tssays the package is not yet wired into dev/serve; it is (packages/cli/src/commands/serve.ts,packages/plugins/plugin-dev/src/dev-plugin.ts). Left as is.Verification
Read first:
packages/rest/src/meta-item-read-gate.ts(resolveAudienceCaller,resolveDocsAudience) — the one place the new holdings are read; thenpackages/spec/src/system/book.zod.ts(audienceAllows); thenpackages/runtime/src/domains/mcp-package-docs.ts(packageDocsReadGate).Two-minute check:
pnpm --filter @objectstack/dogfood exec vitest run test/setup-docs-audience.dogfood.test.ts— expect 3 passed: a plain member is refused the Setup doc on every door, the admin reads it.L2 owed at CONTRACT_REVIEW_TIER (Clause-② widening on
packages/spec/src), by the seat — not self-reviewed here.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
Generated by Claude Code