arazzo-executor: recover criterion failures and retain partial reports - #284
Conversation
Assisted-by: Codex Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
|
Reviewed at No confirmed defects. The API surface is handled carefully — every report type is already I re-derived the README's claims rather than reading them, and they hold: XPath and Possible Risks1. Static document defects are now recoverable and can end in a successful run — Medium
An undeclared step id, with a recovery action that reaches a passing step: { "stepId": "a", "operationId": "check",
"successCriteria": [{ "condition": "$steps.typo.outputs.value" }],
"onFailure": [{ "name": "skip", "type": "goto", "stepId": "b" }] }And a typed criterion missing its required Runtime data errors belong in the recovery path: a missing body field or an interpolated pattern that will not compile are exactly what The consumer impact is concrete: Fix: hoist both checks into 2.
Nice-to-Have Improvements3. Two unreachable arms in the terminal-error filter — Low
4.
— Reviewed by Claude Opus 5 |
Add IO-free `prepare` and `required_sources` APIs and an immutable,
reusable
`PreparedWorkflow`. Preparation aggregates deterministic diagnostics
with field
paths, workflow/step context and byte offsets before a checked run can
send a
request. It composes structural validation with static
expression/reference,
capability, effective-parameter, operation and dependency checks across
the
selected workflow's potential calls and recovery branches.
Prepared runs reuse condition/runtime-expression syntax, interpolation
templates,
constant regex/JSONPath programs, endpoints and ordering while keeping
inputs,
attempts and outputs independent. A named condition profile and optional
portability warnings make implementation policy explicit. Retained token
offsets
keep diagnostics accurate with quoted expression lookalikes and cached
ASTs.
The CLI now prepares before execution and prints available partial
history on
terminal runtime errors unless quiet. Source discovery avoids loading
unrelated
documents for qualified operations while preserving bare operation-ID
uniqueness
checks. Existing validation-ignore options remain honored.
This intentionally makes the CLI stricter: a criterion such as
`{"condition":"true || $steps.typo.outputs.value"}`, a typed criterion
without
its required context, or a constant malformed regex fails before
requests,
including on a potential recovery branch. Runtime-dependent criterion
failures
retain the recovery/reporting behavior from #284. Existing `execute`,
`execute_async`, `execute_v1_0` and `Run::start` signatures and lazy
validation
remain unchanged; strict preparation is opt-in for library callers.
The unreleased 0.2 API also adds `CriterionError::Syntax::offset` and
removes the
location prefix from that variant's `message`. Downstream code
constructing or
destructuring all fields must adapt; consumers should read the typed
byte offset
instead of parsing display text. The README migration notes cover this
breaking
change. Preparation uses the runtime's typed missing-reference errors,
displays
syntax offsets once, and sorts bracketed diagnostic indices numerically.
Cached
condition validation remains per use site, including shared reusable
actions.
XPath, AsyncAPI, external workflow calls, non-RFC9535 JSONPath and
nested workflow
calls that require their own dependency scheduling are explicit
checked-path
capability errors. Input schemas remain available for caller validation;
fetching,
cross-document resolution and JSON Schema execution stay in later
stages.
---------
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
Follow up #282 with Stage 2: criterion recovery and report-preserving execution APIs.
Runtime criterion evaluation errors now produce failed conditions with their original typed diagnostics in
CriterionOutcome.error. Success criteria remain ordered, while action criteria stop at the first failure and allow later eligible actions to match.StepRecord.action_criteriarecords the actions actually considered, and text reports include their diagnostics. Missing data stays distinct from explicit null; null regex/JSONPath contexts fail normally, while a JSONPath node containing null selected from a non-null document still counts as a match.Unsupported XPath/AsyncAPI capabilities remain terminal, as do operation, parameter, output, action-reference, client, and limit failures. Preparation-time syntax checks and the Stage 1 dependency-ordering policies remain unchanged. The same runtime recovery policy applies after v1.0 upconversion.
Add
Run::partial_report(),ExecutionFailure, and theexecute_with_report,execute_async_with_report, andexecute_v1_0_with_reportfunctions. Interrupted reports useOutcome::Incomplete, never success; preparation failures have no report. Retain earlier attempts and actual responses/completed workflow calls before fallible output evaluation or action dispatch. Do not fabricate completed records for unsent requests or requests that never received a response. Terminal engine errors stop further progress;AwaitingandNotWaitingremain correctable driver errors, and completed reports remain inspectable.Existing execution function signatures are unchanged. Callers that previously expected runtime criterion errors in
Errmust now inspect the report's outcome and diagnostic fields; successful recovery can leave a successful run containing earlier failed attempts. The new report fields and non-exhaustive enum variants are additive API changes. No dependencies are added or upgraded.crates/roas-arazzo-executor/tests/recovery_test.rsincludes a step with"condition": "$response.body.ready"and anonFailureretry, driven by{}then{"ready":true}responses. It also covers runtime-generated invalid patterns ("condition": "{$inputs.pattern}"withpattern: "["), action fallthrough, nested workflow recovery, null versus missing data, and retained history after terminal errors. Three Stage 1 grammar cases now assert the same typed diagnostics in failed criterion outcomes instead of expecting a terminal error.The behavior follows the Arazzo 1.1 evaluation-error rules. Full preparation, external source resolution, and later stages are not included.