Repository navigation
fix(spec)!: refuse a flow node that takes a branch which parks the run before its other out-edges - #38970
Conversation
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
… controls (#38875) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…ial pause refusal (#38875) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 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 fded2365c77f0b8859493d81e934803a580b5fd8 && git checkout fded2365c77f0b8859493d81e934803a580b5fd8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 776dddf570443c8760c263fe569302a793f802b4 ff5ffa51adb35b4337c47017dfa0e34cb868abf5 && git checkout -B drift-repro 776dddf570443c8760c263fe569302a793f802b4 && git merge --no-ff ff5ffa51adb35b4337c47017dfa0e34cb868abf5
node scripts/docs-audit/affected-docs.mjs --json 776dddf570443c8760c263fe569302a793f802b4
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Full review of the head. Base ① Derived judgmentsRead against What holds:
What does not hold:
Named, not findings against this diff:
② Semver level
③ Boundary flags
④ Design judgment
Findings:
Nits (none moves the head by itself; N6 to N8 are prose faces):
Implemented-by: VERDICT: PASS |
…e claims it; pin every pass clause (#38875) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…, and correct the fan-out note and the isDefault paragraph (#38875) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…ed in beforeAll (#38976) 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 of ① Derived judgmentsRead against
② Semver levelUnchanged by the delta and still correct: ③ Boundary flags
④ Design judgment
Findings:
Nits (none moves the head by itself; N12 is a prose face):
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #38970 (#38875, #38976) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 维护者速读
Head-sha: |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Queue kick, recorded · 2026-12-01T23:37Z · PR #38970 dequeued ( Signature: only the Governed Surface Guard (run 46767419307) failed: "#38970 — declares a narrowing and is NOT cleared: no authorized APPROVED review is on record (authorized: os-zhuang), and no authorized account enqueued it". Lint & Type Check, PR-Body Guards and Spec Liveness passed in the same group. The enqueue at 2026-12-01T23:11Z was by Remedy unchanged from the hand-off 7320597836: an APPROVED review by @os-zhuang at head |
Fixes #38875
Claims: #38875 7312510992. The #38976 boot fix in this diff is also landing on its own (split at the filer's request 7323909818); this PR merges main after it.
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no published skill teaches conditioned out-edges of one node to a pausing step, nor an inclusive decision ahead of one (
git grepoverskills/at 6fcf88d: no conditioned-edge,mode: 'inclusive'or durable-pause branching text); the refusal's own message carries the prescription at every door, andcontent/docs/automation/flows.mdxteaches it here维护者速读
What changes
A flow in which one node takes an out-edge whose branch reaches a node that parks the run, BEFORE another out-edge of the same traversal, 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. It is the sequential twin of the fan-out rule PR #38871 landed (two pauses on concurrent branches), by the same precedent and the same card invariant: no branch whose condition holds is silently dropped. The engine is not changed; it is not made to come back for the remaining edges after a resume.The mechanism, read from
traverseNext(packages/services/service-automation/src/dag-traversal.ts, unchanged) and measured below: within one traversal a node takes its conditioned out-edges one after another in declaration order (every one whose condition holds, except on adecisionwithoutmode: 'inclusive', which takes only the first), then itsisDefaultedges when no condition held, then its unconditional edges together; each is awaited before the next. A pause throws a suspend signal that unwinds the whole traversal, and a resumed run continues from the node that parked, never back at the node. So every edge the node would have taken after a branch that parks is never taken, and nothing reports it.packages/spec/src/automation/flow-concurrent-pause.ts:sequentialPauseRefusals(flow, FLOW_PAUSE_CAPABLE_NODE_TYPES), besideconcurrentPauseRefusals, sharing its graph reader (nowpauseGraph, the node/edge views and the "any path" pause walk, factored out unchanged) and its pause-type population. Not exported from any entry point (api-surface unchanged).labelfor anapproval/approval_reviseand adecisionthat declaresconfig.conditions, plus the whole set for such a decision whose no-match pick no edge claims.decisionthat declaresconfig.conditions, a run matching none of them picksdefault; the passes model what claims it, astraverseNextdoes: edges labelleddefault(a label pass already); else EVERYisDefaultout-edge whatever its label, as one pass (added in patch round 1); else nothing, and then the whole set. A literaltruecondition makes the pick unreachable, and adds neither.decision) and every unconditional edge, when X is conditioned (an edge carrying bothconditionandisDefaultis conditioned, as the engine buckets it); the laterisDefaultedges and every unconditional edge, when X is anisDefaultedge. Conditioned and default edges never run in one pass together.edges.N), naming the node, the pausing node(s) and every edge left untaken, with the prescription: make the branch that parks the last one the node takes (declared after its conditioned siblings, with no unconditional sibling beside it), or chain the steps onto one branch; where only one branch should run, route them through adecision(on an inclusivedecision, deletemode: 'inclusive'; on adecisionthat already takes only the first true edge, mark the unconditional otherwise-branchisDefault: trueand keep oneisDefaultedge per node). Conditions are judged as if they may all hold.packages/spec/src/automation/flow.zod.ts: the call, after the fan-out rule.packages/spec/src/migrations/entries/semantic/19.flow-sequential-branch-durable-pause-refused.ts: the ADR-0087 D3 semantic entry (structured TODO: whether the author meant every branch or one is not recorded). The changeset carriesadr-0087: registered flow-sequential-branch-durable-pause-refused.content/docs/automation/flows.mdx, under "Parallel approvals": the sentence that listed "conditioned edges out of one node" as still accepted is corrected, and a paragraph teaches what is refused (all four members), why, what to write instead, and what stays accepted. Under "Branching", the paragraph that said droppingisDefaultruns the sibling "in parallel withabort" now says what happens: the sibling runs after the conditioned edges, and withabortascreenthe run parks there, the sibling is never taken, and the schema refuses that spelling..changeset/38838-fanout-pause-refusal.mdline 16: DELIBERATE CORRECTION of a pending release note (see Acceptance notes).packages/plugins/plugin-approvals/src/flow-route.integration.test.ts: the approvals: a node fanning out to two approval steps opens two pending requests in one run, and the second has no suspension, so deciding it never moves the run #38838 conditional fan-out fixture now routes through adecision(its two edge conditions out ofstartare this card's refused shape); the reproduction is pinned refused at the metadata door, and the prescribed shape is pinned at run level (see Tests). Both publish-refusal describes (approvals: a node fanning out to two approval steps opens two pending requests in one run, and the second has no suspension, so deciding it never moves the run #38838's and this one) now boot ONE kernel inbeforeAll(boot, 30_000)and shut it down inafterAll, instead of a coldkernel.bootstrap()inside each case (plugin-approvals flow-route test: the first #38838 case times out at 5 s on loaded CI shards (cold kernel boot) #38976: the first case timed out at vitest's 5 s default on loaded CI shards). The cases share it safely: each saves under its own flow name and reads back only that name, the refusals write nothing, and the one write per describe (the control's publish) is a row no other case reads.Measured shapes (real
AutomationEngine+ realApprovalService, better-sqlite3, on base8338d07029with the rule's population emptied, every conditiontrueunless named)Each run: execute, read pending requests, approve each pending request in turn, read the run's final status and its non-skipped steps.
x1is anassignmentnode unless it is adecision;s_syncanassignmentto its ownend.x1, in declaration order)[true]→a_review,[true]→b_review(the card)a_review); after its decision the run completes;b_reviewnever ran[true]→a_review,[true]→s_synca_review;s_syncnever ran[true]→s_sync,[true]→a_review(pause last)s_syncran, thena_reviewparked; completesdecisionwithmode: 'inclusive's_syncnever randecision(nomode)a_reviewonly, by design (first match)[false]→s_sync,isDefault→a_reviews_syncskipped by its condition[true]→a_review, unconditional →s_syncs_syncnever rans_syncdeclared FIRST,[true]→a_reviews_syncnever ran (the unconditional bucket runs last)[false]→s_x,isDefault→a_review, unconditional →s_syncs_syncnever ran[true]→s1→a_review(two hops),[true]→s_syncs_syncnever randecision:[true]→a_review, unconditional →s_syncs_syncnever ran[true]→subflowwhose child parks on an approval,[true]→s_syncs_syncnever ransubflow/mapare not judged by type); run-time only, carried by #38876After the rule, the same harness: a, b, d, g, g2, h, i, k refused at
registerFlow; c, e, f, j registered and ran as above.Patch round 1, the label-routed
decision's no-match pick (x1adecisionwithconfig.conditions: [{ label: 'hi', expression: 'record.amount > 1000' }], an edge labelledhito a synchronous step, record amount 100 so nothing matches; measured at head 6fcf88d, where the rule accepted every row, then again after the change):isDefaultedges ofx1, in declaration orderlabel: 'x'→a_review, unlabelled →s_synca_reviewparked, the run completed after its decision,s_syncnever ranlabel: 'x'→a_review,label: 'y'→s_syncs_syncnever rans_sync,label: 'x'→a_review(parking one last)s_syncran, thena_reviewparked; completesisDefaultedge,label: 'x'→a_reviewTests
packages/spec/src/automation/flow-concurrent-pause.test.ts(54 cases, 27 new, throughFlowSchema.safeParse): new describe "a branch that parks the run, taken before its siblings, is refused" — the card shape with pathedges.1, the lead sentence, the resume sentence and the prescription, and the fan-out sentence not fired; b; i; the first branch reaching each ofscreen/wait/approval; d with themode: 'inclusive'prescription; mutually exclusive conditions refused; g and g2 (anchor moves with declaration order); k; h; three conditioned branches, one refusal at the first that parks. New describe of controls: c; e (nomodeandmode: 'exclusive');isDefaultbeside conditioned ones; afaultedge; an approval's guardedapprove/rejectedges each to a pause; thesubflowboundary; the population is the caller's; malformed members skipped. Shape k also asserts the exclusive-decision prescription (mark the otherwise-branchisDefault: true; never "route them through adecision"). Patch round 1 adds: anisDefaultedge that parks before a laterisDefaultedge of a plain node; an edge carrying bothconditionandisDefaulttaken with the conditioned ones; and a describe "a label-routeddecision: its no-match pick is judged as the engine claims it" — S1 and S1b refused, S1c and S1d accepted, a decision with no fallback edge whose guardedabranch parks beside abedge refused (only the whole-set pass meets them), one refusal when the same edge is first to park in its label pass and the whole set, and a control: branches under different labels with a claimed fallback parse. The approvals: a node fanning out to two approval steps opens two pending requests in one run, and the second has no suspension, so deciding it never moves the run #38838 controls "a conditional fan-out" and S17 (isDefaultbeside an unconditional sibling) now say that the fan-out rule stays silent on them and the sequential rule refuses them, pinned in the new describes.packages/plugins/plugin-approvals/src/flow-route.integration.test.ts(29 cases, 5 new; real kernel, ObjectQL, metadata protocol, automation engine, approvals plugin): new top-level describe[#38875] a branch that parks the run, taken before a sibling, is refused at publish— active save →{ code: 'INVALID_METADATA', status: 422 }naming the node, the parking branch and the untaken edge, no row; draft save → the same envelope, no row;registerFlowthrows the same lead; CONTROL: the pause-last shape publishes. In the witness describe, a run-level CONTROL: the pause-last shape runss_sync, parks ata_review, and its decision completes the run.Test and ablation readings (head 6fcf88d)
src/automation/flow-concurrent-pause.test.tsTests 54 passed (54);@objectstack/speclocal project (vitest run --project local, whatpnpm testruns; at 3578d2a, the spec sources are unchanged since): Test Files 919 passed, Tests 29073 passed, 1 todo;@objectstack/plugin-approvalsfull (at 3578d2a): 142 files, 2265 passed, andflow-route.integration.test.tsat ff5ffa5 29 passed; spec and plugin-approvals typecheck exit 0.scripts/ablation-replace.mjsonflow-concurrent-pause.tsagainst the spec file (it importssrc), landed and restored (blob == HEAD bb1506e770): the whole-set pass removed (passes.push(taken)) → 1 failed / 53 passed; a default edge not awaited before later default edges (defaults.slice(i + 1)dropped) → 3 failed / 51; theisDefault-claim pass emptied → 2 failed / 52; the dedupe across passes disabled → 1 failed / 53; adecisionnever read as a label picker → 10 failed / 44; an edge with bothconditionandisDefaultleft out of the conditioned bucket → 1 failed / 53.beforeAll) — approvals: a node fanning out to two approval steps opens two pending requests in one run, and the second has no suspension, so deciding it never moves the run #38838: 16, 6, 4, 119 ms; this card's: 6, 6, 1, 47 ms. The boot now runs in the hook, under its own 30 s budget, not in the first case's 5 s.pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/automation/flow-concurrent-pause.test.ts(head 6fcf88d): Tests 46 passed (46).pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2(head 6fcf88d): Test Files 142 passed (142), Tests 2265 passed (2265).pnpm --filter @objectstack/spec typecheck && pnpm --filter @objectstack/plugin-approvals typecheck: exit 0 (test layer: 8 files / 321 errors / 27 pinned signatures held in the ledger, unchanged).condition/isDefault(helper-built fixtures the literal scan cannot read), all green: service-automation 28 files, 698 tests; lint 11 files, 1646; metadata-protocol 5 files, 366; objectql 4 files, 51; spec 13 files incl.src/migrations, 1333; clitest/migrate-meta-engine-guidance.test.ts, 3.repoproject too. Patch round 1 ran thelocalproject, which is whatpnpm testruns (above);test:repois CI's.scripts/ablation-replace.mjsonflow-concurrent-pause.ts(the guard that skips an edge with nothing after it made to skip every edge), spec rebuilt,ablation-dist-preflightmarker present in 2 built files: spec file 13 failed / 33 passed (every refusal and the boundary count red, every control green); integration file 3 failed / 26 passed (active save, draft save and registration red; both controls green). Restore: blob == HEADbefa0d8869,git diff HEADempty, whole tree clean, rebuilt, preflight--absentexit 0 over 610 built files, both files green again (46/46, 29/29).Acceptance notes
examples/*/objectstack.config.ts; showcase through its flows index, its stack import needs an unbuilt connector): 38 flows, 12 with a pausing node, 0 refused. A literal scan (TypeScript AST) of every tracked TS/TSX/MTS/MD/MDX file underpackages,examples,ui,content/docs,skills,docsandappsthat mentionsedges: 2342nodes+edgesliterals, 2208 with both as arrays; 1 hit outside the positive control:packages/lint/src/lint-flow-patterns.test.ts:987(guardFlow, an exclusivedecisionwith a conditioned edge to ascreenbeside an unconditional sibling, shape k), a raw lint fixture built to drawflow-decision-unconditional-branchand judged by the linter only, never parsed throughFlowSchema(the lint suite is green); not an authored flow, left untouched. Positive control: the scanner refuses the card's shape. Helper-built fixtures are covered by the suites listed under Tests.decisionthat makes the choice explicit, and the pause-last ordering. Narrower alternative (refuse only literaltrueconditions) would leave shape a's silent drop possible for any real condition; raised for the contract review.isDefaultbranch that parks (g, g2, h, k measured), including on an exclusivedecision. Those are refused too, since the route says to refuse exactly the shapes that lose and the invariant is that no branch whose condition holds is dropped (an unconditional edge always holds). This turns fix(spec)!: refuse two durable pauses on concurrent branches of one flow fan-out #38871's S17 reading (isDefaultbeside an unconditional sibling, "accepted: leaves no orphan request") into a refusal when the default branch parks; the fan-out rule's own S17 control still holds (it asserts that rule stays silent). Raised for the contract review.subflow/mapwhose child pauses on a branch taken before others (shape j, measured: the later sibling dropped), and a plugin-registered pausing type. A run-time refusal would live indag-traversal.ts; it is not built here, and flows: a fan-out to an approval and a subflow whose child pauses loses the parent branch continuation (the subflow branch never resumes) #38876 (a subflow branch's pause loses the rest of the parent traversal) carries it..changeset/38838-fanout-pause-refusal.md(PR fix(spec)!: refuse two durable pauses on concurrent branches of one flow fan-out #38871, not yet released) listed "conditioned out-edges of one node, which run one after another" as still accepted, which this PR makes false. Corrected sentence: "Still accepted: one pausing branch beside branches that never pause, an approval after aparallelregion, an approval'sapprove/rejectedges each to its own step, and the branches of adecisionthat has a fallback edge, each to its own step. Conditioned out-edges of one node run one after another, so they never pause together; a branch among them that parks before another is refused by its sibling rule,flow-sequential-branch-durable-pause-refused."node scripts/check-empty-changeset.mjs --base origin/mainis red on this file by design (exit 1); the seat's record confirms the correction.decisionwhose no-match pick is claimed, an unlabelled edge or one labelled with no declared condition label is never taken, yet forms its own pass and can be refused for a loss the pause does not cause (the linter already reports the edge asflow-decision-unconditional-branch); and a pausing edge already anchored by its label pass ends the whole-set pass without naming the edges only the no-match run leaves untaken.8338d07029;origin/mainis 18 commits ahead of the head at patch round 1. They touchpackages/spec(a record-lock schema, a new step-19 semantic entry, regenerated snapshots) but none of this diff's paths or the engine traversal, so no merge was made.!)..changeset/38838-fanout-pause-refusal.md(one line, added to the surface by the seat for patch round 1);dag-traversal.tsuntouched.Verification
Read first, by risk:
packages/spec/src/automation/flow-concurrent-pause.ts:traversalPassesandawaitedBefore(which edges one traversal awaits before which), thensequentialPauseRefusals.packages/spec/src/automation/flow.zod.ts: the call after the fan-out rule.packages/plugins/plugin-approvals/src/flow-route.integration.test.ts: the new describe at the foot and the reworkedconditionalFanOutfixture.Two-minute check:
pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/automation/flow-concurrent-pause.test.ts, expectedTests 54 passed (54).Local gates (patch round 1, head ff5ffa5)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackre-derived the same 122 families at ff5ffa5; all 122 run there: 121 exit 0, andcheck-empty-changesetexit 1 on the DELIBERATE CORRECTION above (expected; the seat's record confirms it).check:dual-build-cjs-loadsfirst read PREREQUISITE NOT MET (six packages unbuilt in the rebuilt worktree) and was re-run after building them.--ran: 122 derived, 122 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --filter @objectstack/spec check:generated: all 14 generated artifacts up to date.Local gates (head 6fcf88d)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 122 families for this diff; all 122 run, every one exit 0. Eight first runs read PREREQUISITE NOT MET (exit 3: five spec gates on adistolder than the last source edit,check:skill-exampleson an unbuilt client SDK,check:i18non an unbuilt CLI,check:dual-build-cjs-loadson unbuilt packages); two timed out at a 300 s per-gate budget (check-comment-mask-corpus,check:query-options-erasure) andcheck:type-check-debtwas cut off by the batch budget; the CLI vitest family ran separately under the verify lock. Each was re-run after building its prerequisite (spec; the client-react closure; the CLI closure) or with a longer budget, and the recorded exit is that re-run's.--ranreconciliation: 122 derived, 122 run, 0 NOT-MEASURED, 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