Skip to content

feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps - #37591

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/project-thread-a4oj04
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/project-thread-a4oj04

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

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.mdx documents the new form in this change

维护者速读

  • 没有 Setup 权限的成员,从此在文档列表、搜索内容和直接打开文章三处都看不到 Setup 自带的帮助文档;能进 Setup 的管理员(不管通过哪个权限集拿到的)照常能看。Studio 的帮助文档同理。
  • 这是「控制台 UX 改进」专题里「系统包文档只给管理员看」的收尾:以前只是列表不显示,知道地址的成员仍能打开。按你 11-24 选的方案做:文档可见范围可以写成「持有某项系统权限的人」。
  • 出错时最坏是管理员也看不到这两篇帮助文档(不会多放人进来);改动可直接撤回,不涉及存量数据。
  • 无。

What changes

Ruling of record: the maintainer's answer to the decision card, relayed in comment 7122770897 (「A 按系统权限判定」).

  • @objectstack/spec — BookAudienceSchema / BookAudience gain a fourth, strict arm { systemPermission: string }. AudienceCaller gains systemPermissions?: readonly string[]; audienceAllows admits 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 row book.audience re-verified with the new evidence.
  • @objectstack/rest — resolveDocsAudience treats a { systemPermission } book as gated (no fast path), and resolveAudienceCaller fills systemPermissions from the caller's own context — the same list holdsRequiredPermissions reads for an app's requiredPermissions, 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 export anySystemPermissionAudience; new optional port MetaReadGateAudienceSources.resolveAudienceSystemPermissions for 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_*') with audience: { systemPermission: 'setup.access' } / 'studio.access', the token each app's requiredPermissions names.
  • @objectstack/lint — capability-reference-unknown also resolves books[].audience.systemPermission; its os explain text 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.
  • Docs — content/docs/ui/doc-pages.mdx documents the form, when to use it, and why a gated book claims by name rather than include: '*'; content/docs/permissions/capabilities.mdx names the new lint position.

Decided in the thread (small, listed here per the standing rule):

  • Arm name 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.
  • Holdings source: the caller's own systemPermissions (what the app gate reads) rather than a fresh resolvePermissionSetsForContext pass — 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 on origin/main, setup_overview and studio_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/spec src/system/book.test.ts — 50/50 (parse of the arm, strictness, audienceAllows, set ≠ capability both ways, fail closed, resolveDocAudiences union with a { systemPermission } book).
  • packages/lint src/validate-capability-references.test.ts — 22/22 (typo at books[2].audience.systemPermission warns; built-in and granted tokens pass; other forms resolve nothing).
  • packages/rest src/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 neither GET /meta/doc nor ?include=content (body absent from the whole answer), 403 PERMISSION_DENIED on GET /meta/doc/:name, the book absent from GET /meta/book and 403 on its tree, nothing from the implicit package book either; a holder reads all of it; a non-list systemPermissions denies; anonymous 401; no permission-set resolution for a capability-only gate; fast-path control.
  • packages/runtime src/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/dogfood test/setup-docs-audience.dogfood.test.ts (new) — 3/3 on a real boot with the real createSetupAppPlugin(): precondition (member 403 on the Setup app, admin 200), member refused on all three doors, admin reads all three plus the manual's tree.
  • ui packages/app-shell/.../adminPreviews.i18n-10862-s2.test.tsx — 42/42 (new case per language for the capability chip).
Ablations
  • REST: needSystemPermissions: false → the 3 holder pins red (12 → 9 pass).
  • MCP: delegated override removed → the 2 OAuth pins red (26 → 24).
  • Setup: books: [] → both dogfood door pins red (the member reads the doc again — the pre-fix behaviour reproduced on a real boot).

Acceptance notes

  • The Setup/Studio docs' Console address changes from the implicit book (/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_overview permalink still finds the page.
  • The manual card on the "All docs" page is now labelled by the book (Setup / Studio, English) where the implicit book borrowed the app's translated label. Platform packages ship no books.*.label bundle today; noted, not filed.
  • Docs-door fast path: in a deployment that installs Setup or Studio, some book is now gated, so allReadable is 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.
  • A { 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.
  • Comment drift (carried from the earlier os-dev report on this card): the NOTE (transitional) header in packages/apps/setup/src/index.ts says 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; then packages/spec/src/system/book.zod.ts (audienceAllows); then packages/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

…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
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 6 package(s): @objectstack/setup, @objectstack/studio, @objectstack/lint, @objectstack/rest, @objectstack/runtime, @objectstack/spec, touching 26 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/liveness/book.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 87af66e5b6c75af7989ecbdc8820f1ca4a66596a.

⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/liveness/book.json) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: requiredPermissions (literal, 42 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 87af66e5b6c75af7989ecbdc8820f1ca4a66596a → packageMentionDocs.

Which tree this was computed on

This run read content/docs from f5afa82e7851602d2a7f6de20f72a0889b445301 — the merge of head 9d4b627c971081e8acbb07a2fd76340a54bef87c into base 87af66e5b6c75af7989ecbdc8820f1ca4a66596a, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 87af66e5b6c75af7989ecbdc8820f1ca4a66596a → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…on audience test; docs: lint resolves book audience capabilities

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgV8bjXeBN9N25FTesc
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 899b3e2f7cd924e3a6de98b481f3a9dc6f4b00b8
Local-runs: none
Scope: packages/spec/src/system/book.zod.ts + packages/rest/src/meta-item-read-gate.ts, packages/runtime/src/domains/mcp-package-docs.ts, packages/lint/src/validate-capability-references.ts, packages/apps/setup/src/setup-manual.book.ts, packages/apps/studio/src/studio-manual.book.ts

Inputs read: card #36029 (body and all six comments, ruling 7122770897 included), PR #37591 (body, 25 files, net diff against main), and the check-runs on the head: every one is success or skipped, none failed. Code outside the diff was read in the tree at the head, never reviewed.

① Derived judgments

  • BookAudienceSchema accepts a fourth arm, { systemPermission: string }, strict. A widening: the shape was refused before. No value that parsed before parses differently now (the three older arms are untouched, and they are tried first). Right.
  • BookAudience (the exported type) gains a union member. A consumer that narrowed with typeof audience === 'object' and then read .permissionSet stops compiling; the one in-repo reader (BookPreview.tsx) is fixed in this diff, and audienceAllows narrows by key. Right at minor under Metadata-protocol: added; the changeset does not tell a TypeScript consumer (see N2).
  • AudienceCaller.systemPermissions is a new optional field, and audienceAllows reads it for the new arm only. The public, org and { permissionSet } answers are the same predicates as on main. Absent or not a list denies. Right.
  • @objectstack/rest: an optional port (resolveAudienceSystemPermissions), an optional option (needSystemPermissions), an optional result field, and anySystemPermissionAudience. All additive. A { systemPermission } book takes every docs door off the fast path, which the arm needs. Right.
  • @objectstack/runtime: on a delegated envelope the MCP docs door reads the delegating person's capabilities in place of the envelope's list, never a union. The same holder its { permissionSet } reading already uses on main. Right (wording: N1).
  • @objectstack/lint: capability-reference-unknown gains one position, books[i].audience.systemPermission, as a warning. Existing messages are unchanged (the new key parameter defaults to the old word). Right.
  • @objectstack/setup, @objectstack/studio: each ships a gated manual, so setup_overview and studio_overview go from org to capability-gated on every docs door. This is the narrowing the ruling asked for. Right for those two docs.
  • The same two manuals also change the effective audience of docs that are not theirs. Not declared, and wrong: S1.

② Semver level

Clause-②: yes (widening) and Metadata-protocol: added stand on the PR body and in the changeset, and they agree with the diff: a new accepted audience value, nothing removed or tightened in the schema. added takes at least minor on each package the diff moves, and the changeset gives minor to all eight (spec, rest, runtime, lint, setup, studio, @object-ui/app-shell, @object-ui/i18n). Check Changeset is green. The level is right.

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 systemPermission is refused at parse" (N2).

③ Boundary flags

  • os-dev report 7112446659, open question A to D: answered by the maintainer ruling relayed in 7122770897 (A). This diff implements A.
  • The ruling's relay names resolvePermissionSetsForContext as the source of the holdings. On REST the diff reads the caller's own systemPermissions instead, and says so in the PR body. Judged right: that list is the one callerSystemPermissions hands holdsRequiredPermissions for the app arm, so the manual and its app are decided by one list with no second resolution to drift; the maintainer's own words rule the outcome ("every admin who can open Setup can read it"), which this meets. Not escalated.
  • Arm name left to the spec lane: systemPermission. Right: it is the grant side's word (systemPermissions), and the lint and os explain already speak it.
  • ADR-0046 §6.7 note: split out by claim 7194108111 into a seat-run Tier H PR. It is not in this diff and no such PR was open at review time. The jsdoc here already cites §6.7 for the arm, so the card stays open on that note.
  • PR-body acceptance notes: the Console address and label changes are the lane seat's; the two-key parse is N2; the comment drift in packages/apps/setup/src/index.ts is carried from the earlier report and left as noted.
  • SQL push-down: nothing new. REST reads the list off the resolved caller, with no query. The MCP door reuses the one memoised grant resolution its { permissionSet } reading already makes (holdings ??=), so a gate that reads both forms still resolves the person once. No new id materialisation, no in-app join.

④ Design judgment

packages/spec/src/system/book.zod.ts (hits), against ruling 7122770897 and its first consumers.

The arm is what the ruling asked for: one key, a string, strict, described. audienceAllows tries the forms in the order the union parses them, and an unrecognised shape still denies. Tried and held:

  • Anonymous: authenticated is false before either gated form is read, so a list on an unauthenticated caller opens nothing (pinned in book.test.ts, and as 401 on REST).
  • Missing or non-array list: undefined, null and a bare string all deny, in the spec helper and again in resolveAudienceCaller (pinned on both).
  • Name collision with a permission set: the two forms read two separate lists, so a set named like the token opens nothing, and a capability named like a set opens no { permissionSet } book (pinned both ways, and on the MCP door).
  • Delegated OAuth: the person's own capabilities decide, with no union with the envelope (pinned, including an envelope that carries the capability the person lacks).

S1 (should-fix) — the two manuals claim docs that are not their package's. SETUP_MANUAL_BOOK and STUDIO_MANUAL_BOOK use groups: [{ include: '*' }], scoped by the book's own package. matchesInclude drops a doc from a scoped rule only when the doc carries a packageId that differs; a doc with no stamped package is in every scope (pinned on main: book.test.ts, "a doc with no stamped packageId is in every scope"). A stored doc row bound to no package is served with no _packageId (withRowBinding, packages/metadata-protocol/src/protocol-package-bindings.ts), and docCorpusOf reads that stamp alone. So wherever either package is installed, every package-less doc is claimed by setup_manual and studio_manual, and its effective audience (the §6.7 union) stops being the org fallback. A member who read such a doc before this change gets 403 on its read and loses it from the list, the content answer and the MCP search; the doc also shows up inside the Setup and Studio manual trees. The card does not ask for this, the PR does not declare it, and three sentences in the diff say otherwise: the book files' "over this package's own docs", the new spec test's "include: '*' reaches only the book's own package" (its corpus is all stamped), and the changeset's "no stored or authored value changes meaning". Graded should-fix, not must-fix, because the package-less state is ADR-0070's legacy and migration-source state, and because this was read in the tree, not measured on a boot. The fix is inside the diff: have each manual claim by its own namespace (setup_*, studio_*) or by pinned pages, correct the three sentences, and pin the control: with both manuals registered, a doc carrying no _packageId that no other book claims stays readable by a member on the list, the single read and the MCP answer.

Nits (no effect on correctness or the contract; left as accepted deviations or a follow-up card):

  • N1 — the jsdoc on BookAudienceSchema ("the same answer an app's requiredPermissions: [token] gets") and on AudienceCaller.systemPermissions ("exactly for whoever can open an app gated on that token") is true of a session. On the MCP door's delegated envelope the person's capabilities decide whatever list the envelope carries, by design and as the runtime docblock says. The spec sentences could name that exception.
  • N2 — an audience carrying both keys parses as the { permissionSet } arm with systemPermission dropped, because the older arm is not strict (the PR body says so). The changeset's "a key beside systemPermission is refused at parse" is therefore not true of permissionSet, and the type accepts the two-key literal. Worth a follow-up card: a lint finding on the two-key shape, or a strict older arm under its own narrowing declaration. The changeset could also tell a TypeScript consumer to narrow BookAudience by key.
  • N3 — with a gated manual shipped by two platform packages, allReadable is false in every deployment that installs either one, so the docs doors' fast path no longer applies there: each doc read, doc list and app-nav doc gate now reads the doc corpus and runs the audience pass. Correct, and the price of the ruling; worth a line in the PR body, and a follow-up if the docs doors show up in a profile.

Implementing files, sentence by sentence.

  • packages/rest/src/meta-item-read-gate.ts — agrees. Holdings are read only when a { systemPermission } book is among the books judged; a rejecting or non-list answer leaves the field off and the audience denies; permission sets are not resolved for a capability-only gate (pinned); the port, when present, replaces the caller's list.
  • packages/runtime/src/domains/mcp-package-docs.ts — agrees. The port exists only on a delegated envelope; an unknown person, a person with no membership in the request's organization, or unreadable grants throw and read as closed; one resolution per gate.
  • packages/lint/src/validate-capability-references.ts — agrees with its header and with os explain.
  • packages/apps/setup/src/setup-manual.book.ts, packages/apps/studio/src/studio-manual.book.ts — the audience is the token each app's requiredPermissions names, and the dogfood pin shows the member and the administrator on a real boot. The membership sentence does not hold: S1.

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

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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 99447c4346f0c6dfb7779ca26d2e2c784a858afb
Local-runs: none
Scope: packages/spec/src/system/book.zod.ts + packages/rest/src/meta-item-read-gate.ts, packages/runtime/src/domains/mcp-package-docs.ts, packages/lint/src/validate-capability-references.ts, packages/apps/setup/src/setup-manual.book.ts, packages/apps/studio/src/studio-manual.book.ts

DELTA review from 899b3e2f7cd924e3a6de98b481f3a9dc6f4b00b8 (record 7196156631: PASS, should-fix S1, nits N1 to N3) to this head.

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 main, and the one-commit delta between the two heads in full), record 7196156631, and the check-runs on the head, read at 2026-11-26T16:38Z: every one is success or skipped, the re-run Test Core (5/10) and the second Check Changeset run included. Code outside the diff was read in the tree at the head, never reviewed.

① Derived judgments

  • The delta changes no schema, no type and no function body. In book.zod.ts two docblocks move and nothing else. The accept-set and the public surface are the ones record 7196156631 judged: the fourth, strict { systemPermission } arm (a widening), AudienceCaller.systemPermissions, the optional port, option and export on @objectstack/rest, the delegated reading on the MCP docs door, and the one new lint position. All unchanged, all still right.
  • The two manuals' membership rule changes from include: '*' to include: 'setup_*' and include: 'studio_*'. Derived from the tree: the docs whose effective audience this PR moves are now the docs named under one of the two prefixes that carry the manual's package or no package. On this tree that is setup_overview and studio_overview, the two the ruling names. A doc bound to no package and named outside the prefixes keeps the org fallback. Declared in the changeset and in the PR body. Right.
  • Nothing else is implied by the delta: its other six files are three test files, the changeset, one docs page and book.zod.ts with the two docblocks above.

② Semver level

Unchanged and still right: Clause-②: yes (widening) and Metadata-protocol: added stand on the PR body and in the changeset, and the changeset gives minor to the same eight packages. Check Changeset is green on both of its runs on this head.

The two changeset sentences the earlier record named now hold. The strict-arm sentence states the parse as the tree does it: { systemPermission, label } is refused, and an object that also carries permissionSet is taken by the older, non-strict arm with the other key dropped. "Nothing to migrate" is now bounded to what the manuals claim ("Only docs named under those prefixes change audience"). The changeset also tells a TypeScript consumer to narrow BookAudience by key.

③ Boundary flags

  • Record 7196156631, S1: answered on this head; judged under ④.
  • Record 7196156631, N1 to N3: all three touched (the two spec docblocks, the changeset, the PR body); judged under ④.
  • os-dev report 7112446659 (open question A to D), the holdings source on REST and the arm name: answered as the earlier record has them. Nothing in the delta touches them.
  • ADR-0046 §6.7 note: still not in this diff, and no other open PR names the card. Claim 7194108111 keeps the card open until both have merged.
  • The PR body against the tree. Its readings of this head match: the namespace claim in both book files; the three pins with their catch-all controls (spec, REST, MCP); the case counts of the five suites (50, 22, 14, 28 and 3 cases stand in the files); the two-doc inventory; no file naming the old Console address; the fast-path note; the two-key parse. Two readings do not match, and both are nits: N5 and N6.
  • SQL push-down: the delta adds no query, no id materialisation and no in-app join.

④ Design judgment

packages/spec/src/system/book.zod.ts (hits). The delta here is prose: the docblock on BookAudienceSchema now says the app equivalence holds in a session and names the delegated exception, and the docblock on AudienceCaller.systemPermissions says which transport fills the list with another person's capabilities. Both agree with packageDocsReadGate at this head. The claim rule the fix leans on was re-read in the same file and is untouched: matchesInclude drops a doc from a scoped rule only when the doc is stamped with another package, the glob is anchored on the whole name, and resolveDocAudiences falls back to org for a doc no book claims.

  • S1: closed. Both manuals now claim by their package's doc namespace, which is the package's own identity for docs under ADR-0046 §3.2, and the three sentences the earlier record named are corrected (both book files, the spec test's comment, the changeset). The control it asked for is pinned at three levels, each beside a catch-all control that shows the pin can go red: book.test.ts (an unstamped doc keeps org), the REST suite with both manuals registered (a member lists it with and without content and reads it), and the MCP suite (found and read).

Tried against the fix, and held:

  • A doc stamped with another package and named setup_… is not claimed: the package scope still applies under the glob.
  • A doc bound to no package and named under one of the two prefixes is still claimed. The changeset says so, and the prefix belongs to that package's namespace. Accepted.
  • A doc bound to no package that no book claims is still listed under Uncategorized in each manual's tree, to a reader of that manual. That is the orphan rule on main, outside the diff, and the same doc the package's implicit book listed before this change. No audience moves.

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

  • N1 — touched; the exception is now named. One residue: the BookAudienceSchema sentence reads as if it held on every door, and it describes the MCP docs door, the one transport that hands in the person's holdings. The AudienceCaller sentence beside it names that door. Accepted as written.
  • N2 — the changeset sentences now hold, and the TypeScript note is there. The follow-up it suggested (a lint finding on the two-key shape, or a strict older arm under its own narrowing declaration) is still only a suggestion.
  • N3 — the PR body now carries the fast-path line under its acceptance notes.
  • N4 — new. Each manual's membership now rests on the doc-name prefix. ADR-0046 §3.2 requires the prefix, but the lint that enforces it (docs/namespace-prefix) runs in os build, and these two packages are built by tsup with no suite of their own. The new pins also exercise fixture copies of the manuals: the shipped Setup constant is read only by the dogfood boot, for setup_overview, and no pin reads the shipped Studio constant. Worth a follow-up card: one pin over SETUP_MANUAL_BOOK and STUDIO_MANUAL_BOOK themselves, that every doc the package registers is claimed by its manual. It would hold the membership sentence in both book files.
  • N5 — new. packages/spec/liveness/book.json: the audience row's evidence and note were rewritten for the new arm, but its verifiedAt did not move; the date that moved is on the name row, whose evidence the diff does not touch. The PR body says the audience row was re-verified. Age is a worklist, never a gate, so nothing reads wrong; the next re-verification of the row can set it.
  • N6 — new, on the PR body (a prose face, so the seat can correct it without moving the head). The ablation totals are the earlier head's (12 and 26 cases) under a heading that says every run was on this head, where the same suites hold 14 and 28. The S1 pins carry in-suite controls in place of an ablation; the body could say so.

Implementing files, sentence by sentence.

  • packages/apps/setup/src/setup-manual.book.ts, packages/apps/studio/src/studio-manual.book.ts — agree now. The audience is the token each app's requiredPermissions names, the include is the namespace each package's manifest header declares, and the sentence on why not '*' is the rule matchesInclude implements. The condition "under that prefix" is stated; see N4 for what holds it.
  • packages/rest/src/meta-item-read-gate.ts, packages/runtime/src/domains/mcp-package-docs.ts, packages/lint/src/validate-capability-references.ts — not touched by the delta; re-read at this head and they agree with the contract as the earlier record found. Their suites gained the S1 pins named above.

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 99447c4 · card #36029 · area s2-data · 2026-11-26T16:40Z

L1 checklist

  • Shape and relation: l1-face.mjs --pr 37591 is CLEAN on 13 items. At 99447c4 there are 63 success, 11 expected skips, 0 failed and 0 pending, and mergeable_state is clean. One Test Core shard was re-run once on this head for the cli test: the #30120 start-refusal cases spawn os start synchronously with a 120 s spawn timeout but run under vitest's 5 s case default, so a loaded Test Core shard reds unrelated PRs #37601 timeout signature, and its second run is green. 25 files, +788/-53, not governed (check-governed-merges.mjs).
  • Part of #36029 is right: this is the code half. The ruling (7122770897, 「A 按系统权限判定」) also names the ADR-0046 §6.7 note, which lands in its own seat-run PR (Tier H). The card keeps pm:dispatched until both have merged (landing rule B).
  • Contract review: record 7196156631 (PASS, S1 open), then delta record 7197921983 (PASS, S1: closed, no must-fix, no should-fix) on this head. Adopted.
  • Clause-②: yes (widening) and Metadata-protocol: added are true. BookAudienceSchema gains a strict { systemPermission } arm, and nothing that parsed before is refused.
  • Skills-docs: none is true: no skills/ page teaches the book audience forms, and content/docs/ui/doc-pages.mdx documents the new form in this change.
  • Sentence-by-sentence read of the changeset and the three docs pages (capabilities.mdx, references/system/book.mdx, doc-pages.mdx): they match the diff, including the corrected "claims by name" sentence and the two-key parse note.
  • Follow-ups: N4 (no gate holds a package's docs to its manual's prefix) and N5 (a liveness verifiedAt on the wrong row) are appended to review follow-ups of PR #37591 #37613 (comment 7197953439). N6 is accepted: the PR body's ablation totals name the earlier head, while the check-runs on this head are the gate verdicts.

Tier: S. Landing: ready + auto-merge by this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 16:41
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 45861150445 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (2/10) — 失败步骤: Run this shard's tests

    @objectstack/spec:test:      ✓ inverts the card's measured control: the three bogus keys now FAIL parse instead of adding zero warnings  369ms
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    @objectstack/spec:test:repo:  FAIL   repo  scripts/strictness-ledger-doc.test.ts > the ledger and the generated counts agree > is checked in current — every shard on disk equals a fresh render, and no
      ↳ 失败原因: @objectstack/spec:test:repo: AssertionError: expected Map{ …(14) } to deeply equal Map{ …(14) }
    @objectstack/spec:test:repo:  FAIL   repo  scripts/strictness-ledger-doc.test.ts > the ledger and the generated counts agree > the read-time totals equal the sums of the shards' own rows
      ↳ 失败原因: @objectstack/spec:test:repo: AssertionError: expected 'untriaged: 1402 object site(s) across…' to be 'untriaged: 1401 object site(s) across…' // Object.is equality
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • scripts/strictness-ledger-doc.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 12 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Relay pr_dequeue · session_01L6bhgV6i8jfWwSXjpWJrjA · request fw-20261126T171207Z-f0bd67

Merge-queue dequeue of #37591 — cause own-failure.

  • Relay read: entry state AWAITING_CHECKS, merge-group rollup FAILURE.
  • Seat's reason: Merge-group run 45861150472 failed Spec property liveness on this entry: the generated strictness-ledger counts shard went stale after an earlier merge. The branch holds the regenerated shard and cannot push while queued (GH006). Re-land follows on the new head.

The relay sends dequeuePullRequest after this comment and confirms the removal by reading the queue back; the run row of this request carries the outcome. Re-queue once the cause is fixed (landing-operations.md, the landing seat's queue duty).

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 45864597925 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (2/10) — 失败步骤: Run this shard's tests

    @objectstack/spec:test:      ✓ inverts the card's measured control: the three bogus keys now FAIL parse instead of adding zero warnings  346ms
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    @objectstack/spec:test:repo:  FAIL   repo  scripts/strictness-ledger-doc.test.ts > the ledger and the generated counts agree > is checked in current — every shard on disk equals a fresh render, and no
      ↳ 失败原因: @objectstack/spec:test:repo: AssertionError: expected Map{ …(14) } to deeply equal Map{ …(14) }
    @objectstack/spec:test:repo:  FAIL   repo  scripts/strictness-ledger-doc.test.ts > the ledger and the generated counts agree > the read-time totals equal the sums of the shards' own rows
      ↳ 失败原因: @objectstack/spec:test:repo: AssertionError: expected 'untriaged: 1402 object site(s) across…' to be 'untriaged: 1401 object site(s) across…' // Object.is equality
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 15 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — re-land · head 9d4b627 · card #36029 · area s2-data · 2026-11-26T17:44Z

  • Why it left the queue. Merge-group run 45861150472 failed Spec property liveness on this entry: the generated docs/audits/2026-07-unknown-key-strictness-ledger.counts/system.md shard went stale once an earlier PR merged. The seat dequeued it at 17:12Z (own-failure) so the branch could push.
  • What moved since ACCEPT 7197921983 (head 99447c4346). Two commits: 032e80582c merges origin/main with no conflict resolution (git show --cc is empty), and 9d4b627c97 regenerates that one shard (1 line, 410 → 411). No reviewed line changed, so contract record 7198330476's predecessor chain and the ACCEPT stand; no new L2.
  • Checks on this head. 61 success, 9 expected skip, none failed or pending; mergeable_state clean. The queue failure comment from run 45864597925 belongs to the old entry built before the dequeue.
  • Governance. check-governed-merges.mjs on the final 25-file list: not governed, 841 lines. Tier S.

Tier: S. Landing: ready + auto-merge by this stroke.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Correction to the re-land note 7199561743: the reviewed head 99447c4346 carries contract record 7197921983 (delta, PASS, S1: closed) and seat ACCEPT 7197975949. The note named those two by the wrong ids. Nothing else in it changes.

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 protocol:system size/l tests 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.

2 participants