Skip to content

Rewrite Sequential + Parallel for context flow#29

Merged
santib merged 1 commit intomainfrom
santib/context-flow
Mar 6, 2026
Merged

Rewrite Sequential + Parallel for context flow#29
santib merged 1 commit intomainfrom
santib/context-flow

Conversation

@santib
Copy link
Member

@santib santib commented Mar 1, 2026

Summary

  • Sequential: #run wraps input in ExecutionContext, threads it through steps calling formatter.format_inputstep.runformatter.format_outputcontext.record, with before_run/after_run hooks at each step
  • Parallel: #run forks context per branch (independent current_input, shared global_state), merges children back, passes merged context to aggregator
  • ExecutionContext: #record now symbolizes step names for consistent ctx[:step_name] access
  • Sequential.build DSL: declarative workflow construction via block (step MyStep)
  • Specs fully rewritten with proper Runnable subclasses testing context flow, hooks, and formatters

Phase 5 of the v2 refactor. Based on #28.

Test plan

  • Sequential threads context: step 2 reads step 1's output via context[:step1]
  • Sequential hooks fire in order, formatters transform input/output
  • Sequential accepts existing ExecutionContext (preserves global_state)
  • Parallel branches get independent current_input
  • Parallel branches share global_state
  • Parallel merges child outputs into parent context
  • Sequential.build constructs workflow from block
  • Error propagation preserved in both workflows
  • 70 specs pass, 0 failures
  • Rubocop clean

🤖 Generated with Claude Code

@santib santib force-pushed the santib/gate-dsl-aggregator branch 3 times, most recently from 8def03d to a27a06c Compare March 1, 2026 21:26
@santib santib force-pushed the santib/context-flow branch 2 times, most recently from 68a3b04 to 45d8133 Compare March 1, 2026 21:38
@santib santib force-pushed the santib/gate-dsl-aggregator branch from a27a06c to 51c6542 Compare March 4, 2026 15:34
Base automatically changed from santib/gate-dsl-aggregator to main March 6, 2026 18:02
@santib santib force-pushed the santib/context-flow branch 3 times, most recently from 65b6e43 to 1993d90 Compare March 6, 2026 18:20
@santib santib force-pushed the santib/context-flow branch from 1993d90 to a5c12d5 Compare March 6, 2026 18:37
@santib santib merged commit b824349 into main Mar 6, 2026
1 check failed
@santib santib deleted the santib/context-flow branch March 6, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants