Skip to content

feat(automation): map node — sequential batch approval (ADR-0037 A2) - #1709

Merged
os-zhuang merged 1 commit into
mainfrom
feat-map-node-batch-approval
Jun 11, 2026
Merged

feat(automation): map node — sequential batch approval (ADR-0037 A2)#1709
os-zhuang merged 1 commit into
mainfrom
feat-map-node-batch-approval

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Summary

ADR-0037 Track A2: a map node for sequential batch approval — "sign off every item in a list, one at a time." Unlike loop (synchronous body, cannot pause), each item is a full child run, so the per-item subflow may durably pause on its own approval; the map waits for that item, then moves to the next. The run holds one program counter throughout — no token tree.

As flagged in the revised ADR, A2 is not engine-free (unlike A1). It needs a bounded change in the resume path only — no scheduler, no traverseNext rewrite:

  • resumeInternal: a run paused at a map node (correlation map:<childRunId>) re-enters the node on resume (re-runs executeNode) instead of continuing past it, so the executor records the just-completed item and starts the next. Default path unchanged.
  • bubbleToParent: a map child ($parentMapNode in context) hands its output to the map node + flags completion, vs the subflow 1:1 mapping. Reuses the ADR-0019 linked-runs (feat(automation): nested durable pause — subflow chains (linked runs) #1693); the map: correlation prefix carries re-entry, so no new persisted field.
  • new map builtin executor: collection → per-item subflow, item-as-$record when the item is a record, results collected in order, fail-fast in v1. Concurrent fan-out stays Track B.

Test plan

  • +5 engine unit tests: synchronous map, empty collection, sequential per-item pause with re-entry, fail-fast, cold-boot restart mid-map (two engines, shared store). Full service-automation suite 177 green; tsup build clean; docs build green.
  • Browser E2E (live showcase): showcase_release_signoff triggered with 2 tasks → task 1's approval opens, run paused → approve task 1 → only task 2's approval opens (sequential, one at a time) → approve task 2 → run completed (start → signoffs×3 → notify_done). Distinct record per item, no dedup collision.
  • Showcase: showcase_release_signoffshowcase_one_task_signoff. Docs: "Batch approval — a map node" section.

🤖 Generated with Claude Code

"Sign off every item in a list, one at a time" as a single `map` node. Unlike
`loop` (synchronous body, cannot pause), each item is a full child run, so the
per-item subflow may durably pause on its own approval; the map waits for that
item, then moves to the next — the run holds ONE program counter throughout
(no token tree).
Bounded engine change in the resume path only (no scheduler, no traverseNext
rewrite):
- resumeInternal: a run paused at a `map` node (correlation `map:<childRunId>`)
RE-ENTERS the node on resume (re-runs executeNode) instead of continuing past
it — so the executor records the just-completed item and starts the next. The
default path is unchanged.
- bubbleToParent: a map child (`$parentMapNode` in its context) hands its output
to the map node and flags completion, vs the subflow 1:1 mapping.
- new `map` builtin executor: collection → per-item subflow, item-as-$record
when the item is a record, results collected in order, fail-fast in v1.
Reuses ADR-0019 linked-runs (#1693); correlation `map:` carries re-entry (no
new persisted field).
Tests: +5 engine tests (synchronous map, empty, sequential per-item pause with
re-entry, fail-fast, cold-boot restart mid-map); full suite 177 green. Showcase:
showcase_release_signoff maps over a release's tasks → per-task approval subflow.
Browser-verified live: trigger with 2 tasks → task 1 approval opens, paused →
approve → ONLY task 2's approval opens (sequential) → approve → run completes.
Docs: "Batch approval — a map node" section. Concurrent fan-out stays Track B.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 11, 2026 4:43am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests size/m labels Jun 11, 2026
@os-zhuang
os-zhuang merged commit 5c439e9 into mainJun 11, 2026
12 checks passed
@os-zhuang
os-zhuang deleted the feat-map-node-batch-approval branch June 11, 2026 04:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mtests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@os-zhuang