Skip to content

fix(spec)!: a book audience names one gate, and a gated book claims its pages by name - #37870

Open
objectstack-fleet[bot] wants to merge 7 commits into
mainfrom
claude/project-thread-mu5jxy
Open

objectstack-fleet[bot] wants to merge 7 commits into
mainfrom
claude/project-thread-mu5jxy

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #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 #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:
    ✗ 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 feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #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 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 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 #37613, three review follow-ups of #37591 / #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).
Ablations (each restored, tree clean after)
  • 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").

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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (eslint on every touched file).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgTbkZmKG1Moic2iU5K


Generated by Claude Code

@github-actions github-actions Bot added size/l dependencies Pull requests that update a dependency file 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 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/setup, @objectstack/studio, @objectstack/lint, @objectstack/spec, touching 14 documentable anchor(s). ⚠️ 6 changed file(s) yielded no anchor (packages/apps/setup/tsconfig.json, packages/apps/setup/vitest.config.ts, packages/apps/studio/tsconfig.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

14 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/connect-mcp.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/api/client-sdk.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/deployment/cli.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/deployment/cloud-connection.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/deployment/validating-metadata.mdx (via AUTHORING_RULES (symbol, a top-level const object), runtimeTypes (symbol, a field of const object AUTHORING_RULES))
  • content/docs/permissions/authorization.mdx (via crm_admin (literal, a string literal in a comment in BookAudienceSchema))
  • content/docs/permissions/capabilities.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/permissions/delegated-administration.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/permissions/permission-sets.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/permissions/system-context.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/protocol/kernel/config-resolution.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/ui/apps.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/ui/audience-based-interfaces.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/ui/doc-pages.mdx (via crm_admin (literal, a string literal in a comment in BookAudienceSchema))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v13.mdx (via crm_admin (literal, a string literal in a comment in BookAudienceSchema))
  • content/docs/releases/v14.mdx (via crm_admin (literal, a string literal in a comment in BookAudienceSchema))
  • content/docs/releases/v17/17-5.mdx (via setup.access (literal, a string literal in BookAudienceSchema))
  • content/docs/releases/v17/17-6.mdx (via setup.access (literal, a string literal in BookAudienceSchema))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 6 changed file(s) yielded no anchor (packages/apps/setup/tsconfig.json, packages/apps/setup/vitest.config.ts, packages/apps/studio/tsconfig.json, …) — pages documenting those are invisible to this run
  • 10 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 — 177 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 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d645b0b557090a2d1213c054ed6a3c90c2c75c6c — the merge of head dc85e540745a89771114cb8810b27dcab6d9ee55 into base 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b, 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 d645b0b557090a2d1213c054ed6a3c90c2c75c6c && git checkout d645b0b557090a2d1213c054ed6a3c90c2c75c6c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b dc85e540745a89771114cb8810b27dcab6d9ee55 && git checkout -B drift-repro 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b && git merge --no-ff dc85e540745a89771114cb8810b27dcab6d9ee55

node scripts/docs-audit/affected-docs.mjs --json 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b

⚠️ 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 29e0c4bf5f6ca597b9d94a6c987db2a0cf6f7a8b → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Test Core (4/10) on head b9998850: one timeout outside this PR.

  • Failing test: packages/drivers/driver-sql/src/sql-driver-11389-date-tz-skew.test.ts:80, "sweeps a zone EAST of UTC, a zone WEST of UTC, and UTC itself". It hit vitest's 5000 ms default after 5258 ms.
  • The same shard was slow throughout: import 973.90s, a 378 s run. The other 4568 driver-sql tests passed.
  • This PR changes no file under packages/drivers/. Its diff is spec book schema, lint, the setup and studio apps, docs and changesets, and none of them reach the driver's zone sweep.
  • Nothing is pushed for it. A re-run of the shard should clear it.

The other red, Check Changeset, is the DELIBERATE CORRECTION of .changeset/36029-book-audience-system-permission.md already declared in the PR body.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b999885037f1d3707568389158b4476c6904fc59
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.book-audience-two-gates-and-catch-all-claim-refused.ts, packages/spec/src/system/book.zod.ts + packages/lint/src/validate-book-audience-claims.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts

Read: card #37613 with its five comments (claim 7212725896, amendment 7214987476), the PR body and file list, the net diff against main, and the check-runs on this head. Cited code read on main, not reviewed: shared/union-branch-policy.ts, shared/strict-object.ts, shared/retired-key.ts, migrations/types.ts, packages/lint/src/runtime-gate.ts, packages/rest/src/meta-item-read-gate.ts, ADR-0046 §6.7. The rest of the diff (the two manual-claims-docs.test.ts pins and their wiring, the rule's test, book.test.ts, the liveness row, generated book.mdx, docs pages) is the lane seat's ACCEPT.

① Derived judgments

  • Accept-set of BookAudienceSchema: narrowed by one shape, right. Refused now and accepted before: an object with a string permissionSet and an own systemPermission key holding anything but undefined (a string, null, ''), with or without other stray keys. Before, the set arm stripped the key. Nothing else moves: { permissionSet, label } still parses and strips label; { permissionSet, systemPermission: undefined } still parses; the { systemPermission } arm refused every extra key already, and strictObject in place of .strict() changes its message only.
  • The prescription reaches the author on both key orders, right. Read against selectUnionBranches: each object arm reports one issue, the strict arm carries unrecognized_keys and wins the tie, so the rendered line is the strict arm's with BOOK_AUDIENCE_ONE_GATE as its guidance. When the strict arm reports two issues (a non-string systemPermission), the set arm wins and prints the same sentence at audience.systemPermission. The wire mapper shares the selection.
  • Public surface of @objectstack/spec: no export added or removed. BOOK_AUDIENCE_ONE_GATE is module-private. The set arm's JSON schema gains systemPermission as an unsatisfiable property and the generated reference shows it as never, the shape retiredKey tombstones already emit. The hand-written BookAudience type is unchanged.
  • Parsed output: one edge, harmless. An audience written with an explicit systemPermission: undefined keeps that key in the parsed value (zod keeps a present optional key). Every reader in the tree tests typeof ... === 'string' (audienceAllows, anyPermissionSetAudience, anySystemPermissionAudience, the lint gateOf, BookPreview), so no gate reads it as a second form.
  • @objectstack/lint: one new exported rule and one new error id, right. book-gated-catch-all-include is gating on validate, build and lint, and on the runtime publish gate for book writes. It is a new refusal of a shape 18.x accepted (a { permissionSet } book claiming by '*'), declared as such in the changeset with FROM → TO.
  • Stored rows, right as stated. The docs read gate lists stored books without parsing them and audienceAllows reads permissionSet first, so a stored two-gate row keeps the set gate it has today. On an update, the runtime gate drops the written item's stored self from the baseline, so the catch-all finding on the book being saved is charged, not cancelled: "the next save is refused" holds for both refusals.

② Semver level

Clause-②: yes (narrowing) — on the PR body and on .changeset/37613-book-audience-one-gate.md, with Metadata-protocol: narrowed on both. Right: the diff changes a published schema's accept-set downward, and the claim's no / none was replaced by amendment 7214987476.

  • @objectstack/spec minor and @objectstack/lint minor match the rule (a narrowed kind takes at least minor on each package the diff moves; BREAKING ships minor in the launch window). The note carries the BREAKING banner, both FROM → TO lines and the adr-0087: registered marker for the entry in scope.
  • @objectstack/setup and @objectstack/studio are moved only in tests, a test script and tsconfig.json; both pack dist alone. No changeset entry is owed. The level axis of Check Changeset reads the same on this head.
  • Check Changeset is red for one reason, the DELIBERATE CORRECTION, and the correction is confirmed. The job log's only error is the refusal to change .changeset/36029-book-audience-system-permission.md; its level, lockstep, empty-frontmatter and ADR-0087 steps pass. The diff of that file is one sentence.
    • Before: "It is strict, so { systemPermission, label } is refused at parse; an object that also carries permissionSet still parses as the older, non-strict { permissionSet } arm with the other key dropped, as before."
    • After: "It is strict, so { systemPermission, label } is refused at parse, and an object that also carries permissionSet is refused too: an audience names one gate."
    • First clause, unchanged and still true: the arm is strictObject, so { systemPermission, label } is refused. Second clause before: false on this head, since the set arm now refuses systemPermission and no arm accepts the pair. Second clause after: true on this head, in both key orders, and pinned by book.test.ts. Both notes are pending and release together, so the corrected sentence describes what ships. No other sentence of that note is changed, and none of the others is made false by this diff.

③ Boundary flags

  • Route (schema, not lint) and the widened file surface: answered by amendment 7214987476; the reason holds in the tree, since defineStack parses a book before any rule runs and the set arm stripped the key.
  • Leave the { permissionSet } arm non-strict: right. Stored book rows are kept as written, the card allows the strict arm only "if a stored book with a stray key is shown not to exist", and nothing shows that. The narrow form refuses exactly the pair the card names.
  • Test Core (4/10): one driver-sql time-zone test timed out, the shard is green on re-run, and the diff touches no driver. Not this PR's.
  • A public book claiming by include: '*' (the dev's unfiled note): not a finding on this PR. The card and the ADR-0046 §6.7 rule name gated books only, and this is the opposite direction of the same mechanism, which needs its own decision. It is security-touching: it goes on a separate card, and its particulars go to the seat privately.
  • SQL push-down: no data access in the diff; nothing to push down.
  • No open_questions entry is left on the card or the PR.

④ Design judgment

packages/spec/src/system/book.zod.ts, against the card, ADR-0046 §6.7 and its first consumers (audienceAllows, the Setup and Studio manuals). The refused shape is exactly the two-gate audience, and the refusal is where every authoring door meets it. The message says which key means what and to delete the other; the strict arm's history says the pair used to gate on the set alone, which is what an author needs to choose. guidance: { permissionSet } on the strict arm names a key that arm does not declare, as the table requires. z.never().optional() rather than retiredKey is right: the key is not retired, and retiredKey would print a retirement sentence. The jsdoc sentences hold against the code: "only the second gate key is refused", "audienceAllows reads one of them", "a defineStack config is parsed before any rule runs". The shipped manuals ({ systemPermission }, setup_* / studio_*) parse unchanged.

19.book-audience-two-gates-and-catch-all-claim-refused.ts, against SemanticMigration in migrations/types.ts and its peers. It tells an author what to do: replacement names both forms with what each admits and the three ways to claim by name; reason says what the pair meant until now (the set alone) and that stored books are refused at the next save, not at boot; acceptanceCriteria is checkable. No D2 conversion is right, since which gate and which pages are the author's choice. One entry for two refusals of the same gate is acceptable beside the single changeset marker.

packages/lint/src/validate-book-audience-claims.ts, authoring-rules.ts, index.ts, against the ADR sentence ("never by include: '*'") and matchesInclude. The rule reads the book alone, names the book, the group and the path, and passes namespace globs, tag includes and pinned pages, as the ADR says. gateOf reads the two forms the way audienceAllows does. Registration (gating, parsed, all commands, runtimeTypes: ['book']) agrees with the docs row and the changeset. It reads stack.books as the sibling rule validateCapabilityReferences does.

No must-fix, no should-fix.

  • N1 (nit) — the entry's comment gives as its reason for no relevance question that the runtime save door also judges books "which no question over one stack can name". migrations/types.ts says a relevance proof is about the definition the chain reads and that runtime-stored metadata is not part of it, and the surface lives only under books. Omitting relevantWhen is the permitted, always-listed default, so the result is correct; the entry is listed to upgraders who declare no book. Left as an accepted deviation.
  • N2 (nit) — the rule's jsdoc calls '*' and '**' "the spellings that match every doc name". globToRegExp leaves ? unescaped, so '*?' also matches every name and is not flagged; and the rule trims the glob where the matcher does not. The rule holds the ADR sentence as written, and a rule of this kind catches the mistake, not every spelling. Left as an accepted deviation, or one line on a follow-up card.

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

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

security added: a security item read on this surface is with the owner seat · 2026-11-27T09:51Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head b999885 · card #37613 · area s2-data · 2026-11-27T09:51Z

L1 checklist

  • Shape and checks. Every check on the head is green but Check Changeset, red only on the step that refuses a change to a pending note: the DELIBERATE CORRECTION below. Its level axis, lockstep, empty-frontmatter and ADR-0087 steps pass. Test Core 4/10 timed out once on a driver-sql time-zone test (comment 7213999688) and passed on rerun; the diff touches no driver.
  • Contract review at CONTRACT_REVIEW_TIER. 7215110573 at this head: PASS, No must-fix, no should-fix., nits N1 and N2 accepted as deviations. The seat adopts it.
    • The refused shape is exactly the two-key audience: a string permissionSet beside an own systemPermission. { permissionSet, label } still parses; the strict arm prints the one-gate guidance on both key orders.
    • Leaving the { permissionSet } arm non-strict is right: stored rows are kept as written, and nothing shows that none carries a stray key.
    • The ADR-0087 entry tells an upgrader what each form admits, the three ways to claim by name, what the pair meant until now, and that refusal comes at the next save. The catch-all rule refuses that save on an update too.
  • DELIBERATE CORRECTION of feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591's pending note, confirmed. .changeset/36029-book-audience-system-permission.md: the record quotes the sentence before and after, finds the old second clause false on this head and the new one true and pinned by book.test.ts, and no other sentence of the note made false. The file's diff is that one sentence.
  • Declarations. Clause-②: yes (narrowing), Metadata-protocol: narrowed on the body and the changeset, as the claim amendment 7214987476 records; spec and lint at minor. apps/setup and apps/studio move tests, a script and tsconfig only, and owe no entry.
  • Security. A security item read on this surface, outside this diff, is with the owner seat. The PR carries the security label. Nothing more is public.
  • Fixes #37613 is right. All four items are in the diff.
  • Governance. A (narrowing) arm and packages/spec/src/**: Tier H. The maintainer's approval lands it.

Tier: H. Landing: hand-off to the maintainer follows this record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Tier H hand-off · 2026-11-27T09:53Z · head b999885 · approver os-zhuang

维护者速读

  • 改了什么: 手册(book)的可见范围和文档归属收严,是 feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591 的复审后续。
    • 可见范围同时写了权限集和系统权限两道门时,以前会悄悄丢掉系统权限那道,现在直接拒绝,并提示作者只留一个。
    • 设了可见范围的手册不能再用 include: '*' 认领全部文档。os validate、os build、os lint 和 Studio/REST/MCP 保存都会拒。
    • Setup 和 Studio 各加一个测试,钉住它们的文档归属。
  • 影响: 作者写错的门槛现在会当场报错,不会再变成手册对谁可见和作者以为的不一样。已存的数据原样保留,下一次保存才会被拒。迁移说明写了怎么改。
  • 请你留意:
  • 审核: 契约审核(最高档)PASS(7215110573),没有必须改或建议改的项。席位 L1 ACCEPT 在本评论前一条(7215203264)。
  • 要你做什么: 需要你批准后才能合并。撤回这一次合并即恢复原样。

@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 27, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 27, 2026 09:54
…-mu5jxy

# Conflicts:
#	content/docs/deployment/cli.mdx
#	content/docs/deployment/validating-metadata.mdx
#	content/docs/getting-started/build-with-claude-code.mdx
#	content/docs/ui/react-pages.mdx
@os-zhuang
os-zhuang enabled auto-merge November 27, 2026 09:54
@os-zhuang
os-zhuang disabled auto-merge November 27, 2026 09:54
@objectstack-fleet

objectstack-fleet Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgTbkZmKG1Moic2iU5K

Test UI (13/16) on head dc85e540: one failure outside this PR.

  • Failing test: ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx:182, the /studio/~all/flow/f1 case. The redirect itself landed: the location() assertion on line 180 passed. Only the recorded history seen was missing the second entry. The two sibling cases of the same it.each passed.
  • The shard was heavily loaded: setup 591s, import 1467s, an 873 s run. 4949 of 4950 run tests passed.
  • This PR changes no file under ui/. The merge of main (dc85e54) changed only the CLI transcripts' rule count, from 85 to 86.
  • Nothing is pushed for it. The failed jobs will be re-run once this run completes.

Test Core (5/10) on the same head: one timeout outside this PR. packages/create-objectstack/src/scaffold-current-dir-collision.test.ts, the case "refuses with no name when template files would overwrite existing ones", hit its 30000 ms timeout. The other 25 files in that package passed. This PR changes no file under packages/create-objectstack/. It is covered by the same re-run.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: dc85e540745a89771114cb8810b27dcab6d9ee55
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.book-audience-two-gates-and-catch-all-claim-refused.ts, packages/spec/src/system/book.zod.ts + packages/lint/src/validate-book-audience-claims.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts

MERGE-ONLY DELTA on record 7215110573 (PASS at b999885037f1). This record judges the merge commit dc85e540 and what main brought under the PR; everything 7215110573 judged stands as written there and is not re-judged. Read: the merge commit and its combined diff, the net diff of the PR at both heads, the 19 commits of main the merge brings in (and the 6 main has added since), the rule registry at five commits, and the check-runs and two job logs on this head.

① Derived judgments

  • The merge brings only main, right. dc85e540 has parents b999885037f1 (the head 7215110573 reviewed) and c42a0454a706. The second parent is an ancestor of main (6 commits behind today's tip 0a3ea67c2c02). The five PR commits are unchanged (git range-diff reads = on all five).
  • The net diff is the same but for four lines, right. git diff c42a0454 dc85e540 and git diff adb65d16 b9998850 (the old merge base and the old head) list the same 24 files with the same status, 548 insertions and 16 deletions each. Compared line by line, the added and removed lines differ in exactly four pairs: Running author-time rules (83) → (84) became (85) → (86), once in each of content/docs/deployment/cli.mdx, content/docs/deployment/validating-metadata.mdx, content/docs/getting-started/build-with-claude-code.mdx and content/docs/ui/react-pages.mdx. The combined diff of the merge shows those four hunks and no other hand resolution. packages/lint/src/authoring-rules.ts and packages/lint/src/index.ts were changed on both sides and merged without conflict; the PR's net hunks in both are identical to the earlier head's.
  • The four 86s are right. The CLI prints authoringRulesFor(command).length. Rows of AUTHORING_RULES counted in the file: 83 at the old merge base, 85 at c42a0454 and on main today (main added two rows, validateSeedRecordKeys and validateActionBodyCapabilities, in fix(lint)!: three publish-time checks for seeds, flow nodes and actions that save and do not work #37807), 86 at this head (the PR's validateBookAudienceClaims). At this head 84 rows run on every command and 2 on validate and build only, so validate and build both print 86. The four fences are declared transcript=os-validate (three) and transcript=os-build (one); none is an os-lint transcript, which would print 84. The 6 commits main has added since the second parent leave its count at 85, so 86 is still the number after this PR lands on today's main.
  • check:docs-transcript-drift is green on this head. Step "CLI transcripts in content/docs match the registry they quote" of Type Check · workspace (job 140434407360) succeeded; its log reads "4 declared transcript value(s) across 500 page(s) under content/docs/ equal what the registry derives today, and no undeclared block quotes one".
  • Accept-set, exports and parsed output: as 7215110573 found them. main changed none of book.zod.ts, book.test.ts, packages/spec/liveness/book.json, shared/union-branch-policy.ts, shared/strict-object.ts, shared/retired-key.ts, migrations/types.ts, packages/lint/src/runtime-gate.ts, ADR-0046 or ADR-0087 between the old merge base and today's tip.

② Semver level

Clause-②: yes (narrowing) — on the PR body and on .changeset/37613-book-audience-one-gate.md, with Metadata-protocol: narrowed on both; unchanged, and still right over the merged base. @objectstack/spec minor and @objectstack/lint minor are unchanged; the level axis of Check Changeset on this head reads: no package whose published source the PR moves is graded patch, and no major is introduced.

  • Nothing main brought makes a sentence of the changeset or the ADR-0087 entry false. The sentences that depend on code outside the PR are: where the audience is parsed (defineStack, os validate, the /meta save), which commands the new rule runs on and that it runs at the runtime publish gate on a book write, that stored books are not refused at boot, and what the docs read gate does with a stored two-gate row. The merged-in commits add no line naming BookAudience, audienceAllows, a book's audience, stack.books or the docs include matcher. packages/rest/src/meta-item-read-gate.ts changed on main after the second parent (feat(spec,service-knowledge)!: knowledge_source is a governed metadata type with its loader, its registry and two authoring guards #37676): it gains a write-capability row for knowledge_source and comment text, and nothing in how a stored book is listed or read. The two rule rows main added read seeds and actions, not books.
  • No second reader of the refused shape. The set of source files that read a book audience (audienceAllows, anyPermissionSetAudience, anySystemPermissionAudience, BookAudience, the lint gateOf) is the same at b9998850 and at this head. The one new file a search for gateOf finds, packages/rest/src/meta-view-audience-save-round-trip.test.ts (feat(spec): the view and dashboard forms offer the audience gate (requiredPermissions) #37839), has a local helper of that name over a view's requiredPermissions; "audience" there is the view and dashboard gate, a different key on a different type.
  • ADR-0087 entries. main added two 19.* semantic entries and edited a third; none concerns books, and the registration step on this head reads the PR's changeset as registered against book-audience-two-gates-and-catch-all-claim-refused, new here.
  • The DELIBERATE CORRECTION still holds, and Check Changeset is red for it alone. .changeset/36029-book-audience-system-permission.md is unchanged on main across the merge and still pending, so the PR's diff of it is the same one sentence 7215110573 confirmed, and both notes still release together. In job 140434406056 the one failed step is "Reject an empty-frontmatter changeset added by this PR", whose script also carries the refusal to change a changeset the PR did not add; its only error names that file, and the same step prints "No empty-frontmatter changeset introduced by this diff". Every other step that ran succeeded: count, require a changeset, the ADR-0087 disposition, the allow-major re-read and the major guard with its level axis.

③ Boundary flags

  • Check-runs on dc85e540: 71 runs. Check Changeset is the only failure, for the reason above. 10 are skipped by design (the opt-in upgrade harness and tarball smoke, the two queue verdicts, the schedule gate, the unexpanded dogfood matrix placeholder, Lint UI, Dogfood Verify CLI, UI Published Artifacts, Temporal Conformance). The other 60 succeeded, including all ten Test Core shards, all sixteen Test UI shards, Spec property liveness, Governed Surface Queue Guard, the PR-body guards and every Lint · and Type Check · job.
  • Base moved under the checks: the changeset job diffed from 29e0c4bf5f6c, two commits of main past the second parent, because the PR check runs on the merge with main as it was then. Its verdicts are the ones quoted above; of the PR's files those two commits touch only content/docs/deployment/cli.mdx, adding ten lines in another part of the page and no rule count.
  • SQL push-down: the merge adds no data access to the PR's diff; nothing to push down.
  • No dev flag and no open_questions entry is new since 7215110573.

④ Design judgment

The narrowing against the published spec on main as merged: unchanged. BookAudienceSchema on main still has the non-strict { permissionSet } arm that strips a second gate key, so the PR still takes away exactly one accepted shape, the two-gate audience, declared with FROM → TO. The ADR-0087 entry and the three lint files in scope read exactly as at b9998850; the judgment on each in 7215110573 carries over, with its two accepted nits N1 and N2 unchanged.

The conflict resolution itself is the right one: each side added to the same registry-derived number, and the resolved value is the sum the registry gives, checked by the drift gate.

No must-fix, no should-fix.

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

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head dc85e54 · card #37613 · area s2-data · 2026-11-27T10:55Z

Re-covers the ACCEPT 7215203264 (head b999885) on the merge head; the Tier H hand-off 7215226753 stands.

L1 checklist

  • Merge only. dc85e540 merges main into the branch; its one hand resolution is the four CLI transcript rule counts (now 86: 85 on main plus this PR's one). The merge-only delta record 7216465209 at this head at CONTRACT_REVIEW_TIER: PASS, No must-fix, no should-fix., the PR's net diff unchanged but for those four lines, nothing main brought makes a sentence of the changeset or the ADR-0087 entry false. The seat adopts it.
  • Checks. All green but Check Changeset, red only on the step that refuses a change to a pending note: the DELIBERATE CORRECTION of feat(spec): a book audience can name a capability, so Setup and Studio docs open only for callers who can open those apps #37591's note, confirmed by 7215110573 and unchanged on main. The first run's two load timeouts are explained in 7215769305 and passed on the second attempt.
  • Dogfood. The os-dev-report 7216363823 on review follow-ups of PR #37591 #37613 runs the full battery on dc85e540: no failures.
  • Declarations, Fixes #37613, security label. Unchanged from 7215203264.

Tier: H. Landing: the maintainer's approval, as handed off in 7215226753.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file 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 protocol:system security 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.

review follow-ups of PR #37591

2 participants