Class ScopeGuard

java.lang.Object
ai.redouble.nucleo.guardrails.ScopeGuard

public final class ScopeGuard extends Object
The scope guard of an orchestrator: an immutable bag of bound Scope values. passAll(Scope) runs every member against a candidate - AND-for-applicable emerges from each scope ignoring what it does not recognize, so overlapping members (a subtype axis and its supertype, two independent scopes on one flow) each get their say and any one refusal blocks. merge(ScopeGuard) composes guards by member union, deduplicated by value equality, so re-dispatching the same orchestrator (a doer re-running a step) never grows the guard.

A guard sits as a field on every orchestrator: the authoring surface before dispatch (explicit delegation assigns the parent's guard), sealed at dispatch when the framework captures the effective guard - own field, own Scoped.scope() if the orchestrator is scoped, and the caller's captured guard, merged.

Since:
0.1 (2026-08-18)
Author:
Andrey Santrosyan
  • Constructor Details

    • ScopeGuard

      public ScopeGuard(Scope... scopes)
    • ScopeGuard

      public ScopeGuard(List<Scope> scopes)
  • Method Details

    • getScopes

      public List<Scope> getScopes()
    • merge

      public ScopeGuard merge(ScopeGuard anotherScope)
      Composes this guard with another into a new guard judging by the union of both member sets. Never mutates either side.
    • passAll

      public void passAll(Scope candidate) throws GuardrailException
      Judges a candidate scope value against every member. Composite candidates are flattened so each component is judged by the members that recognize it.
      Throws:
      GuardrailException - the first member's refusal