Skip to content

Add terminal signal dependency states (CANCELED, FAILED) behind a flag - #223

Merged
derek-miller merged 1 commit into
Netflix:mainfrom
derek-miller:derek_miller/signal-terminal-states
Jun 26, 2026
Merged

Add terminal signal dependency states (CANCELED, FAILED) behind a flag#223
derek-miller merged 1 commit into
Netflix:mainfrom
derek-miller:derek_miller/signal-terminal-states

Conversation

@derek-miller

@derek-miller derek-miller commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Signal dependencies only have MATCHED/PENDING/SKIPPED. A dependency that never matched stays PENDING forever once its owning step goes terminal, so it looks like it might still match. A dependency that fails to resolve has no way to carry the error. This PR adds two terminal states to StepDependencyMatchStatus, gated behind a flag.

CANCELED: the owning step reached a terminal state while the dependency was still pending. A new SignalHandler.onTermination(...) default hook, called from MaestroTask's termination path, lets a handler finalize pending dependencies. MaestroSignalHandler marks them CANCELED.

FAILED: resolving the dependency raised a non-retryable error, carried in a new SignalDependency.details (Details) and set via SignalDependency.markFailed(Details). The built-in matching only finds a signal (MATCHED) or does not find one yet (PENDING), so core has no path that produces FAILED today. It is there for handlers that can detect a non-retryable resolution failure, such as a handler that resolves dependencies against an external service and gets back a non-retryable error.

Backwards compatibility

Gated by maestro.signal.terminal-states-enabled (default false). With it off, the engine emits only MATCHED/PENDING/SKIPPED and behavior is unchanged, so existing deployments need to do nothing. details is @JsonInclude(NON_EMPTY), so it never appears.

Enabling the flag is optional. Since deserialization stays strict, anyone who turns it on should first make sure their readers and consumers understand the new states.

Testing

  • SignalDependenciesTest: markPendingAsCanceled flips only PENDING and leaves MATCHED/SKIPPED/FAILED untouched, plus a no-change case and markFailed with details.
  • MaestroSignalHandlerTest: onTermination marks CANCELED when enabled and is a no-op when disabled.
  • Affected modules compile and spotless is clean.

@derek-miller
derek-miller force-pushed the derek_miller/signal-terminal-states branch 2 times, most recently from 86771ab to 4e32790 Compare June 22, 2026 18:57
@derek-miller
derek-miller marked this pull request as ready for review June 24, 2026 13:36
Signal dependencies only had MATCHED/PENDING/SKIPPED, so a dependency that
never matched stayed PENDING forever once its owning step went terminal, and a
dependency that could not be resolved had no way to surface the error.

Add two terminal states to StepDependencyMatchStatus:
- CANCELED: the owning step reached a terminal state while the dependency was
  still pending. Set by SignalHandler.onTermination (a new default no-op hook
  the engine calls from MaestroTask termination); MaestroSignalHandler marks
  still-pending dependencies CANCELED.
- FAILED: resolving the dependency raised a non-retryable error, carried in the
  dependency details. Set via SignalDependency.markFailed(Details). The
  built-in matching only finds a signal or leaves it pending, so core never
  produces FAILED; it is the mechanism for handlers that can detect a
  non-retryable resolution failure.

Gated by maestro.signal.terminal-states-enabled (default false): with it off,
behavior is unchanged and only MATCHED/PENDING/SKIPPED are ever emitted, so
existing readers are unaffected until a fleet opts in.
@derek-miller
derek-miller force-pushed the derek_miller/signal-terminal-states branch from 4e32790 to 67e5743 Compare June 24, 2026 22:44
@derek-miller derek-miller changed the title Add terminal signal dependency states (UNMATCHED, FAILED) behind a flag Add terminal signal dependency states (CANCELED, FAILED) behind a flag Jun 24, 2026

@praneethy91 praneethy91 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well tested and focused change. LGTM as it is backwards compatible

@derek-miller
derek-miller merged commit a5e788b into Netflix:main Jun 26, 2026
1 check passed
@derek-miller
derek-miller deleted the derek_miller/signal-terminal-states branch June 26, 2026 14:04
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