Repository navigation
fix(spec)!: refuse two durable pauses on concurrent branches of one flow fan-out - #38871
Conversation
…low fan-out (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…r (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
… of the door (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…y and its changeset (WIP) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 10 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 66b0a3454ac4cce0e31da40a9f38979e59ce9c55 && git checkout 66b0a3454ac4cce0e31da40a9f38979e59ce9c55
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b06efa9a97ad0b771856056cc74b22f190633360 ddae2cf6081495018b5d1091cb7b3a3a33cc888f && git checkout -B drift-repro b06efa9a97ad0b771856056cc74b22f190633360 && git merge --no-ff ddae2cf6081495018b5d1091cb7b3a3a33cc888f
node scripts/docs-audit/affected-docs.mjs --json b06efa9a97ad0b771856056cc74b22f190633360
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: ① Derived judgmentsRead against What holds:
What does not hold:
Named, not findings against this diff:
② Semver level
③ Boundary flags
④ Design judgment
Findings:
Implemented-by: VERDICT: FAIL |
…concurrent group; fault and isDefault filters pinned Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
… fallback edge marked 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 review from ① Derived judgments
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgment
No must-fix. Open on this head: S1. Nits (none moves the head by itself):
Implemented-by: VERDICT: PASS |
…ustive and owes no fallback edge Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
… other always-true conditions stay refused 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 review from ① Derived judgments
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgment
No must-fix. No should-fix. Nits (none moves the head by itself):
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #38871 (#38838) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 维护者速读
Head-sha: Queue kick, recorded: the merge-group runs of this PR (groups |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Queue kick, 2026-12-01T11:48Z · PR #38871 dequeued with Signature: workflow Initial judgement: the runner was shut down, not this PR's diff. The three facts:
Action needed: one re-enqueue, as is. This PR declares a narrowing, so the queue guard admits only the maintainer's enqueue; the seat does not re-enqueue it. @os-zhuang — please re-add it to the queue when convenient. |
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2
Fixes #38838
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no published skill teaches a fan-out to pausing steps, nor the region rule's pause population (
git grepoverskills/: no fan-out-to-approval shape, no region-pause text); the refusal's own message carries the prescription at every door, andcontent/docs/automation/flows.mdxteaches it here维护者速读
What changes
A flow whose node fans out over unconditional edges to two or more branches that each reach a node that parks the run is refused by
FlowSchema, so every door that parses a flow refuses it:objectstack validate, the metadata save (draft and active,422 INVALID_METADATA), publish, andregisterFlow. This is the top-level-graph sibling of the region rule (aloop/parallel/try_catchbody may not holdscreen/wait/approval/approval_revise), by the same precedent: a durable pause where the run cannot park. The engine is not changed; it is not made to serialise the branches.packages/spec/src/automation/flow-concurrent-pause.ts(new;flow.zod.tsis over 1,000 lines, so the new rule family lives in a sibling module andflow.zod.tsonly adds the call beside the region rule):concurrentPauseRefusals(flow, FLOW_PAUSE_CAPABLE_NODE_TYPES). Same population as the region rule, no second copy. Not exported from any entry point (api-surface unchanged).traverseNext: out-edges with nocondition, notisDefault, nottype: 'fault'. On anapproval/approval_revisenode and on adecisionthat declaresconfig.conditions, only edges sharing onelabelrun together, so they are grouped by label. One more group for adecisionthat declaresconfig.conditionsand has no out-edge labelleddefaultnor markedisDefault: true: a run matching no condition picksdefault, no edge claims it, andtraverseNextruns every unconditional out-edge together, so that whole set is a group. An EXHAUSTIVE decision adds no such group: one of whoseconfig.conditionshas the expressiontrue(a string whose trimmed text is exactlytrue, the CEL literal the executor evaluates), since a condition then always matches and the no-match pick is unreachable. Any other always-true expression (1 == 1,(true)), or conditions that together cover every record, is still refused: the parse does not evaluate or prove coverage.save-notice-placement.tsalready takes; the walk stops at a branch's first pausing node, and one node reached by two branches counts for both.approvalwith several approver groups andbehavior: 'unanimous'; adecisionwhose fallback edge is markedisDefault: truewhen only one branch should run; and why aparallelregion is no way out. The decision-without-fallback group has its own sentence: "Decisionroutedeclaresconfig.conditionsbut no fallback edge — none of its out-edges is labelleddefaultor markedisDefault: true— and its branches reach nodes that park the run: … Mark the fallback edgeisDefault: true(or label itdefault), so a run that matches no condition takes exactly one branch."packages/spec/src/automation/flow.zod.ts: the call, after the region rule, and one sentence onFLOW_PAUSE_CAPABLE_NODE_TYPESnaming its second reader.packages/spec/src/migrations/entries/semantic/19.flow-concurrent-branch-durable-pause-refused.ts: the ADR-0087 D3 semantic entry (structured TODO; the rewrite is a graph rewrite whose intended shape no artifact records). The changeset carriesadr-0087: registered flow-concurrent-branch-durable-pause-refused.content/docs/automation/flows.mdx, under "Parallel approvals": what is refused, why, what to write instead, what stays accepted, what is not judged.packages/plugins/plugin-approvals/src/flow-route.integration.test.ts: the[N2]measurement pin (which asserted that both requests open) is removed and the shape is now pinned refused at the metadata door (see Tests).Measured shapes (real
AutomationEngine+ realApprovalService, better-sqlite3, on this branch's base13a0d3fedf, before the rule)start→ two approvals over two unconditional edges (the card)pendingrequests, suspension ata_reviewonly; decidingb_review→RESUME_TARGET_LOSTend(either edge order)pendingrequests on the same node, second →RESUME_TARGET_LOSTparallelregion, then an approvaljoin_gateway, then an approvalNo executor registered for node type 'join_gateway'), so no native join existsapprove-labelled edges to two approvalspendingrequests in one runapprove/rejectedges, each to an approvalwaitwait; the approval's decision "resumes" the run from thewaitnodescreenscreenpending, second orphanedcondition, both truepending, second orphaneddecisiondeclaringconfig.conditions(high,low), edges labelledhigh/lowto two pausing nodes, no fallback edge, a run matching neitherdecisionexecutor: both pausing nodes run their on-entry work, one suspension keptisDefault: true)isDefault: true, or labelleddefaulttruecatch-all condition (expression: 'true', or' true '), no fallback edgeaonly, any other atbonly; the unclaimed-branch warning never fires (the lint suite's own correct-shape control,lint-flow-patterns.test.ts~1196-1215)1 == 1or(true)as the catch-allisDefault: true)faultedge beside a success edge to a second pausing nodeisDefaultedge beside an unconditional siblingsubflowwhose child pauses on an approvalpending(roota_review, childc_review), two suspensions (a_review, childc_review); each decision resumes its own run; the parent completes ona_review's decision and its continuation aftersubnever runssubflow/mapare not judged by type, by the region rule's ruling D); no orphan request, a dropped continuation; engine half filed as #38876Tests
packages/spec/src/automation/flow-concurrent-pause.test.ts(new, 27 cases, throughFlowSchema.safeParse): S1, approval besidescreen/wait/approval, S9, S3, S4, S12/S13 refused with path and message; one refusal per group anchored on the second pausing branch; S15 refused with its own sentence (and the plain fan-out sentence not fired), S15c accepted withisDefault: trueand withlabel: 'default'; S18 accepted with'true'and' true '; S18b refused with1 == 1and(true); afaultedge labelleddefaultdoes not claim the no-match pick; controls S2, S10, S3p, S5,decisionbranches, conditional fan-out, S16 (faultbeside success), S17 (isDefaultbeside an unconditional sibling); boundaries:subflownot judged, the population is the caller's, malformed members skipped.packages/plugins/plugin-approvals/src/flow-route.integration.test.ts, new top-level describe[#38838] a fan-out to two approval steps is refused at publish(real kernel, ObjectQL, metadata protocol, automation engine, approvals plugin): active save →{ code: 'INVALID_METADATA', status: 422 }naming the fan-out andb_review, no active row; draft save → the same envelope (measured: the schema half of the door runs on drafts, so this never reaches publish);registerFlowthrows the same lead; CONTROL: the conditional fan-out publishes. A run-level control in the witness describe: the conditional fan-out opens one request and its decision completes the run.[N2]sibling assertion onrouteOutcomekeeps its pin one layer closer to the code:approval-route.test.ts, describerouteOutcome measures "later" from the decision, not the opening.Test and ablation readings (head 9310080)
pnpm --filter @objectstack/spec test: 918 files, 29003 passed, 1 todo.pnpm --filter @objectstack/plugin-approvals test: 143 files, 2264 passed.pnpm --filter @objectstack/service-automation exec vitest run: 301 files, 4468 passed.pnpm --filter @objectstack/spec typecheck && pnpm --filter @objectstack/plugin-approvals typecheck: exit 0.Unfixed direction (the new integration file against a spec
distbuilt from the base): 3 failed (active save succeeded, draft save succeeded, registration succeeded), control green.Ablation via
scripts/ablation-replace.mjsonflow-concurrent-pause.ts(the guard that skips a group with fewer than two pausing branches made to skip every group, by appending|| true), spec rebuilt,ablation-dist-preflightmarker present in 2 built files: spec file 11 failed / 8 passed (every refusal and both boundary counts red, the 8 controls green); integration file 3 failed / 21 passed (the three refusals red, control green). Restore: blob == HEAD95a1b4e711,git diff HEADempty, rebuilt, preflight--absentexit 0, both files green again (19/19, 24/24).Patch round 1 ablations (scripts/ablation-replace.mjs on
flow-concurrent-pause.ts, spec file importssrc, restore blob == HEAD78673f96eaandgit diff HEADempty after each): fault filter removed -> 1 failed (S16) | 22 passed;isDefaultfilter removed -> 1 failed (S17) | 22 passed; the decision fallback group disabled -> 1 failed (S15 refusal) | 22 passed; restored 23/23.Patch round 2 ablation (scripts/ablation-replace.mjs, the exhaustive exemption disabled: blob 5204ea5091 -> ec3c0ef9b2): the two S18 controls red (2 failed | 25 passed); restored blob == HEAD 5204ea5091,
git diff HEADempty, 27/27.Acceptance notes
examples/*/objectstack.config.ts; showcase via its flows index): 38 flows, 12 with a pausing node, 0 refused. A literal scan of 868 TS files underpackages/**andexamples/**(1953nodes+edgesliterals) and 52 docs/skills files (15 code-fence literals): 1 hit outside this PR's own test,packages/lint/src/lint-flow-patterns.test.ts:1148, a deliberately misauthored fixture (an inertdecisionfanning out to twoscreens) for theflow-decision-unconditional-branchlint rule, judged raw by the linter and never parsed throughFlowSchema; not an authored flow, left untouched. Positive control: the scanner refuses the card's shape. Helper-built fixtures the literal scan cannot read are covered by running the suites that hold them: spec, plugin-approvals and service-automation in full, and every test file naming a pausing node type in lint, metadata-protocol, objectql, runtime, rest, client, verify, organizations, trigger-schedule and cli (all green).ui/**included and quoted JSON keys now read: 1152 TS/TSX files, 2320nodes+edgesliterals; 125 md/mdx files, 17 literals): 51decisions declareconfig.conditions; 38 have no fallback edge (35 in test files, 2 in the docstring examples of the conversion entryflow-decision-mode-inclusive-explicit, 1 in aflows.mdxfence whose branches carry edge conditions). Refused by the rule: 3 literals, none a shipped flow, none parsed throughFlowSchemaexcept this PR's own:packages/lint/src/lint-flow-patterns.test.ts:1148(an inertdecisionwith no conditions to twoscreens, a raw lint fixture),ui/packages/app-shell/src/views/studio-design/flowGrouping.test.ts:30(HotCRM'slead_conversionwith its edge conditions stripped for a grouping test, the earlier scan missed it because its keys are quoted), and this PR's malformed-member case. The earlier note'slint-flow-patterns.test.ts:1198reading was wrong: that fixture ends its conditions with a literaltruecatch-all, a correct shape, now accepted (S18). Positive control (S15 shape) refused; negative controls (isDefaultfallback; literaltruecatch-all) accepted.conditionare refused even when the conditions are exclusive, because the parse cannot evaluate them, and S12 showed the same shape breaking when both hold. The prescription names thedecisionthat makes the choice explicit. Narrower alternative (only unconditional paths) would leave S12's orphan request possible; raised for the contract review.subflow/mapon a concurrent branch whose child pauses (S11, measured broken), and a plugin-registered pausing type. An engine-side refusal for S11 would live inservice-automation, outside this PR's surface (held in flight elsewhere); reported to the seat.decision'sdefaultpick (S15, refused), except where a literaltruecondition makes it unreachable (S18, accepted). Not modelled for the other picks, because the metadata door already refuses both shapes they come from: adecisioncondition label no edge carries (flow-branch-label-unmatched) and an approval without exactapprove/rejectedges (flow-approval-decision-unrouted, measured on the first fixture).approval-route.ts(routeOutcomedocblock: "which a flow can declare") andapproval-route.test.ts(pointer to "the fan-out pin in flow-route.integration.test.ts") now describe a shape the schema refuses; both files are outside this PR's surface and are left as they are, reported to the seat.13a0d3fedf;origin/mainis 7 commits ahead, none touching a path of this diff or the engine traversal, so no merge was made.!).Verification
Read first, by risk:
packages/spec/src/automation/flow-concurrent-pause.ts:concurrentGroups(which edges run together) andpausesFrom(what a branch reaches).packages/spec/src/automation/flow.zod.ts: the call after the region rule.packages/plugins/plugin-approvals/src/flow-route.integration.test.ts: the new describe at the foot.Two-minute check:
pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/automation/flow-concurrent-pause.test.ts, expectedTests 27 passed (27).Local gates (head 9310080)
node scripts/pm/dispatch-gates.mjs --commandsderived 122 families for this diff; 121 run, every one exit 0; 1 NOT MEASURED:pnpm check:dual-build-cjs-loads(exit 3, PREREQUISITE NOT MET: it reads every package'sdistand ten packages are unbuilt in this worktree).--ranreconciliation: 122 accounted, 0 unrun.pnpm --filter @objectstack/spec check:generated: all 14 generated artifacts up to date (no generated file changes). Repository-wide scans (pnpm lintand the rest of the CI farm) are CI's.Generated by Claude Code