(req ForceFailRun)
| 556 | } |
| 557 | |
| 558 | func normalizeForceFailRun(req ForceFailRun) (ForceFailRun, error) { |
| 559 | req.Reason = strings.TrimSpace(req.Reason) |
| 560 | if req.Reason == "" { |
| 561 | return ForceFailRun{}, forceRunDiagnosticError( |
| 562 | diagnosticcontract.CodeForceOpRequiresReason, |
| 563 | "Force fail requires a reason", |
| 564 | "Provide --reason so the recovery audit event explains why the run was failed.", |
| 565 | diagnosticcontract.SeverityError, |
| 566 | "agh task fail <run-id> --reason \"operator recovery\"", |
| 567 | nil, |
| 568 | ErrForceOpRequiresReason, |
| 569 | ) |
| 570 | } |
| 571 | req.Metadata = normalizeRawJSON(req.Metadata) |
| 572 | if err := ValidateMetadataSize(req.Metadata, "force_fail.metadata"); err != nil { |
| 573 | return ForceFailRun{}, err |
| 574 | } |
| 575 | return req, nil |
| 576 | } |
| 577 | |
| 578 | func normalizeRetryRunRequest(req RetryRunRequest) (RetryRunRequest, error) { |
| 579 | req.Metadata = normalizeRawJSON(req.Metadata) |
no test coverage detected