Skip to content

Gate guard model with halt scopes#28

Merged
santib merged 4 commits intomainfrom
santib/gate-dsl-aggregator
Mar 6, 2026
Merged

Gate guard model with halt scopes#28
santib merged 4 commits intomainfrom
santib/gate-dsl-aggregator

Conversation

@santib
Copy link
Member

@santib santib commented Mar 1, 2026

Summary

  • Gate redesigned as a guard: replaces condition/branch router with check/fallback guard model. Check returns falsy to pass through, or a key to select a fallback branch and halt
  • Halt scopes: Halt now carries a scope (:local default, :global). Local halts are consumed by the immediate parent workflow; global halts propagate to the root
  • Gate DSL: check, fallback, and halt_scope class-level macros. Supports both DSL and constructor-based configuration
  • Sequential/Parallel updated: respect halt scope — local halts are unwrapped, global halts propagate

Test plan

  • Gate: pass-through on falsy check, halt on truthy check
  • Gate: multiple fallbacks selected by key
  • Gate: raises on unregistered fallback key
  • Gate DSL: check/fallback/halt_scope macros
  • Halt: default local scope, global scope, helper methods
  • Sequential: local halt consumed, global halt propagated
  • Sequential: nested workflows — local halt lets outer continue, global halts everything
  • Parallel: local halts unwrapped before aggregation, global halts propagated
  • 73 specs pass, 0 failures
  • Rubocop clean

🤖 Generated with Claude Code

@santib santib force-pushed the santib/agent-step branch from dfef5a9 to 3d5df32 Compare March 1, 2026 21:14
@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/agent-step branch 2 times, most recently from 2df0282 to dbd1e1f Compare March 4, 2026 15:17
Base automatically changed from santib/agent-step to main March 4, 2026 15:18
santib and others added 2 commits March 4, 2026 12:20
Phase 4 of the Mars v2 refactor.

- Gate: add class-level `condition`/`branch` DSL for reusable gates.
  Gate#run now executes the matched branch directly instead of
  returning a Runnable for Sequential to detect
- Aggregator: context-aware — accepts ExecutionContext and passes
  its outputs to the operation
- Sequential: remove is_a?(Runnable) check, now just chains step results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@santib santib force-pushed the santib/gate-dsl-aggregator branch from a27a06c to 51c6542 Compare March 4, 2026 15:34
@santib santib changed the title Gate executes branches directly + class-level DSL Gate guard model with halt scopes Mar 4, 2026
@santib santib requested a review from andresg4 March 4, 2026 17:19
@santib santib merged commit ed501ad into main Mar 6, 2026
1 check passed
@santib santib deleted the santib/gate-dsl-aggregator branch March 6, 2026 18:02
santib added a commit that referenced this pull request Mar 6, 2026
* Gate executes branches directly + class-level DSL

Phase 4 of the Mars v2 refactor.

- Gate: add class-level `condition`/`branch` DSL for reusable gates.
  Gate#run now executes the matched branch directly instead of
  returning a Runnable for Sequential to detect
- Aggregator: context-aware — accepts ExecutionContext and passes
  its outputs to the operation
- Sequential: remove is_a?(Runnable) check, now just chains step results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review comments

* Fix linters

* Change Halt behavior

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants