@yaag/runtime 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cassette/run-checkpoint.ts +14 -10
package/package.json
CHANGED
|
@@ -30,7 +30,8 @@ export interface RunCheckpointOptions {
|
|
|
30
30
|
* What one publication attempt did. `published` covers both a written artifact
|
|
31
31
|
* and a Run that keeps none. `displaced` carries the error that must become the
|
|
32
32
|
* Run's outcome. `lost` reports a Checkpoint the Run asked for and did not get,
|
|
33
|
-
* while a
|
|
33
|
+
* while the Run keeps its own outcome — a completed result, or a primary
|
|
34
|
+
* program error (ADR-0021 amendment).
|
|
34
35
|
*/
|
|
35
36
|
export type RunCheckpointResult =
|
|
36
37
|
| { readonly kind: "published" }
|
|
@@ -66,18 +67,21 @@ export async function publishRunCheckpoint(
|
|
|
66
67
|
writeRecordingDiagnostic(error);
|
|
67
68
|
return { kind: "lost", message: String(error) };
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// A completed Run keeps its outcome and its result: the work is done, and
|
|
71
|
+
// no restorability promise is broken. The lost Cassette rides
|
|
72
|
+
// run_end.checkpointLost and the stderr diagnostic instead of displacing
|
|
73
|
+
// the outcome (ADR-0021 amendment).
|
|
74
|
+
if (options.outcome === "completed") {
|
|
75
|
+
const message = `run completed but its Cassette could not be written: ${String(error)}`;
|
|
76
|
+
writeRecordingDiagnostic(message);
|
|
77
|
+
return { kind: "lost", message };
|
|
74
78
|
}
|
|
75
|
-
// A
|
|
76
|
-
//
|
|
77
|
-
//
|
|
79
|
+
// A pausing or stopped Run promises restorability, and a Checkpoint that
|
|
80
|
+
// did not land makes that acknowledgement a lie, so the failure takes the
|
|
81
|
+
// outcome (ADR-0021: a flush failure is a hard failure there).
|
|
78
82
|
return {
|
|
79
83
|
kind: "displaced",
|
|
80
|
-
error: new Error(`run
|
|
84
|
+
error: new Error(`run ${options.outcome} but is not restorable: ${String(error)}`, {
|
|
81
85
|
cause: error,
|
|
82
86
|
}),
|
|
83
87
|
};
|