Repository navigation
feat(approvals): the opening check's conditions are reported where a flow or an object is published (ADR-0162 item 7, slice N45) - #38527
Conversation
…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
📓 Docs Drift CheckThis PR changes 2 package(s): 21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 13 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
…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
|
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 @
|
|
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 reviewServed-tier: Scope: the declaration face of ① Derived judgmentsEach public-surface change the diff implies, and each change to what the system accepts, judged:
Findings, graded:
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
③ Boundary flagsThe five questions the seat set (ruling relayed 2026-11-29 07:08Z):
Dev flags and
Implemented-by: 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
Requested by Leehom · project thread
Part of #37766
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
addAuthoringGate:在某类型原有的发布闸门旁边再加一道闸门,原有的单槽和"后注册替换前者"的规则保持不变(plugin-security 占着object那一槽)。加上的闸门在草稿转发布时也会运行。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-trunkafter slice B (#38499, merged at 4cc09b1).@objectstack/metadata-protocol:addAuthoringGate(type, gate)(new public member).registerAuthoringGateholds one gate per type, and a second registration replaces the first; plugin-security holdsobject. 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 toactive(promoteDraftForPublish, sopublishMetaItem, a package publish and a judge-only call), which the owner gate does not run on. A declaredpackage-authorchannel runs neither. The slot ofregisterAuthoringGateand its replace rule are untouched.protocol.tssits 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 throughrunAuthoringGatewithaddedOnly: truerather than through a second private runner.MetadataAuthoringGateContext.pending(new optional member, L2 S3). At a package publish's promotion an added gate is handed theobjectandflowbodies 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 declaresclosedStatesand repairs the flow it closes on in one publish goes through in either draft order; pinned by unit tests (reverse-verified) and a real-kernelpublishPackageDraftstest. Absent on a save, a restore and a single publish.approval-publish-check.ts(new). It is pure over aPublishCheckSource, and it reuses slice B'sjudgeApprovalOpeningwith the written item in place of the held one.subflow/map, to any depth. The walk up the callers keeps a visited set and stops at 64 roots.startnode'sobjectName, or a record start input, [Decision] flows and records: may a flow start input declare a record reference (A), and does a non-system create stop choosing the new record's id (C)? #29425), or that maps over its records (itemObject), is judged as a root. Only gaps on the written object are reported.approval-publish-gate.ts(new).registerApprovalPublishGatesadds theflowandobjectgates. The plugin wires them onkernel:ready.ApprovalPublishRefusedErroris the refusal:400 VALIDATION_FAILED,messageinen,userMessagein the first locale the door states.ApprovalService.judgePublishedItemsupplies the engine's readers.ApprovalResumeSurfacedeclareslistFlows, a methodAutomationEnginealready implements publicly.approvalPublishRefusedLead, the publish lead sentence, is added in all 11 catalog packs.publishRefusalTextshares the gap sentences withopeningRefusalText.allNodesinapproval-opening-check.tsis 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
declaration→TIER_DEFAULT. This was read withreviewFaceover 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: [] } }. Nopackages/spec/src/**path is touched, no governed path is touched, and no(narrowing)arm is declared.addAuthoringGateis on the published surface:Clause-②: yes (widening).ObjectStackProtocolImplementationis 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 byprotocol.add-authoring-gate-37766.test.ts.ApprovalService.judgePublishedItemand the optionalApprovalResumeSurface.listFlowswiden@objectstack/plugin-approvalsthe same way.Metadata-protocol: none, no(narrowing)arm. A gap can be raised only where an object declaresclosedStates. 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.closedStatesexists only on the trunkclaude/o5-data-approvals-trunk, and no released version of@objectstack/specaccepts 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
activethrough a draft, which is the Studio and MCP path.unreadable_flowis 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.jobservice is not refused at publish (no_job_serviceis never raised there). It is a fact of the host, not of what is authored, and the first request refuses it.closedStates, with the written object in place, reads nothing.object_extensionwrite. 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 declaresclosedStates, 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.Verification
protocol.add-authoring-gate-37766.test.ts: 10 tests.draft, active saveactive, the promotionactiveand not the owner, a throw at promotion refusing before any active row, andpackage-authorrunning none.approval-publish-check.test.ts: 26 tests.mapover its records, flows that cannot be listed;enandzh-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.kernel:ready;zh-CNuserMessage;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.pnpm --filter @objectstack/plugin-approvals run typecheck(test layer held in its debt ledger) andpnpm --filter @objectstack/metadata-protocol run typecheck: OK.node scripts/check-facade-delegation-only.mjs: OK, withprotocol.tsat 11705 of 11705.node scripts/check-i18n-bundles.mjs: in sync.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5nzgcVrZ8Neqqd1AFi