Repository navigation
Conversation
Every StepRunRecord now carries `criteria`: one CriterionRecord per
criterion its last attempt evaluated, successCriteria first, then the
criteria of the onSuccess/onFailure actions it considered. A record
holds the source, the action name, the condition, whether it was met and,
for a condition that could not be evaluated, the error reason and
message. No request or response data is recorded.
CriterionEvaluator.evaluate returns a CriterionOutcome ({ met, error? })
instead of a boolean, so the CriterionEvaluationError it used to discard
reaches the record. Criteria are no longer short-circuited: every
criterion of the list is evaluated, so the record explains each unmet one.
A step calling a workflow evaluates its successCriteria even when the
called run failed.
BREAKING CHANGE: CriterionEvaluator.evaluate returns a CriterionOutcome
instead of a boolean; read `.met`. StepExecutor.evaluateCriteria returns
the CriterionRecord list instead of a boolean, and
StepExecutor.selectActions returns a StepActionSelection
({ matchedActions, criteria }) instead of the action list.
Refs #231
Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
A successCriterion of a step that calls a workflow reading an HTTP-exchange expression ($statusCode, $url, $method, $request.*, $response.*) no longer aborts the run with a RuntimeExpressionError. The criterion fails with the `unavailable-expression` error recorded in the step's `criteria`, so the step takes its failure path and onFailure applies, as action criteria already did. Outputs reading such an expression still throw: an output has no failed state to fall back to. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Every criterion is now evaluated, so an authoring error later in a successCriteria list aborts the run even when an earlier criterion is already unmet; before, the unmet criterion hid it. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Matches the readonly lists of StepExecutionResult and StepRunRecord. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Adversarial review (lean)Profile Suggestions
Nits
Contradiction reconciledFindings disagreed on whether evaluating Auto-applied fixes
|
Keep CriterionEvaluator's switch in place, wrapping each return as an outcome, instead of moving it to a #dispatch method, and inline the record's error shape into CriterionRecord instead of exporting CriterionRecordError. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
#evaluateCriterion returns only the outcome part of a record; each caller adds where the criterion is declared. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Assign the switch result and return the outcome once in CriterionEvaluator.evaluate, inline selectActions' return type instead of exporting StepActionSelection, shorten the unavailable-expression comment, and drop the unrelated RuntimeExpressionContext doc edit. Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Refs #231 Signed-off-by: Vladimir Gorej <vladimir.gorej@gmail.com>
Adversarial review: simplification pass (lean)Profile Auto-applied fixes
Squash footer: commit 1ad851a's BREAKING CHANGE text still names For the author (design / public API, not applied)
Not applied (judged not worth it)
|
Description
StepRunRecordnow hascriteria: oneCriterionRecordper criterion the step's last attempt evaluated.successCriteriafirst, then the criteria of theonSuccess/onFailureactions it considered.{ source, action?, condition, met, error? };erroris{ reason, message }.StepExecutionResultcarries the same list.CriterionEvaluator.evaluatereturns aCriterionOutcome({ met, error? }) instead of a boolean. TheCriterionEvaluationErrorit used to discard (runner: criterion evaluation errors must fail the criterion, not abort the step (Arazzo 1.1.0 MUST) #120) now reaches the record.CriterionPredicatealso receives the action the criterion belongs to.successCriteriaeven when the called run failed.type, missingcontext, …) after an unmet one now throws. Before, the unmet criterion hid it, and the step just failed or the action just didn't match. The same applies to thesuccessCriteriaof a workflow-calling step whose called run failed, which were not evaluated at all before.successCriteria. In a step that calls a workflow, asuccessCriterionreading$statusCode,$url,$method,$request.*or$response.*no longer aborts the run.unavailable-expressionerror recorded, soonFailureapplies.outputsstill throw.Motivation and Context
Arazzo 1.1.0 says an implementation SHOULD log or report a criterion it cannot evaluate. Until now the runner either swallowed the error (#120) or aborted the run (#228). The record makes failed criteria visible without either.
Closes #231
BREAKING CHANGE (in the squash footer):
CriterionEvaluator.evaluatereturns aCriterionOutcome;StepExecutor.evaluateCriteriareturnsCriterionRecord[];StepExecutor.selectActionsreturns{ matchedActions, criteria }.StepRunRecordandStepExecutionResultgain a requiredcriteriafield, which matters only to code that constructs them.How Has This Been Tested?
packages/runnernpm test: 720 passing.npm run lintandnpm run typescript:declarationare clean.New and updated specs:
StepExecutorrecords everysuccessCriterionand action criterion, with action names and diagnostics, and an empty list for a step without criteria;ActionResolverevaluates every criterion and passes the action;unavailable-expressionfor its action criteria;successCriteriawith a recorded error, and takesonFailure;outputsreading$response.bodystill throw.Website (after release),
_reference/runner.md:criteriarow.successCriteriano longer throw. The criterion fails with a recordedunavailable-expression; onlyoutputsthrow.StepExecutionResult.criteria, and the new return types ofevaluateCriteriaandselectActions.CriterionEvaluator.evaluatereturns aCriterionOutcome; mentionCriterionRecord.Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests