Skip to content

feat(approvals): the opening check's conditions are reported where a flow or an object is published (ADR-0162 item 7, slice N45) - #38527

Draft
objectstack-fleet[bot] wants to merge 4 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-fkdrk9
Draft

objectstack-fleet[bot] wants to merge 4 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-fkdrk9

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #37766

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 审批开启检查(slice B,已进主干)的条件,现在在发布时也会报出:发布流程或对象时,如果某个审批因此无法在关闭字段上显示「审批中」,发布以 400 VALIDATION_FAILED 被拒,并用与开审批时相同的句子逐条说明缺什么,语言按请求的语言。
  • 只拦 active 写入。草稿保存不拦,草稿转为发布时才判断。看不到的被调用流程不拒,没有作业服务的宿主也不在发布时拒;这两种情况在审批第一条请求时仍然会被拒。
  • 元数据协议新增一个成员 addAuthoringGate:在某类型原有的发布闸门旁边再加一道闸门,原有的单槽和"后注册替换前者"的规则保持不变(plugin-security 占着 object 那一槽)。加上的闸门在草稿转发布时也会运行。
  • 状态(07:50Z 席位):L2 认为新增闸门成员需要 ADR 注记(S1),且 ADR-0162 写明「发布时不拒」(S2),已交维护者在 A / B / C 三个选项中定;定之前本 PR 保持草稿,不进主干。
  • 规则仍是开审批时的拒绝;发布时的拒绝是提前告知。ADR-0162 里"发布时不拒"那一行,按席位 05:24Z 的裁定在本片进入主干时写到 ADR revisions, week of 2026-11-29: rolling checklist of ADR text out of step with main (one governed PR) #38438。

What changes

ADR-0162 Execution item 7, "The same conditions are reported at authoring wherever the parts are in view together", made an error at publish on the seat's reading of 2026-11-29 05:24Z (N45). Slice N45 of #37766, on the trunk claude/o5-data-approvals-trunk after slice B (#38499, merged at 4cc09b1).

  • @objectstack/metadata-protocol: addAuthoringGate(type, gate) (new public member). registerAuthoringGate holds one gate per type, and a second registration replaces the first; plugin-security holds object. An added gate runs after the owner gate, in the order added, on every write the owner gate runs on (runAuthoringGate: a save in either mode, a restore), and also when a draft is promoted to active (promoteDraftForPublish, so publishMetaItem, a package publish and a judge-only call), which the owner gate does not run on. A declared package-author channel runs neither. The slot of registerAuthoringGate and its replace rule are untouched. protocol.ts sits exactly at its facade line ceiling (11705), so the facade's net growth is zero: the touched docblocks are rewrapped, the added-gate map is handed to the class-head facet directly, and the promotion runs the added gates through runAuthoringGate with addedOnly: true rather than through a second private runner.
  • MetadataAuthoringGateContext.pending (new optional member, L2 S3). At a package publish's promotion an added gate is handed the object and flow bodies of the batch's drafts (request.pending, the closure the runtime lint already reads), and the approvals check reads them in place of the live items of the same name. A package that declares closedStates and repairs the flow it closes on in one publish goes through in either draft order; pinned by unit tests (reverse-verified) and a real-kernel publishPackageDrafts test. Absent on a save, a restore and a single publish.
  • approval-publish-check.ts (new). It is pure over a PublishCheckSource, and it reuses slice B's judgeApprovalOpening with the written item in place of the held one.
  • approval-publish-gate.ts (new).
    • registerApprovalPublishGates adds the flow and object gates. The plugin wires them on kernel:ready.
    • ApprovalPublishRefusedError is the refusal: 400 VALIDATION_FAILED, message in en, userMessage in the first locale the door states.
    • A judge that throws is logged and refuses nothing.
    • A walk that hit the cap logs one sentence and refuses nothing for it.
  • ApprovalService.judgePublishedItem supplies the engine's readers. ApprovalResumeSurface declares listFlows, a method AutomationEngine already implements publicly.
  • approvalPublishRefusedLead, the publish lead sentence, is added in all 11 catalog packs. publishRefusalText shares the gap sentences with openingRefusalText. allNodes in approval-opening-check.ts is exported for reuse, with no change of verdict.

Why

The maintainer's ruling 7205949718 on #36253, verbatim: 「平台拒绝这种配置」. The option it chose reads 「字段声明了关闭值、却缺少"审批中"状态或退回路径时,发布或开审批时直接报错」. Slice B made the opening the rule. This slice adds the publish half as early notice, on the seat's 05:24Z ruling.

Face readings

  • Review face: declaration → TIER_DEFAULT. This was read with reviewFace over the PR's 16 paths (4cc09b1..d1ef745), with both changesets and this body as the declaration texts. It returned { face: 'declaration', tierName: 'TIER_DEFAULT', hits: { schema: [], rules: [] } }. No packages/spec/src/** path is touched, no governed path is touched, and no (narrowing) arm is declared.
  • (1) addAuthoringGate is on the published surface: Clause-②: yes (widening). ObjectStackProtocolImplementation is exported from @objectstack/metadata-protocol's entry (packages/metadata-protocol/src/index.ts:3, export { ObjectStackProtocolImplementation, … } from './protocol.js'), so the new public member reaches the package's published types. It adds a member and changes no existing signature: registerAuthoringGate's single slot and its replace rule are as published, pinned by protocol.add-authoring-gate-37766.test.ts. ApprovalService.judgePublishedItem and the optional ApprovalResumeSurface.listFlows widen @objectstack/plugin-approvals the same way.
  • (2) The publish refusal is not a narrowing: Metadata-protocol: none, no (narrowing) arm. A gap can be raised only where an object declares closedStates. The approvals gate returns before reading anything unless some object, with the written one in place, declares the key, and every condition is keyed on a field the object closes on. closedStates exists only on the trunk claude/o5-data-approvals-trunk, and no released version of @objectstack/spec accepts it: ADR-0162 Execution item 1 releases the key together with items 7 and 8. So no body that any released version accepts can be refused by this slice, and nothing an author can write today is refused. If the key were released before this slice, the reading would fail, and the narrowing arm would owe a contract-tier L2 and the dogfood battery.

Readings

  • Active writes only. A draft save is not refused (ADR-0094 D1, [runtime/metadata] 作者时规则只存在于 CLI:Studio/REST/MCP 的运行时授权面是第四扇门,26 条规则一条不跑——#4409 修完后最大的敞口 #4463 D1). Since the owner gate does not run at promotion, the promotion now runs the added gates. Without that, an active-only gate would never see a body that reaches active through a draft, which is the Studio and MCP path.
  • A callee that cannot be read is not refused at publish (unreadable_flow is dropped). The first request still refuses an approval it cannot read whole, and lint: a second batch of publish-time checks for metadata that saves and does not work — the ones only the hosted build check makes today #35143's gate (fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38241) owns a call to a flow the deployment does not hold. What can be read beside it is still judged.
  • A host with no job service is not refused at publish (no_job_service is never raised there). It is a fact of the host, not of what is authored, and the first request refuses it.
  • An application in which no object declares closedStates, with the written object in place, reads nothing.
  • The cap. The walk up the callers, or the scan of flows on an object, stops at 64 roots. Past that it judges the roots it holds, refuses nothing for the cap, and logs one sentence. A flow that calls itself, and two flows that call each other, end the walk through the visited set.
  • An object publish reports only the written object's gaps, so publishing one object is not refused for another object's configuration.
  • Shared flow names. For a name two packages hold, the written body stands in for the name in every read. The publish is early notice, and the first request reads by package slot.
  • Not covered at publish: an object_extension write. The key is read off the object as the registry folds it, and the first request covers it.
  • Metadata-protocol: none. The refusal reaches only an application in which an object declares closedStates, a key not yet released (ADR-0162 Execution item 1: the key is released with item 7 and item 8). No released author can write a body this refuses. This is graded here as the seat asked, and L2 may correct it.
  • The door, for L2 (seat condition 1): a new member beside the slot, instead of the slot's holder composing other plugins' gates. See the L2 brief.

Verification

  • protocol.add-authoring-gate-37766.test.ts: 10 tests.
    • the order (owner, then added in order);
    • one shared context;
    • the owner not displaced, and a second owner registration still replacing only the owner;
    • no owner, plural types;
    • a throw propagating, and an owner throw stopping the added gates;
    • through the doors: draft save draft, active save active, the promotion active and not the owner, a throw at promotion refusing before any active row, and package-author running none.
    • Reverse-verified: removing the promotion call turns the two promotion arms red.
  • approval-publish-check.test.ts: 26 tests.
    • the flow arms: refused, clean, the written body, a caller as root, any depth, a self-call, a mutual call, the cap, a record start input;
    • the object arms: refused, the written object, dropping the key, only its own gaps, a map over its records, flows that cannot be listed;
    • what is not refused: an unreadable callee alone and beside a gap, the host, no declaration, a body with no nodes;
    • the gates: registration and feature detection, the 400 in en and zh-CN, a draft not judged, a failing judge, the cap sentence, the judge's input.
  • approval-publish-gate-37766.integration.test.ts: 7 tests on the real kernel, ObjectQL with its metadata protocol, the automation engine and the approvals plugin booted whole.
    • the plugin adds its gates on kernel:ready;
    • an active flow save refused with the sentence and no active row;
    • the zh-CN userMessage;
    • a clean flow;
    • a flow on an object with no declaration;
    • a draft let through and its promotion refused;
    • an authored object refused as it starts to close on its approval field.
    • Reverse-verified: without the plugin's wiring, the 5 refusal arms turn red and the 2 "not refused" arms stay green.
  • Suites:
    • pnpm --filter @objectstack/plugin-approvals exec vitest run: 2139 tests, 138 files, green.
    • pnpm --filter @objectstack/metadata-protocol exec vitest run: 23657 tests passed (45 skipped), 385 files (376 passed, 9 skipped), at the head.
  • Gates:
    • pnpm --filter @objectstack/plugin-approvals run typecheck (test layer held in its debt ledger) and pnpm --filter @objectstack/metadata-protocol run typecheck: OK.
    • node scripts/check-facade-delegation-only.mjs: OK, with protocol.ts at 11705 of 11705.
    • node scripts/check-i18n-bundles.mjs: in sync.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi

…flow or an object is published

The metadata protocol gains addAuthoringGate: a gate added beside a type's
owner gate, which runs after it on every save and restore and also when a
draft is promoted to active. The approvals plugin adds publish gates on flow
and object that judge an active write by the conditions an approval opens on
(ADR-0162 D5), as the engine will hold things once the write lands, and
refuse it with the same sentences an approval's first request is refused
with, as a 422 VALIDATION_FAILED in the author's locale. A draft, a callee
that cannot be read and a host with no job service are not refused at
publish; the first request still refuses them.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/metadata-protocol, @objectstack/plugin-approvals, touching 103 documentable anchor(s).

21 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 4cc09b16f4eae866c94e99a12bde24470bf1eab4.

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

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_FAILED (literal, 52 pages)
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 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; 125 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 — 13 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 4cc09b16f4eae866c94e99a12bde24470bf1eab4 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6b1de698c041e9d92f822b7f6f0acad79ebb0a7e — the merge of head a19894535435007a9ccc5f6c4f02355e5066b69f into base 4cc09b16f4eae866c94e99a12bde24470bf1eab4, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older claude/o5-data-approvals-trunk 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 6b1de698c041e9d92f822b7f6f0acad79ebb0a7e && git checkout 6b1de698c041e9d92f822b7f6f0acad79ebb0a7e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4cc09b16f4eae866c94e99a12bde24470bf1eab4 a19894535435007a9ccc5f6c4f02355e5066b69f && git checkout -B drift-repro 4cc09b16f4eae866c94e99a12bde24470bf1eab4 && git merge --no-ff a19894535435007a9ccc5f6c4f02355e5066b69f

node scripts/docs-audit/affected-docs.mjs --json 4cc09b16f4eae866c94e99a12bde24470bf1eab4

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

…the pinned ledger

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi
…the gate test doubles drivable

The publish refusal carries VALIDATION_FAILED at 400, the status the error
ledger documents for that code. The add-authoring-gate test loads
@objectstack/lint at module top and its find double honours a caller's limit.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nzgcVrZ8Neqqd1AFi

The brief handed to the isolated reviewer sub-agent whose record is posted beside this comment (posted for the seat to read before it adopts the record).

Contract review brief — PR #38527 @ d1ef745e185c01a62239ed506f90615bdbe444f7 (card #37766)

You review at TIER_DEFAULT. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --face declaration — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #37766: its body and EVERY comment (rulings and earlier records included)
· PR #38527: its body, its file list, and the net diff against its base claude/o5-data-approvals-trunk (4cc09b1) at d1ef745e185c01a62239ed506f90615bdbe444f7
· the check-runs on d1ef745e185c01a62239ed506f90615bdbe444f7: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the declaration face: the widened surface the Clause-②: yes (widening) line declares. That is:
· the new public member ObjectStackProtocolImplementation.addAuthoringGate (packages/metadata-protocol/src/protocol.ts), with its body (protocol-class-head.ts) and its run (runAuthoringGate in protocol-authoring-gate.ts, and the promotion call in protocol-history-and-publish.ts promoteDraftForPublish);
· ApprovalService.judgePublishedItem and the optional ApprovalResumeSurface.listFlows (approval-service.ts);
· the catalog key approvalPublishRefusedLead (translations/messages.ts).
Also in scope: every file IN THIS DIFF that implements or enforces them: approval-publish-check.ts, approval-publish-gate.ts, approvals-plugin.ts, approval-opening-refusal.ts, and approval-opening-check.ts (where allNodes is now exported).
Tests and changesets are the lane seat's ACCEPT at TIER_DEFAULT.

Questions the seat set for this review (seat ruling relayed 2026-11-29 07:08Z). Answer each one in ③ by name:
Q1. The door. Is addAuthoringGate, a new member beside the single slot, the right design? The alternative is that the slot's holder composes other plugins' gates inside the existing single slot. Check for an existing multi-gate precedent on the protocol, or an ADR that forbids one (ADR-0094 and its addendum seam, #3050, the "Deliberately NOT a registerAuthoringGate registration" note above assertRuntimeAuthoringRules). If you judge that it needs an ADR note, or that it amounts to a second registration mechanism (two implementations of one seam), say so as a finding and STOP there. ⛔ Do not redesign; the seat decides.
Q2. Walking up the callers "to any depth" must have a cycle guard and a cap. Check that a flow calling itself and two flows calling each other are both pinned, and that the behaviour past the cap is pinned too: not refused, with one sentence reported.
Q3. These must each be pinned: the refusal happens on active writes only; a draft is not refused; a callee that cannot be read is not refused; a host with no job service is not refused at publish.
Q4. The Metadata-protocol: none grade. AGENTS.md says "a value refused or a requirement tightened is narrowed". This slice refuses a publish only where an object declares closedStates, a key that is on the trunk and not yet released (ADR-0162 Execution item 1). Judge whether none holds, or whether it must be narrowed.
Q5. protocol.ts sits exactly at its facade line ceiling (11705), so the change is fitted at zero net growth. Check that what was cut to fit (rewrapped docblocks, the map handed to the facet directly, addedOnly in place of a second runner) loses no contract text the class docblocks carried.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/98b97fe0-1d71-5765-93e6-b5f728112098/scratchpad/pr-38527/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.
----- to here -----

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nzgcVrZ8Neqqd1AFi

Independence: isolated sub-agent of the implementing session (brief 7252737675), for the seat to adopt as it did for slice B (7251725255). The PR head has since moved to 4172ad6: the refusal status 422 → 400 (the status the error ledger documents for VALIDATION_FAILED) and two test-harness gate fixes. This record does not cover that move. Per the seat (07:50Z), the PR stays a draft until the maintainer settles S1 and S2; S3 and S4 are being fixed, and a delta review follows.

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 4b91cd2e6f5e615fd571323a910a006c1aaad233
Local-runs: none
Regen-provenance: 4b91cd2 = d1ef745 + engine-double ledger rows only (check-engine-double-contract --write)

Scope: the declaration face of Clause-②: yes (widening) on PR #38527 (card #37766, slice N45), net diff 4cc09b16f..d1ef745e1 against the trunk. The PR head then moved to 4b91cd2e6. I checked the compare d1ef745e1...4b91cd2e6 (1 ahead, 0 behind): it changes one file, scripts/engine-double-contract.pinned.json, adding three rows (delete, findOne, update, each pinned: 1) for protocol.add-authoring-gate-37766.test.ts. That file is outside the face, so every judgment below holds for 4b91cd2e6. The trunk is claude/o5-data-approvals-trunk. The surface: ObjectStackProtocolImplementation.addAuthoringGate (protocol.ts), its body (protocol-class-head.ts) and its run (runAuthoringGate, protocol-authoring-gate.ts; the promotion call in promoteDraftForPublish, protocol-history-and-publish.ts); ApprovalService.judgePublishedItem and the optional ApprovalResumeSurface.listFlows (approval-service.ts); the catalog key approvalPublishRefusedLead (translations/messages.ts). Also reviewed, because they implement or enforce that surface: approval-publish-check.ts, approval-publish-gate.ts, approvals-plugin.ts, approval-opening-refusal.ts, approval-opening-check.ts (allNodes exported). Tests and changesets are the lane seat's ACCEPT at TIER_DEFAULT; I read them only to answer Q2 and Q3. Inputs: the card body and all 11 comments, the PR body and file list (16 files, +1292 −36), the net diff, and the head's check-runs. Code outside the diff was read but not reviewed.

① Derived judgments

Each public-surface change the diff implies, and each change to what the system accepts, judged:

  1. addAuthoringGate(type, gate): new public member. The judgment of the member's behaviour is right; its design is open (S1). The behaviour matches its docblock and changeset:
    • singular and plural types resolve, and each call appends one gate (ProtocolClassHeadFacet.addAuthoringGate);
    • added gates run after the owner gate, in the order added, with one shared context (runAuthoringGate);
    • an owner throw stops the run before any added gate;
    • a declared package-author channel runs neither kind of gate, at save (protocol-save.ts:2010) or at promotion.
    • The registerAuthoringGate slot and its replace rule are byte-for-byte unchanged. plugin-security's object, permission and position registrations are unaffected.
  2. runAuthoringGate (private) gains addedOnly: right. With addedOnly, the owner lookup is skipped (evt.addedOnly ? undefined : …). Without it, every existing caller behaves as before, because with no added gates registered added is [] and the original early return still holds.
  3. promoteDraftForPublish runs the added gates on a draft's promotion: right, with one hole (S3).
    • The call is placed after assertRuntimeAuthoringRules, before the override refusal and before the judgeOnly return. So a judge-only call and a package publish's Phase 0 both see it, and a throw refuses before any active row. That is pinned by the protocol test "a throw of the added gate at promotion refuses the publish before it writes".
    • The body is storedFlowVerdictBody(...), as the runtime lint is given. userTextLocales and packageId are threaded.
    • This changes behaviour only for a plugin that adds a gate. Today that is plugin-approvals alone.
  4. ApprovalService.judgePublishedItem(item): right. Every reader catches and answers undefined, null or 'unread', so a failed read is a part that cannot be read, and it is not refused. All the reads are in memory: the registry's getAllObjects, and the engine's listFlows, getFlow, getFlowSlot(s) and getActionDescriptor, which are map reads (service-automation engine.ts:6137–6151). There is no storage read.
  5. ApprovalResumeSurface.listFlows?(): Promise<string[]>: right. It is optional, it is already public on AutomationEngine (engine.ts:6137), and it is feature-detected at the call. It widens what an implementer may supply and does not require it.
  6. approvalPublishRefusedLead: right. It is present in all 11 packs (en, zh-CN, ja-JP, es-ES, zh-Hant, ar, fr, pt-BR, ru, de, ko), with {{type}} and {{name}} in every pack. publishRefusalText reuses the gap sentences that openingRefusalText uses. The refactor of openingRefusalText into gapSentences keeps its output identical.
  7. allNodes exported from approval-opening-check.ts: right. The module is not re-exported from the package's src/index.ts, so this widens nothing a consumer can import. Slice B's verdict path is untouched.
  8. What the system accepts: a new refusal, 422 VALIDATION_FAILED (ApprovalPublishRefusedError), on an active save, restore or promotion of a flow or object. Right in shape, with one ledger gap (S4).
    • The refusal applies only where some object, the written one included, declares closedStates. Otherwise nothing is read, which is pinned.
    • message is in en. userMessage is in the first locale the door states. The class field also carries status and statusCode 422.
    • A judge that throws refuses nothing and logs one warning.
    • Past the cap, nothing is refused for the cap, and one warning names MAX_PUBLISH_ROOTS.
  9. Wiring: right. wirePublishGates runs on kernel:ready, reads ctx.getService('protocol') inside a try, and feature-detects addAuthoringGate. A protocol without the member gets no gates, and the first request still refuses.

Findings, graded:

  • S1 (should-fix, the door: needs an ADR note, and the seat decides). See Q1 in ③. addAuthoringGate is a second way to register on the one authoring-gate seam of ADR-0094's addendum (OWD posture is lint-only at runtime: env can widen a packaged object's sharingModel via OS_METADATA_WRITABLE, and external≤internal (ADR-0090 D11) is never enforced on the write path #3050). That seam is documented as one slot per type (ADR-0094 lines 442 and 452–455; the protocol.ts note above assertRuntimeAuthoringRules: "per-type and single-slot, owned by the domain plugin"). The new member differs from the slot in three ways:
  • S2 (should-fix, must land before the trunk reaches main). ADR-0162, under "Points the ruling does not settle" (line 432), says verbatim: "the refusal is made when an approval opens and reported at authoring, and is not made at publish". This slice makes the refusal at publish. Prime Directive 13 says an accepted ADR binds until amended. The PR does not hide the change: its body and changesets say so, and they defer the ADR line to card ADR revisions, week of 2026-11-29: rolling checklist of ADR text out of step with main (one governed PR) #38438 "when this slice lands". The seat's 05:24Z ruling that this relies on is cited in claims 7252284600 and 7252492357, but it is not itself on the card. The amendment to ADR-0162 (an amended status line or note) must be merged before the trunk carries this to main. A row on a weekly card is not by itself the amendment PD13 asks for.
  • S3 (should-fix). A package publish judges each item against the engine as it stood before the batch, not as it will stand once the batch lands. The changeset says the gates judge "as the engine will hold things once the write lands". That is true for one write and false for publishPackageDrafts:
    • Phase 0 (an engine with no rollback) judges every draft before any is promoted.
    • Phase 1 judges the drafts in draft-list order (ordered, protocol-history-and-publish.ts:2151), with no dependency sort.
    • The added gate is given no pending, unlike assertRuntimeAuthoringRules (publishPackageDrafts validation closure omits same-batch dataset drafts: a package shipping dashboard+dataset together can never publish (widget-dataset-unknown) #10377, "publishable in either order").
    • So a self-consistent package that adds closedStates to an object and fixes the held flow in the same batch is refused on the object when the object comes first. The workaround is to publish the flow first.
    • No reading in the PR and no test covers a batch.
      The fix is one of: thread the batch's pending flows and objects into the judgement; state the batch reading as a pinned limitation; or narrow the changeset sentence. The seat's choice.
  • S4 (should-fix). plugin-approvals now puts VALIDATION_FAILED on the wire from a class field (readonly code = 'VALIDATION_FAILED', approval-publish-gate.ts). The @objectstack/plugin-approvals row of the error-code ledger lists only FORBIDDEN, RECORD_LOCKED and RESUME_FAILED, and there is no waiver for this code. ADR-0112 D3's provenance rule ("listed once per emitting package") is therefore not met. check:error-code-provenance will not catch it, because it is declared blind to class fields (check-error-code-provenance.ts:70–77). So this is a real ledger gap that the gates leave green. The fix is a row with its reachability comment, or a waiver. Either touches packages/spec, so it may be its own trunk PR before release.
  • N1 (nit). The cap test ("stops at 64 roots…") makes every root clean. It pins capped === true and the absence of a refusal for the cap, but it would stay green if roots past the cap were still judged. A gap on root 65 would pin "not judged past the cap".
  • N2 (nit, see Q5). Two pieces of contract text sit away from the addAuthoringGate docblock, which is the member's contract:
    • its docblock leaves out the package-author exception at promotion, which the code applies (host.authoringChannel !== 'package-author');
    • "singular or plural type names both resolve" now appears only on the facet's docblock.
  • N3 (nit). The lead sentence says {{type}} {{name}} was not published for every door the gate runs on, including a draft promotion, a judge-only call and a restore. "Published" reads oddly on a restore.

SQL push-down (Prime Directive 5): no finding. The diff adds no id materialisation, no in-app join and no storage read. Every read the publish check makes is of the in-memory object registry or the automation engine's flow map.

② Semver level

  • .changeset/37766-publish-gate-door.md: '@objectstack/metadata-protocol': patch, Clause-②: yes (widening), Metadata-protocol: none. Right. It adds a public member and narrows nothing that is released. none takes patch, and a widening that is not a protocol change ships patch (AGENTS.md, Post-Task Checklist item 3).
  • .changeset/37766-publish-gate-approvals.md: '@objectstack/plugin-approvals': patch, the same two lines. Right. It names what is widened: judgePublishedItem and the catalog key. It does not name the optional ApprovalResumeSurface.listFlows (an omission at nit level, already covered by "Widened" being a list of examples rather than a full inventory). That member is optional and widens only what an implementer may supply.
  • The PR body carries the same Clause-②: yes (widening) and Metadata-protocol: none lines. The (widening) arm is right: nothing released is narrowed. The new refusal applies only where an object declares the unreleased closedStates key (Q4).
  • Check-runs on the head, as they stand:
    • Check Changeset: one run success, one in progress.
    • Success: Governed Surface Queue Guard, PR-body guards (×2), Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Dogfood Regression Gate, Test UI, Check PR Size.
    • In progress: Build Core; Test Core 1–12 of 12; Type Check (workspace, source gates, consumer gates, debt ledger); Lint (ESLint, docs & code guards, repo & tooling gates, CI/release/engine gates, two scoped); Live E2E UI.
    • None has failed.
    • On the reviewed head 4b91cd2e6, at the time of writing: Governed Surface Queue Guard success. In progress: Check Changeset, Check PR Size, PR-body guards, Flag docs affected by code changes, every Lint job but two, and all four Type Check jobs. Queued: the two scoped Lint jobs (query-options erasure; slot lookup & corpus). Build Core and Test Core had not started. Nothing has failed. Those checks give the verdict on whether the head is green; this record does not.
    • The facade-ceiling check (protocol.ts at 11705 of 11705) and the i18n bundle check run inside the in-progress Lint families. Their verdicts are not yet in, and this record does not stand in for them.

③ Boundary flags

The five questions the seat set (ruling relayed 2026-11-29 07:08Z):

  • Q1. The door.
  • Q2. The walk up the callers.
    • The cycle guard is the seen set, seeded with the written name. The held-flow scan also skips the written name.
    • Pinned: "ends the walk on a flow that calls itself" and "ends the walk on two flows that call each other", each asserting the gap and capped === false.
    • The cap is MAX_PUBLISH_ROOTS = 64, on both the flow walk and the object scan. Past it: no refusal for the cap, and one sentence, pinned twice:
      • the check test asserts capped === true and no gaps;
      • the gate test asserts exactly one warning containing "first 64 approval flows", and that nothing is refused.
    • The "not judged past the cap" half is pinned only weakly (N1). The object scan's cap has no test of its own (nit, covered by N1).
  • Q3. What is not refused. Each is pinned:
    • Active writes only: the gate test "does not judge a draft" (both types, and the judge is never called); the protocol test "a draft save runs the added gate with state draft"; the integration test "does not refuse a draft, and refuses its promotion".
    • A callee that cannot be read: "does not refuse a callee it cannot read" and "judges what it can read beside a callee it cannot read". unreadable_flow is filtered out by NOT_AT_PUBLISH.
    • A host with no job service: "does not refuse for the host". The integration kernel boots ObjectQL, automation and approvals with no job service, and its clean-flow arm passes. The unit pin is doubly guarded: hostRunsReconciler: true and the NOT_AT_PUBLISH filter. Removing either one alone keeps it green; only removing both turns it red. That is acceptable, because both say the same reading.
  • Q4. The Metadata-protocol: none grade holds.
    • The refusal applies only where an object declares closedStates. That key is on the trunk (.changeset/37768-closed-states-spec.md, @objectstack/spec minor, Metadata-protocol: added), and it is not on main (base 4cc09b16f is not an ancestor of origin/main).
    • No released author can write a body this refuses. The key's own changeset already counts the refusals at the save and publish door as part of what added means. Slice B (feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) #38499) was graded none on the same reasoning, and CI accepted it.
    • addAuthoringGate is a protocol API, not something a metadata author can write.
    • The grade depends on the card's release rule: the key is not published before slices A, B and C, and this slice, share a release. If the key ever shipped without this slice, a later release carrying this refusal would be narrowed. The seat should keep that rule attached to the trunk's merge.
  • Q5. Fitting protocol.ts to its ceiling (+19 −19). No contract text was lost; I compared each rewrapped docblock word for word:

Dev flags and open_questions:

  • No os-dev-report for feat(approvals): the opening check's conditions are reported where a flow or an object is published (ADR-0162 item 7, slice N45) #38527 is on the card. The 06:08Z report is for feat(approvals): the check when an approval opens, and the between-two-steps stamp (ADR-0162 item 7, slice B) #38499 and has open_questions: []. The PR names two points for this review:
    • "the door, for L2 (seat condition 1)": answered by Q1 and S1, escalated to the seat;
    • "Metadata-protocol … L2 may correct it": answered by Q4, none holds.
  • Claim 7252492357 said "one new module for the publish judgement". The diff adds two: approval-publish-check.ts and approval-publish-gate.ts, both inside the claimed plugin directory. This is a minor departure from the claim's file surface; no other path is outside it. protocol-host.ts and protocol-authoring-channel.ts were claimed and needed no change, as the amended claim says.
  • Identity: the Reviewed-by session below is the same session id that claim 7252492357 names as the implementing thread (session_01FEkQ5nzgcVrZ8Neqqd1AFi). This review ran as an isolated subagent on a read-only brief, but the seat should judge whether a record signed by the same session meets its rule on independent review before relying on it.

Implemented-by: claude/project-thread-fkdrk9
Reviewed-by: session_01FEkQ5nzgcVrZ8Neqqd1AFi

VERDICT: PASS

At a package publish's promotion the added authoring gates are handed the
batch's object and flow drafts, and the approvals publish check reads them in
place of the live items of the same name. A package that declares closedStates
and repairs the flow it closes on in one publish goes through in either order.

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

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

documentation Improvements or additions to documentation size/xl 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