Repository navigation
fix(approvals): "the approval ended here" is judged by the content of the body the run ran, so it survives restarts - #38825
Conversation
…ssors Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…proval-ended-durable-witness # Conflicts: # packages/plugins/plugin-approvals/src/approval-service.ts
📓 Docs Drift CheckThis PR changes 3 package(s): 10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 182 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 718955dcdd7303601d8595da76ab02be566286ba && git checkout 718955dcdd7303601d8595da76ab02be566286ba
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7625001f9b7918edb08d6413bc24026d692f6e94 e8c5a1ebb8598b9ff46fa84c0f1322d4d0b6bef3 && git checkout -B drift-repro 7625001f9b7918edb08d6413bc24026d692f6e94 && git merge --no-ff e8c5a1ebb8598b9ff46fa84c0f1322d4d0b6bef3
node scripts/docs-audit/affected-docs.mjs --json 7625001f9b7918edb08d6413bc24026d692f6e94
|
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Read: card #37218 and its thread (claim 7297251064, report 7299073795), the PR body, and the diff of the head against merge-base 440574f (15 files). Nothing was built or run. All line numbers are at the head. ① Derived judgmentsThe sentence under review is Holds against the code:
Does not hold (F1, must-fix): a stranded run's row answers the snapshot's pin as the run's identity.
② Semver level
③ Boundary flags
④ Design judgmentpackages/spec/src/contracts/approval-service.ts: the sentence is the right contract. It names content identity, says what keeps and what loses the answer, and stays fail-closed. It is exact against the code except for F1. First consumer: the approvals get in the same diff. run-flow-checksum.ts, the producer: the stamp rules are sound and small. A stamp names its run, so a child never inherits its parent's; run-body-witness.ts, the plugin witness: correct and minimal. Dropping the registration-time check rather than keeping it as a fast path is right, since its only extra answers were the N7 cases. Pins: the plugin pins assert the substance (whole Findings:
To fix before a PASS: F1 (must-fix), then F2 and F3 (should-fix). The nits do not block. Implemented-by: VERDICT: FAIL |
…answers finished runs only Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…the contract and the changeset Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Delta read of the patch round against FAIL 7299347767 on 7cd28d2: the diff of 7cd28d2 to this head (11 files, two commits), the patch-round report 7299896145, and the code the delta cites, re-read at this head. Nothing was built or run. The parts of the first record the delta does not touch stand as written there. ① Derived judgmentsF1 is closed. A strand records no run identity, on both stores.
F2 is closed. F3 is closed by the card's other arm. The dev measured the sibling reachable (a node with two unconditional out-edges to two approval steps opens two pending requests in one run), so the parse-refusal pin was withdrawn and
② Semver level
③ Boundary flags
④ Design judgmentpackages/spec/src/contracts/approval-service.ts: both sentences hold against the code at this head. suspended-run-store.ts and run-flow-checksum.ts: the fix is the smaller of the two closings I offered and it is the right one. A run that can still be restored has not stopped for good, so answering none is true to the sentence, not only safe. The producer and the reader each enforce it, so a store that keeps the record whole and one that goes through the column agree. approval-route.ts: one line of logic, with the reason in the docblock. The unit pins cover the sibling, a request opened after the decision, and the fallback. The integration pin measures the fan-out on the real engine before it asserts the route. Findings, all nits:
F1, F2 and F3 are closed. Nothing at must-fix or should-fix is open. Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #38825 (#37218) · head 席位核对
|
…acade over eight facet modules (steps 2 and 3 of the engine split) (objectstack-ai#38889) repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Fixes objectstack-ai#38667 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:自动化引擎的主类按职责拆成八个文件,类本身只留下各方法的签名和一行转发,流程运行、恢复、注册的行为都不变。 - 属于自动化引擎拆分(大文件计划第四张卡)的第二、三步:第一步已合并;这一步之后,后续自动化相关的卡可以各改各的文件,并且有门禁防止主类重新长回去。 - 若拆分有误,会表现为自动化流程注册或运行出错;这次只搬代码,整体撤回这次合并即可恢复原状。 - 改动超过三千行,需要你批准后才能合并。 ## What changes Steps 2 and 3 of the card, on top of step 1 (objectstack-ai#38846, merged). Per the maintainer's ruling on this card (7305055957: 「A: keep the facade (Recommended)」), the 2,000-line target is dropped and the facade form holds. `AutomationEngine` in `packages/services/service-automation/src/engine.ts` becomes a delegating facade: the bodies of **145 members** move into static methods of eight facet classes, each body exactly as it stood (not re-indented, not formatted, not edited), with a `this` parameter added where the body reads the engine. Every member stays on the class with its signature and (when public) its docblock as a one-call stub, `return XFacet.m.call(xHost.of(this), …)`, so the published declaration, an instance spy and a subclass override are what they were. A private member's docblock moved with its body. The engine's state (all 74 fields) stays on the class. `engine.ts` goes from **9,813 to 7,735 lines**. The shape is the objectql `registry.ts` split's: each facet module declares the `AutomationEngine` members its bodies read as an interface typed by indexed access on the class (`AutomationEngine['x']`), so a member renamed or retyped on the class is a compile error in the facet; each method's `this` is the `Pick` of that interface it reads. `engine-facet-hosts.ts` holds one host per facet per engine (a `WeakMap`, built on first use), filled by the factory the class's one static block installs: a method goes as a closure that calls it on the engine at call time, a field as a getter, and the five fields a body assigns (`nodeTypeVocabularySealed`, `packagedFlowSource`, `packagedFlowDefaults`, `packagedFlowDefaultSource`, `flowCredentialSource`) also with a setter. Facet modules import `engine.ts` for types only, so there is no evaluation cycle; `index.ts` re-exports nothing from them. ### Every moved member and its new file `*` marks a public member (its docblock stays on the class); every other member is private and its docblock moved with its body. "Host" is the number of engine members the facet's bodies read. | New module | Lines | Members | Host | Members moved | |---|---|---|---|---| | `engine-dispatch-facet.ts` | 157 | 5 | 9 | `readScheduledWorkPolicy`, `slotKeyedRunStore`, `missedRunLimit`*, `recordMissedRun`*, `noteRunStarted` | | `engine-extensions-facet.ts` | 686 | 26 | 37 | `resolveTriggerBinding`, `activateFlowTrigger`, `triggerRun`, `deactivateFlowTrigger`, `getActiveTriggerBindings`*, `assertSameOriginOrFree`, `connectorInstance`, `resolveConnectorAction`*, `resolveConnectorActionInputSchema`*, `resolveConnectorActionEffect`*, `organizationLocale`*, `getConnectorOrigin`*, `getConnectorDegradedReason`*, `getConnectorDegradedHold`*, `registerConnectorProvider`*, `unregisterConnectorProvider`*, `getRegisteredConnectorProviders`*, `getConnectorDescriptors`*, `getRegisteredNodeTypes`*, `getActionDescriptors`*, `getRegisteredTriggerTypes`*, `knownNodeTypes`, `getUnknownNodeTypeAudit`*, `sealNodeTypeVocabulary`*, `getSealedNodeTypeVocabulary`*, `warnUnknownNodeTypes` | | `engine-flow-slots-facet.ts` | 814 | 41 | 55 | `flowArmHolder`, `loaderOwnerOf`, `placeFlowSlot`, `bindPackagelessActivation`, `flowActivationBinds`*, `moveFlowRecords`, `flowKeyNow`, `sharedFlowNameRefusal`, `resolveFlowKey`, `bareFlowKey`, `servedBareFlowKey`, `isDisabledHolderSlot`, `isDisabledSoleHolder`, `flowSlotPackage`, `flowSlotName`, `flowSlotKeysOf`, `loneSharedFlowKey`, `settleFlowName`, `isSharedFlowKey`, `executeSlot`*, `setPackagedFlowSource`*, `setPackagedFlowDefaultSource`*, `packagedFlowOwner`*, `inboundHookSlot`*, `disabledHolderHookRefused`, `packagedFlowSlotOwner`*, `isPackagedFlow`, `refuseUnpackagedDefaultActive`, `isShippedFlowName`, `packagedFlowDefault`, `refreshPackagedFlowDefaults`*, `flowNameRefusal`, `connectorNameRefusal`*, `resolveConnectorInstanceFor`*, `codeRegisteredInstance`, `flowCallerPackage`*, `armedFlowPackage`*, `flowHolder`*, `durableFlowHolder`*, `flowHolderPackage`*, `flowDispatchHolder`* | | `engine-registration-facet.ts` | 585 | 21 | 58 | `judgeFlowRegistration`, `dryRun`*, `registerFlow`*, `unregisterFlow`*, `withdrawFlow`*, `withdrawFlowSlot`*, `withdrawFlowKey`, `recordFlowRefusal`*, `getFlowRegistration`*, `recordFlowShadowing`*, `getShadowedFlows`*, `listFlows`*, `getFlow`*, `getRunFlow`*, `flowKeyOfRun`*, `getFlowSlot`*, `getHeldFlow`*, `registrationChecks`, `validateFlowExpressions`, `getValueType`, `validateNodeInputSchemas` | | `engine-connector-doors-facet.ts` | 247 | 16 | 9 | `setFlowCredentialSource`*, `pullConnectorSource`*, `requireConnectorCredentialDoor`, `attachConnectorCredentialPubSub`*, `resyncConnectorCredentialPubSub`*, `listConnectorCredentialRefs`*, `setConnectorCredential`*, `clearConnectorCredential`*, `requireConnectorConnectionDoor`, `getConnectorConnection`*, `beginConnectorConnection`*, `completeConnectorConnection`*, `revokeConnectorConnection`*, `holdsFlowCredential`*, `resolveFlowCredential`*, `flowCredentialHoldings`* | | `engine-enablement-facet.ts` | 410 | 12 | 20 | `isFlowEnabled`, `describeDisabledFlow`, `subflowTargets`, `resolvedFlowCallKey`, `declineOntoDisabledSubflows`, `declineOntoSuspendingSubflowNotice`, `declineOntoRegionSuspendingCall`, `declineOntoSubflowRetriedCallout`, `toggleFlow`*, `toggleFlowSlot`*, `getFlowVersionHistory`*, `rollbackFlow`* | | `engine-run-facet.ts` | 1084 | 8 | 35 | `getFlowBodyChecksum`*, `execute`*, `failRunBeforeFirstNode`, `executeKey`, `runRegion`*, `retryExecution`, `recordLog`, `compactStepsForHistory` | | `engine-resume-facet.ts` | 676 | 16 | 20 | `persistSuspendedRun`, `claimAdvance`, `resolveSuspendedNodeType`, `resolveDeclaredResumeAuthority`, `resolveSuspensionChainForCancel`, `hasSuspendedRun`*, `unresumableSuspensionCause`*, `recoverStoredFlow`, `heldFlowVersion`, `suspendedMapParentOf`*, `suspensionOf`*, `refuseInvalidScreenInput`, `buildSubflowResumeSignal`, `bubbleToParent`, `refuseRestore`, `getSuspendedScreen`* | | `engine-facet-hosts.ts` | 61 | | | the `FacetHost` holder and the eight host instances | The cut: **run** (`getFlowBodyChecksum` with the run checksum from objectstack-ai#38825, `execute`, `executeKey`, `runRegion`, `retryExecution`, the run log), **resume** (suspension persistence and claims, resume authority, the suspension chain, screen input, bubbling to the parent, restore refusals), **registration** (`registerFlow`, judging, withdrawing, refusals, shadowing, reading flows back, the registration-time checks), plus **flow slots**, **dispatch**, **extensions** (triggers, connectors, providers, resolvers, the node-type vocabulary), **connector doors** and **enablement** (subflow guards, toggles, version history, rollback). `getRunFlowChecksum` was already a one-call delegation to `run-flow-checksum.ts` and stays as it was. **Stay on the class.** All fields; the 127 members that were already delegations at the base (the objectstack-ai#25222 per-call host stubs and plain forwards: the facade gate accepts them as they are, and converting them is not part of this card per the ruling); and seven members with `exceptions` rows (card objectstack-ai#38667), each with its reason in the registry: - `constructor`: state-owning, it writes the engine's fields from its arguments. - `flowSlots`, `flowLedgerDisabled`, `flowCallKey`: fields whose initializers hold arrows over the engine's own state; they run at construction, or are the value itself. - `resolveCanonicalDescriptor`, `resolveResumeAuthority`, `walkSuspensionChain`: their bodies read private statics of the class (`MAX_ALIAS_HOPS`, `RESUME_AUTHORITY_WHEN_UNDECLARED`, `MAX_SUSPENSION_CHAIN_DEPTH`, `LINKED_RUN_PREFIXES`), which a module outside the class cannot read. ### The facade gate (ask 3) `scripts/facade-delegation-registry.json` gains a `facades` row for `AutomationEngine` (card objectstack-ai#38667), a `ceilings` row for `engine.ts` (`baseLines` 7735 at `baseCommit` 53e745f, `maxLines` 7835 = `CEILING_MARGIN` 100, ruling 6897467376) and the seven `exceptions` rows above. The gate's self-test holds `DECLARED_WATCH_HINTS` equal to the registry's facade files, so `scripts/check-facade-delegation-only.mjs` gains the one path string; nothing else in the gate changes. ### Gate citations of the moved code, edited outside the package (declared) - `scripts/facade-delegation-registry.json`: the rows above. - `scripts/check-facade-delegation-only.mjs`: one `DECLARED_WATCH_HINTS` string. - `scripts/tenant-audit-census.mjs`: 14 `UNTYPED_RECEIVERS` rows (`engine: false`), one per facet file and receiver: the engine's own in-memory `Map`/`Set` fields a facet body calls `.delete(...)` on. Inside the class the census read the field's type; through `AutomationEngine['x']` on the host it cannot. - `docs/audits/2026-08-tenant-audit-write-call-sites.counts/services/service-automation.md`: the shard regenerated by `node scripts/tenant-audit-census.mjs --write`. Two of those deletes, `this.flowRefusals.delete(name)` and `this.sharedSlotTriggerWarned.delete(name)` in `engine-registration-facet.ts`, are now placed as engine writes by the census's `name: string` parameter rule (they are in-memory map deletes, not data-engine writes), so the shard counts 42 write sites where it counted 40. A precision limit of the census through the host, noted here, not worked around: the bodies are moved unedited. - `packages/spec/liveness/flow.json` and `connector.json`: 10 citations re-pointed to the module that now holds the body they name (`engine-run-facet.ts#retryExecution` and the retry-backoff keys; `engine-extensions-facet.ts#getConnectorDescriptors`); no verdict changes. The ledger ships in `@objectstack/spec`, so the changeset names that package with a `patch` too. ### Net growth past a pure move (package source: 9,813 lines in `engine.ts` before; 7,735 + 4,659 in the facets + 61 in the hosts module after, +2,642) - `engine.ts` (`git diff --numstat`: +469 -2,547): 145 one-line forwarding calls; the static host block (266 lines); a 12-line import block for the facets and hosts; the rest are stub signatures re-spelled (`async` dropped so each stub returns the facet's own promise; `registrationChecks` and `validateFlowExpressions` take their destructured option bag as `options` and hand it on). Import specifiers only the moved bodies read are pruned. - Each facet: the moved text (the base member from its signature, or its docblock when private, to its closing brace) plus what is new: header, imports, host interface, class wrapper, a one-line docblock pointing each public member's body at the class's docblock, and a `this:` line where the parameter list is multi-line. The signatures exist on both sides by design (the class keeps the contract). | Facet | Lines | Moved base text | New | Public pointers | `this` lines | |---|---|---|---|---|---| | `engine-dispatch-facet.ts` | 157 | 88 | 69 | 2 | 0 | | `engine-extensions-facet.ts` | 686 | 528 | 158 | 18 | 2 | | `engine-flow-slots-facet.ts` | 814 | 630 | 184 | 16 | 2 | | `engine-registration-facet.ts` | 585 | 426 | 159 | 15 | 2 | | `engine-connector-doors-facet.ts` | 247 | 135 | 112 | 14 | 0 | | `engine-enablement-facet.ts` | 410 | 318 | 92 | 4 | 0 | | `engine-run-facet.ts` | 1084 | 968 | 116 | 3 | 3 | | `engine-resume-facet.ts` | 676 | 551 | 125 | 5 | 5 | - `engine-facet-hosts.ts`: 61 lines, new. - No type is re-declared, no name changes, no body is edited. ## Tests No test file changed. <details><summary>service-automation typecheck and suite at 91b6bff: 301 files, 4,468 tests pass</summary> Dependency closure built (`os-verify-lock.sh -c "pnpm --filter '@objectstack/service-automation^...' build --concurrency=2"`, VERDICT command-exit 0); `pnpm --filter @objectstack/service-automation typecheck` (tsc plus `check:test-typecheck`) VERDICT command-exit 0; `pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2`: `Test Files 301 passed (301)`, `Tests 4468 passed (4468)`, VERDICT command-exit 0. The same 301 files and 4,468 tests as `main`. Taken at 91b6bff, whose package source is the head's: the head's one later commit changes only the registry's `baseCommit`. </details> <details><summary>Move verifier: 145 facet methods identical to the base member</summary> A throwaway verifier (not committed) parses `engine.ts` at main (f3f3265) and every facet module, and compares each facet method with the base member of the same name: body text, parameters (the added `this` aside), return type, type parameters, `async`, and for a private member its docblock. `145 facet methods: 145 identical to the base member (body, parameters, return type, type parameters, async; a private member's docblock), 0 problem(s)`. Negative control: one token changed in `engine-run-facet.ts` reds `getFlowBodyChecksum: body`. </details> <details><summary>Published declaration, built at main (f3f3265) and at the head</summary> `dist/index.d.ts` (and `dist/index.d.cts`, identical to it in both builds): 156 top-level declarations before and after, none added or dropped, the export list equal as a set (130 names), each module's import specifiers equal as sets. 152 declarations byte-identical, **`AutomationEngine` among them**. The other 4 (`SysAutomationRun`, `SysSyncRun`, `SysFlowDispatch`, `SysFlowCredential`, Zod-inferred object shapes) are equal once the order the printer lists a string-literal union's members in is set aside (`"code" | "secret" | "user" | "record"` vs `"user" | "secret" | "record" | "code"`: the same members). Positive controls on copies of the head build: renaming one `AutomationEngine` member, and changing `getFlowBodyChecksum(flow: unknown)` to `(flow: string)`, each red `AutomationEngine`. </details> <details><summary>Facade gate</summary> `node scripts/check-facade-delegation-only.mjs`: exit 0, `AutomationEngine: 351 members — 273 delegations, 71 fields, 7 named exception(s) (objectstack-ai#38667)`, `engine.ts: 7735 lines, ceiling 7835 (100 left; ruling 6897467376)`, `8 facade class(es) in 6 file(s) hold delegations only, 28 named exception(s)`. `--self-test`: 44 cases pass. </details> <details><summary>Derived gate families at 8b19bf8</summary> `node scripts/pm/dispatch-gates.mjs --commands` (no paths; derived from the tree of objectstack-ai/objectstack at 8b19bf8) named 100 commands; all 100 were run there, each exit code captured before any pipe, and `--ran` reconciled the record: `100 derived famil(ies) accounted for — 98 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)`. Among the 98 at exit 0: `check:facade-delegation-only` and the gate's `--self-test`, `check-tenant-audit-census` and its self-test (with the 14 rows and the regenerated shard), `pnpm --filter @objectstack/spec run check:liveness` (red before the 10 citations were re-pointed, green after), `check:platform-checklist`, `check:adr-anchors`, `check:system-context-census`, `check:dispatcher-error-vocabulary`, `check:pm-dispatch-gates`, `check-plugin-teardown-shape` and its self-test, and the changeset gates. NOT MEASURED (each exited 3, prerequisite not met: they read the built `dist/` of every workspace package, and this container built only this package's dependency closure; CI runs them): - `pnpm check:dual-build-cjs-loads` - `pnpm check:published-readme-exports` Outside the derived set: `node scripts/check-platform-checklist.mjs --changed-from origin/main` exit 0 (15 anchors judged, 0 lost). `scripts/pm/overlap-check.mjs`: merges cleanly into origin/main 3c617a2 (4 commits past this branch's base; they touch spec form/view conversions and the CLI, none of this PR's files). </details> ## Acceptance notes - `engine.ts` is 7,735 lines, not below 2,000: the maintainer ruled the facade form holds and the 2,000-line target is dropped for this card (7305055957). What remains is the public docblocks (the published contract), the 74 documented fields, the stubs, the 127 earlier delegations with their docblocks, and the host block. - `plugin.ts` is untouched: no helper of it moves with the engine's. - The cards that follow on the engine land in the facet of their concern; the ceiling reds a PR that grows `engine.ts` by more than 100 lines. ## Verification Read first, by risk: 1. `engine.ts`, the `static` block at the end of the class: every field a body assigns needs its setter there (five do), or the write lands on nothing; the eight host interfaces type-check that every member a body reads is there. 2. `engine-facet-hosts.ts`: the host is built once per engine and cached, so a body's `this` is the same object across calls. 3. `engine-run-facet.ts` `executeKey`: its one bare `this` (`startConditionHolds.call(this, …)`) now hands the run host, which carries `evaluateCondition`, the one member `startConditionHolds` reads. Two-minute check: `pnpm --filter @objectstack/service-automation test` (expect 301 files, 4,468 tests passing) and `node scripts/check-facade-delegation-only.mjs` (expect the `AutomationEngine` line: 351 members, 273 delegations, 71 fields, 7 named exceptions, and `engine.ts: 7735 lines, ceiling 7835`). --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYka8mG8XtvFU8AvP9X)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2
Fixes #37218
Clause-②: yes (widening: AutomationEngine gains getRunFlowChecksum and getFlowBodyChecksum; RunRecord gains optional flowChecksum; the exported ApprovalResumeSurface drops the optional getFlowVersionHistory and gains optional getRunFlowChecksum and getFlowBodyChecksum)
Metadata-protocol: none
维护者速读
What changes
A decided request's
flow_route.outcome.ended("The approval ended here") is served only when the run ran the flow body armed now. That proof used to read this process's registration history (newest registration, registered before the run started), so every restart and every re-registration of the flow dropped the line, and two narrow cases (a rollback undone after the run started; a replica that registered an edit before another replica started the run on the older body) served it for a body the run did not run.The witness is now the body's content:
$flowChecksum,run-flow-checksum.ts), written where the run starts beside$rootRunand carried through every pause and resume. The terminal record carries it (RunRecord.flowChecksum), and thesys_automation_runterminal row now writesflow_checksumon every run that paused (it was NULL on every finished run). A strand's row keeps its snapshot's pin first, as before. A run whose pinned body could no longer be found, and that resumed on another body, records none. Two reads:AutomationEngine.getRunFlowChecksum(runId)(memory, terminal row, paused row, ingetRun's order) andAutomationEngine.getFlowBodyChecksum(flow).ranArmedBodydelegates to the newrun-body-witness.ts: the run's recorded checksum equals the armed body's, else "not known". It no longer readsgetFlowVersionHistory. The in-memory registration-time check is dropped rather than kept as a fast path: its only extra answers are the N7 cases, which it gets wrong.endedsentence onApprovalRequestRow.flow_route.outcomesays this (doc text only).created_at: a pin shows the sibling case unreachable (an approval in aparallelbranch, aloopbody or atry_catchbody is refused at parse; asubflowormapchild files its requests under its own run id), and theattachFlowRoutedocblock says so.Why the producer is in service-automation, not a read-side accessor only: measured on d97aaae, the terminal row of a run that paused and then finished wrote
flow_checksum = NULL(serializeConsumedSuspension(undefined)), so no durable identity of a finished run existed to read.Tests
packages/plugins/plugin-approvals/src/flow-route.integration.test.ts, new top-level describe over a shared durable store: restart and same-content re-registration keepended: true; rollback-undone and two-replica cases serve noended; a control for two replicas holding the same body serves it.packages/plugins/plugin-approvals/src/approval-route.test.ts: the N2 sibling pin, with a green control.packages/services/service-automation/src/flow-version-pinning.test.ts: terminal record carries the run's body checksum; a restart reads it back; resumed after an edit names the started body; a lost pinned body records none; a run parked before the stamp gets its pin; a context carrying another run's stamp is not this run's identity.packages/services/service-automation/src/suspended-run-store.test.ts: the object store writes, clears and reads backflow_checksumon terminal rows, and a strand keeps its snapshot's pin.Ablation (reverted in the tree only, then restored from HEAD): the plugin's
approval-service.tsat the base turns the 4 new plugin pins red (restart, re-registration, rollback undone, two replicas);run-history.tsat the base turns 5 of the engine pins red.Acceptance notes
ended(they already lost it at the restart an upgrade makes). A run paused before the release and finished after gets the pin its suspension recorded.endedis unaffected.approval-service.ts#ranArmedBody("cannot always prove which flow body a run ran ... after an edit of the flow, or the registration a restart makes") is now partly stale: a restart no longer defeats the proof. The declaration is kept so the anchor resolves; the ADR text is left for its owner.AutomationEngine(getRunFlowChecksum,getFlowBodyChecksum) and an optionalRunRecord.flowChecksum. By the service-automation: a suspended run resumes on the flow version it started on, not on the definition registered under its name #28405 precedent that readsyes (widening); the claim'snois copied as dispatched and flagged in the report.endedsentence inpackages/spec/src/contracts/approval-service.ts.Read first (by risk):
packages/services/service-automation/src/run-flow-checksum.ts: the stamp rules (own run only,nullnever re-derived, unrecovered resume clears).packages/services/service-automation/src/suspended-run-store.tswriteTerminal:flow_checksumnow written on every terminal row, snapshot pin first.packages/services/service-automation/src/run-resume.tsat the segment context:resumeRunFlowChecksum.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run src/flow-route.integration.test.tsshows the describe "the approval-ended witness is the content of the body the run ran" with 5 passing tests.Verification
All readings on head b21c5e1 (after merging origin/main 440574f once).
Builds and typecheck
pnpm --filter '@objectstack/plugin-approvals...' build --concurrency=2under the verify lock: VERDICT command-exit 0.pnpm --filter @objectstack/spec check:generated: "All 14 generated artifacts are up to date".pnpm --filter @objectstack/service-automation typecheckandpnpm --filter @objectstack/plugin-approvals typecheck: VERDICT command-exit 0, both test layers OK.Tests
@objectstack/plugin-approvalsvitest: Test Files 142 passed (142), Tests 2255 passed (2255).@objectstack/service-automationvitest: Test Files 301 passed (301), Tests 4467 passed (4467).Derived gates
dispatch-gates --ran: 99 derived, 99 run, reconciled.check:dual-build-cjs-loadsandcheck:i18n(exit 3, PREREQUISITE NOT MET: need the full build),check:query-options-erasureandcheck:type-check-debt(timed out at 200 s on the shared box).check:adr-symbol-anchors,check:durability-log-level,check:startup-registry-verdict,check:nul-bytes,check:issue-citations,check:doc-authoring, the three changeset gates,check:closing-keyword-parity,check:cross-package-test-inputs,check:test-source-alias,check:engine-double-contract, all exit 0;check-platform-checklist --changed-from origin/main: OK, 44 anchors judged, 0 lost.node scripts/pm/overlap-check.mjs: VERDICT clean (origin/main and docs(spec): screen-input refusal fields carry one entry per finding #38814 merge cleanly).Generated by Claude Code