Files
morluto 6ac87697e7 fix(errors)!: make retry_class the only retry field of a target failure (#15450)
* fix(errors)!: make retry_class the only retry field of a target failure

A target failure reported two retry fields: its own `retry` hint
(`none | backoff | after_change`) and the `retry_class` every error
carries. They mapped one to one, so readers had to reconcile both.
`retry_class` is now the single owner: the target-failure table declares
it directly, the projection no longer emits `retry`, the error schema no
longer accepts it, and the CLI recovery rewrite reads `retry_class`.

BREAKING CHANGE: target failures no longer include `retry`, and the
error schema rejects it. Read `retry_class` instead: `backoff` is
`same_call`, `after_change` is `change_first` and `none` is `never`.

* test(errors): readers reject the removed target-failure retry field
2026-12-01 10:36:15 -05:00

70 lines
1.6 KiB
TypeScript

import type {
TargetFailureKind,
TargetFailureRetryClass,
} from "../../../src/domain/targetFailure.js";
/**
* The public target-failure contract, spelled out independently of the
* projection table so a change to the table fails its tests. It matches
* `docs/reference/target-failures.md`.
*/
export const TARGET_FAILURE_CONTRACT = {
selection: {
code: "invalid_request",
category: "invalid_input",
retry_class: "change_first",
},
unrecognized: {
code: "unsupported_target",
category: "unsupported_target",
retry_class: "never",
},
unsupported: {
code: "unsupported_target",
category: "unsupported_target",
retry_class: "never",
},
malformed: {
code: "unsupported_target",
category: "unsupported_target",
retry_class: "never",
},
truncated: {
code: "unsupported_target",
category: "unsupported_target",
retry_class: "never",
},
integrity: {
code: "target_integrity_mismatch",
category: "integrity_mismatch",
retry_class: "never",
},
conflict: {
code: "input_conflict",
category: "invalid_input",
retry_class: "change_first",
},
changed: {
code: "artifact_changed",
category: "integrity_mismatch",
retry_class: "same_call",
},
access: {
code: "access_denied",
category: "unavailable",
retry_class: "change_first",
},
io: {
code: "host_io_failed",
category: "execution_failure",
retry_class: "never",
},
} as const satisfies Record<
TargetFailureKind,
{
readonly code: string;
readonly category: string;
readonly retry_class: TargetFailureRetryClass;
}
>;