@usine/engine 0.3.0 → 0.4.0
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/README.md +109 -38
- package/dist/board-moves/board-moves.d.ts +20 -0
- package/dist/board-moves/board-moves.d.ts.map +1 -0
- package/dist/board-moves/board-moves.js +74 -0
- package/dist/board-moves/board-moves.js.map +1 -0
- package/dist/board-moves/model.d.ts +21 -0
- package/dist/board-moves/model.d.ts.map +1 -0
- package/dist/board-moves/model.js +22 -0
- package/dist/board-moves/model.js.map +1 -0
- package/dist/cursor/cursor.d.ts +2 -6
- package/dist/cursor/cursor.d.ts.map +1 -1
- package/dist/cursor/cursor.js +2 -6
- package/dist/cursor/cursor.js.map +1 -1
- package/dist/cycle-budget/cycle-budget.d.ts +6 -6
- package/dist/cycle-budget/cycle-budget.d.ts.map +1 -1
- package/dist/cycle-budget/cycle-budget.js +5 -5
- package/dist/cycle-budget/cycle-budget.js.map +1 -1
- package/dist/cycle-budget/model.d.ts +2 -2
- package/dist/cycle-budget/model.d.ts.map +1 -1
- package/dist/cycle-budget/model.js +2 -2
- package/dist/cycle-budget/model.js.map +1 -1
- package/dist/cycle-budget/queries.d.ts +1 -1
- package/dist/cycle-budget/queries.d.ts.map +1 -1
- package/dist/cycle-budget/queries.js +3 -3
- package/dist/cycle-budget/queries.js.map +1 -1
- package/dist/database/database.d.ts +1 -1
- package/dist/database/database.d.ts.map +1 -1
- package/dist/database/local-sqlite.d.ts +10 -8
- package/dist/database/local-sqlite.d.ts.map +1 -1
- package/dist/database/local-sqlite.js +11 -10
- package/dist/database/local-sqlite.js.map +1 -1
- package/dist/database/schema.d.ts +533 -22
- package/dist/database/schema.d.ts.map +1 -1
- package/dist/database/schema.js +100 -23
- package/dist/database/schema.js.map +1 -1
- package/dist/{workflow → engine}/admission.d.ts +2 -2
- package/dist/engine/admission.d.ts.map +1 -0
- package/dist/{workflow → engine}/admission.js +4 -4
- package/dist/engine/admission.js.map +1 -0
- package/dist/engine/checkout-recovery.d.ts +69 -0
- package/dist/engine/checkout-recovery.d.ts.map +1 -0
- package/dist/engine/checkout-recovery.js +181 -0
- package/dist/engine/checkout-recovery.js.map +1 -0
- package/dist/engine/engine.d.ts +55 -26
- package/dist/engine/engine.d.ts.map +1 -1
- package/dist/engine/engine.js +118 -128
- package/dist/engine/engine.js.map +1 -1
- package/dist/engine/error.d.ts +29 -10
- package/dist/engine/error.d.ts.map +1 -1
- package/dist/engine/error.js +28 -8
- package/dist/engine/error.js.map +1 -1
- package/dist/engine/lifecycle.d.ts +81 -28
- package/dist/engine/lifecycle.d.ts.map +1 -1
- package/dist/engine/lifecycle.js +83 -44
- package/dist/engine/lifecycle.js.map +1 -1
- package/dist/engine/retry.d.ts +16 -0
- package/dist/engine/retry.d.ts.map +1 -0
- package/dist/engine/retry.js +18 -0
- package/dist/engine/retry.js.map +1 -0
- package/dist/engine/run-again.d.ts +45 -0
- package/dist/engine/run-again.d.ts.map +1 -0
- package/dist/engine/run-again.js +56 -0
- package/dist/engine/run-again.js.map +1 -0
- package/dist/engine/run-driver.d.ts +54 -0
- package/dist/engine/run-driver.d.ts.map +1 -0
- package/dist/engine/run-driver.js +362 -0
- package/dist/engine/run-driver.js.map +1 -0
- package/dist/engine/shutdown.d.ts +3 -4
- package/dist/engine/shutdown.d.ts.map +1 -1
- package/dist/engine/shutdown.js +3 -4
- package/dist/engine/shutdown.js.map +1 -1
- package/dist/engine/submission.d.ts +31 -11
- package/dist/engine/submission.d.ts.map +1 -1
- package/dist/engine/submission.js +42 -12
- package/dist/engine/submission.js.map +1 -1
- package/dist/item-projection/item-projection.d.ts +12 -4
- package/dist/item-projection/item-projection.d.ts.map +1 -1
- package/dist/item-projection/item-projection.js +41 -6
- package/dist/item-projection/item-projection.js.map +1 -1
- package/dist/item-projection/model.d.ts +5 -1
- package/dist/item-projection/model.d.ts.map +1 -1
- package/dist/item-projection/model.js +6 -2
- package/dist/item-projection/model.js.map +1 -1
- package/dist/loop-control/loop-control.d.ts +5 -5
- package/dist/loop-control/loop-control.d.ts.map +1 -1
- package/dist/loop-control/loop-control.js +4 -4
- package/dist/loop-control/loop-control.js.map +1 -1
- package/dist/loop-control/model.d.ts +1 -1
- package/dist/loop-control/model.d.ts.map +1 -1
- package/dist/loop-control/model.js +1 -1
- package/dist/loop-control/model.js.map +1 -1
- package/dist/repository-label-projection/model.d.ts +2 -2
- package/dist/repository-label-projection/model.d.ts.map +1 -1
- package/dist/repository-label-projection/model.js +2 -2
- package/dist/repository-label-projection/model.js.map +1 -1
- package/dist/repository-label-projection/repository-label-projection.d.ts +1 -1
- package/dist/repository-label-projection/repository-label-projection.d.ts.map +1 -1
- package/dist/repository-label-projection/repository-label-projection.js +1 -1
- package/dist/repository-label-projection/repository-label-projection.js.map +1 -1
- package/dist/run-reader/model.d.ts +62 -4
- package/dist/run-reader/model.d.ts.map +1 -1
- package/dist/run-reader/model.js +66 -7
- package/dist/run-reader/model.js.map +1 -1
- package/dist/run-reader/run-reader.d.ts +19 -9
- package/dist/run-reader/run-reader.d.ts.map +1 -1
- package/dist/run-reader/run-reader.js +23 -7
- package/dist/run-reader/run-reader.js.map +1 -1
- package/dist/step-executor.d.ts +64 -10
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/step-executor.js +10 -2
- package/dist/step-executor.js.map +1 -1
- package/dist/store/attempt-windows.d.ts +8 -0
- package/dist/store/attempt-windows.d.ts.map +1 -0
- package/dist/store/attempt-windows.js +53 -0
- package/dist/store/attempt-windows.js.map +1 -0
- package/dist/store/codec.d.ts +207 -42
- package/dist/store/codec.d.ts.map +1 -1
- package/dist/store/codec.js +52 -14
- package/dist/store/codec.js.map +1 -1
- package/dist/store/leftovers.d.ts +10 -0
- package/dist/store/leftovers.d.ts.map +1 -0
- package/dist/store/leftovers.js +43 -0
- package/dist/store/leftovers.js.map +1 -0
- package/dist/store/loop-items.d.ts +16 -0
- package/dist/store/loop-items.d.ts.map +1 -0
- package/dist/store/loop-items.js +185 -0
- package/dist/store/loop-items.js.map +1 -0
- package/dist/store/queries.d.ts +342 -35
- package/dist/store/queries.d.ts.map +1 -1
- package/dist/store/queries.js +302 -107
- package/dist/store/queries.js.map +1 -1
- package/dist/store/store.d.ts +91 -54
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +468 -190
- package/dist/store/store.js.map +1 -1
- package/dist/store/transcript.d.ts +3 -3
- package/dist/store/transcript.d.ts.map +1 -1
- package/dist/store/transcript.js +25 -6
- package/dist/store/transcript.js.map +1 -1
- package/dist/transcript.d.ts +19 -20
- package/dist/transcript.d.ts.map +1 -1
- package/dist/transcript.js +23 -21
- package/dist/transcript.js.map +1 -1
- package/dist/trigger-condition.d.ts +23 -0
- package/dist/trigger-condition.d.ts.map +1 -0
- package/dist/trigger-condition.js +8 -0
- package/dist/trigger-condition.js.map +1 -0
- package/drizzle/20260917071139_resolve_run_failure/migration.sql +1 -0
- package/drizzle/20260917071139_resolve_run_failure/snapshot.json +1471 -0
- package/drizzle/20260918032643_attempt_salvage/migration.sql +1 -0
- package/drizzle/20260918032643_attempt_salvage/snapshot.json +1481 -0
- package/drizzle/20261011153856_drop_workflow_tables/migration.sql +4 -0
- package/drizzle/20261011153856_drop_workflow_tables/snapshot.json +1433 -0
- package/drizzle/20261017155043_attempt_salvage_check/migration.sql +41 -0
- package/drizzle/20261017155043_attempt_salvage_check/snapshot.json +1421 -0
- package/drizzle/20261018162700_discard_attempt_leftovers/migration.sql +1 -0
- package/drizzle/20261018162700_discard_attempt_leftovers/snapshot.json +1431 -0
- package/drizzle/20261018172605_loop_items_and_reopenings/migration.sql +15 -0
- package/drizzle/20261018172605_loop_items_and_reopenings/snapshot.json +1574 -0
- package/drizzle/20261018180339_attempt_ended_at/migration.sql +1 -0
- package/drizzle/20261018180339_attempt_ended_at/snapshot.json +1584 -0
- package/drizzle/20261019104043_run_approval_source/migration.sql +15 -0
- package/drizzle/20261019104043_run_approval_source/snapshot.json +1610 -0
- package/drizzle/20261019133538_board_moves/migration.sql +14 -0
- package/drizzle/20261019133538_board_moves/snapshot.json +1731 -0
- package/drizzle/20261019170538_item_projection_gone/migration.sql +1 -0
- package/drizzle/20261019170538_item_projection_gone/snapshot.json +1741 -0
- package/drizzle/20261019180649_run_again_events/migration.sql +7 -0
- package/drizzle/20261019180649_run_again_events/snapshot.json +1804 -0
- package/drizzle/20261019185008_trigger_event_permissions/migration.sql +1 -0
- package/drizzle/20261019185008_trigger_event_permissions/snapshot.json +1814 -0
- package/drizzle/20261020103746_attempt_start/migration.sql +5 -0
- package/drizzle/20261020103746_attempt_start/snapshot.json +1844 -0
- package/drizzle/20261020125211_attempt_comments/migration.sql +1 -0
- package/drizzle/20261020125211_attempt_comments/snapshot.json +1854 -0
- package/drizzle/20261020191320_run_closed_at/migration.sql +6 -0
- package/drizzle/20261020191320_run_closed_at/snapshot.json +1864 -0
- package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/migration.sql +2 -0
- package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/snapshot.json +1867 -0
- package/package.json +15 -5
- package/dist/workflow/admission.d.ts.map +0 -1
- package/dist/workflow/admission.js.map +0 -1
- package/dist/workflow/command.d.ts +0 -13
- package/dist/workflow/command.d.ts.map +0 -1
- package/dist/workflow/command.js +0 -17
- package/dist/workflow/command.js.map +0 -1
- package/dist/workflow/workflow.d.ts +0 -18
- package/dist/workflow/workflow.d.ts.map +0 -1
- package/dist/workflow/workflow.js +0 -108
- package/dist/workflow/workflow.js.map +0 -1
package/dist/engine/error.d.ts
CHANGED
|
@@ -2,44 +2,63 @@ import { Schema } from "effect";
|
|
|
2
2
|
declare const RunNotFoundError_base: Schema.Class<RunNotFoundError, Schema.TaggedStruct<"RunNotFoundError", {
|
|
3
3
|
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
4
4
|
}>, import("effect/Cause").YieldableError>;
|
|
5
|
-
/**
|
|
5
|
+
/** An error for a Run ID that doesn't exist. */
|
|
6
6
|
export declare class RunNotFoundError extends RunNotFoundError_base {
|
|
7
7
|
}
|
|
8
8
|
declare const RunOperationRejectedError_base: Schema.Class<RunOperationRejectedError, Schema.TaggedStruct<"RunOperationRejectedError", {
|
|
9
9
|
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
10
|
-
readonly operation: Schema.Literals<readonly ["approve", "retry"]>;
|
|
10
|
+
readonly operation: Schema.Literals<readonly ["approve", "retry", "resolveFailure", "runAgain"]>;
|
|
11
11
|
readonly state: Schema.String;
|
|
12
12
|
}>, import("effect/Cause").YieldableError>;
|
|
13
|
-
/**
|
|
13
|
+
/** An error for an operator action that the Run's state doesn't allow. */
|
|
14
14
|
export declare class RunOperationRejectedError extends RunOperationRejectedError_base {
|
|
15
15
|
}
|
|
16
|
+
declare const RunRetryBlockedError_base: Schema.Class<RunRetryBlockedError, Schema.TaggedStruct<"RunRetryBlockedError", {
|
|
17
|
+
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
18
|
+
readonly openRunId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
19
|
+
readonly message: Schema.NonEmptyString;
|
|
20
|
+
}>, import("effect/Cause").YieldableError>;
|
|
21
|
+
/** An error for a retry or run again while `openRunId`, another Run of the same Loop and Item, is open. */
|
|
22
|
+
export declare class RunRetryBlockedError extends RunRetryBlockedError_base {
|
|
23
|
+
}
|
|
16
24
|
declare const EnginePersistenceError_base: Schema.Class<EnginePersistenceError, Schema.TaggedStruct<"EnginePersistenceError", {
|
|
17
25
|
readonly operation: Schema.String;
|
|
18
26
|
readonly cause: Schema.Defect;
|
|
19
27
|
}>, import("effect/Cause").YieldableError>;
|
|
20
|
-
/** An
|
|
28
|
+
/** An error reading or writing the instance's durable records. */
|
|
21
29
|
export declare class EnginePersistenceError extends EnginePersistenceError_base {
|
|
22
30
|
}
|
|
23
31
|
declare const AttemptCancellationError_base: Schema.Class<AttemptCancellationError, Schema.TaggedStruct<"AttemptCancellationError", {
|
|
24
32
|
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
25
33
|
readonly cause: Schema.Defect;
|
|
26
34
|
}>, import("effect/Cause").YieldableError>;
|
|
27
|
-
/**
|
|
35
|
+
/** An error for a canceled Run whose active Attempt couldn't be interrupted. */
|
|
28
36
|
export declare class AttemptCancellationError extends AttemptCancellationError_base {
|
|
29
37
|
}
|
|
30
|
-
/**
|
|
31
|
-
export declare const RunStoreError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof EnginePersistenceError]>;
|
|
38
|
+
/** The errors that the Run store can fail with. */
|
|
39
|
+
export declare const RunStoreError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof RunRetryBlockedError, typeof EnginePersistenceError]>;
|
|
32
40
|
export type RunStoreError = typeof RunStoreError.Type;
|
|
33
41
|
declare const RunInterventionRejectedError_base: Schema.Class<RunInterventionRejectedError, Schema.TaggedStruct<"RunInterventionRejectedError", {
|
|
34
42
|
readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
|
|
35
43
|
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
36
44
|
readonly message: Schema.NonEmptyString;
|
|
37
45
|
}>, import("effect/Cause").YieldableError>;
|
|
38
|
-
/**
|
|
46
|
+
/** An error for an Attempt that is no longer live or whose channel rejected operator input. */
|
|
39
47
|
export declare class RunInterventionRejectedError extends RunInterventionRejectedError_base {
|
|
40
48
|
}
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
declare const LeftoversDiscardRejectedError_base: Schema.Class<LeftoversDiscardRejectedError, Schema.TaggedStruct<"LeftoversDiscardRejectedError", {
|
|
50
|
+
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
51
|
+
/** The number of open Attempts on `worker`. */
|
|
52
|
+
readonly running: Schema.Int;
|
|
53
|
+
}>, import("effect/Cause").YieldableError>;
|
|
54
|
+
/**
|
|
55
|
+
* An error for discarding the leftovers of a Worker that is still in `usine.yaml` or still has
|
|
56
|
+
* open Attempts. Nothing is discarded.
|
|
57
|
+
*/
|
|
58
|
+
export declare class LeftoversDiscardRejectedError extends LeftoversDiscardRejectedError_base {
|
|
59
|
+
}
|
|
60
|
+
/** The Run store errors plus `AttemptCancellationError`. */
|
|
61
|
+
export declare const RunEngineError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof RunRetryBlockedError, typeof EnginePersistenceError, typeof AttemptCancellationError, typeof RunInterventionRejectedError]>;
|
|
43
62
|
export type RunEngineError = typeof RunEngineError.Type;
|
|
44
63
|
export {};
|
|
45
64
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAEhC,gDAAgD;AAChD,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;;;AAEL,0EAA0E;AAC1E,qBAAa,yBAA0B,SAAQ,8BAM7C;CAAG;;;;;;AAEL,2GAA2G;AAC3G,qBAAa,oBAAqB,SAAQ,yBAMxC;CAAG;;;;;AAEL,kEAAkE;AAClE,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG;;;;;AAEL,gFAAgF;AAChF,qBAAa,wBAAyB,SAAQ,6BAK5C;CAAG;AAEL,mDAAmD;AACnD,eAAO,MAAM,aAAa,gJAKxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;;;;;;AAEtD,+FAA+F;AAC/F,qBAAa,4BAA6B,SAAQ,iCAMhD;CAAG;;;IAUH,+CAA+C;;;AARjD;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kCAMjD;CAAG;AAEL,4DAA4D;AAC5D,eAAO,MAAM,cAAc,sNAOzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC"}
|
package/dist/engine/error.js
CHANGED
|
@@ -1,47 +1,67 @@
|
|
|
1
1
|
import { AttemptId } from "@usine/core/attempt";
|
|
2
2
|
import { RunId } from "@usine/core/run";
|
|
3
|
+
import { WorkerName } from "@usine/core/worker";
|
|
3
4
|
import { Schema } from "effect";
|
|
4
|
-
/**
|
|
5
|
+
/** An error for a Run ID that doesn't exist. */
|
|
5
6
|
export class RunNotFoundError extends Schema.TaggedError("@usine/engine/RunNotFoundError")("RunNotFoundError", {
|
|
6
7
|
runId: RunId,
|
|
7
8
|
}) {
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
+
/** An error for an operator action that the Run's state doesn't allow. */
|
|
10
11
|
export class RunOperationRejectedError extends Schema.TaggedError("@usine/engine/RunOperationRejectedError")("RunOperationRejectedError", {
|
|
11
12
|
runId: RunId,
|
|
12
|
-
operation: Schema.Literals(["approve", "retry"]),
|
|
13
|
+
operation: Schema.Literals(["approve", "retry", "resolveFailure", "runAgain"]),
|
|
13
14
|
state: Schema.String,
|
|
14
15
|
}) {
|
|
15
16
|
}
|
|
16
|
-
/** An
|
|
17
|
+
/** An error for a retry or run again while `openRunId`, another Run of the same Loop and Item, is open. */
|
|
18
|
+
export class RunRetryBlockedError extends Schema.TaggedError("@usine/engine/RunRetryBlockedError")("RunRetryBlockedError", {
|
|
19
|
+
runId: RunId,
|
|
20
|
+
openRunId: RunId,
|
|
21
|
+
message: Schema.NonEmptyString,
|
|
22
|
+
}) {
|
|
23
|
+
}
|
|
24
|
+
/** An error reading or writing the instance's durable records. */
|
|
17
25
|
export class EnginePersistenceError extends Schema.TaggedError("@usine/engine/EnginePersistenceError")("EnginePersistenceError", {
|
|
18
26
|
operation: Schema.String,
|
|
19
27
|
cause: Schema.Defect(),
|
|
20
28
|
}) {
|
|
21
29
|
}
|
|
22
|
-
/**
|
|
30
|
+
/** An error for a canceled Run whose active Attempt couldn't be interrupted. */
|
|
23
31
|
export class AttemptCancellationError extends Schema.TaggedError("@usine/engine/AttemptCancellationError")("AttemptCancellationError", {
|
|
24
32
|
attemptId: AttemptId,
|
|
25
33
|
cause: Schema.Defect(),
|
|
26
34
|
}) {
|
|
27
35
|
}
|
|
28
|
-
/**
|
|
36
|
+
/** The errors that the Run store can fail with. */
|
|
29
37
|
export const RunStoreError = Schema.Union([
|
|
30
38
|
RunNotFoundError,
|
|
31
39
|
RunOperationRejectedError,
|
|
40
|
+
RunRetryBlockedError,
|
|
32
41
|
EnginePersistenceError,
|
|
33
42
|
]);
|
|
34
|
-
/**
|
|
43
|
+
/** An error for an Attempt that is no longer live or whose channel rejected operator input. */
|
|
35
44
|
export class RunInterventionRejectedError extends Schema.TaggedError("@usine/engine/RunInterventionRejectedError")("RunInterventionRejectedError", {
|
|
36
45
|
runId: RunId,
|
|
37
46
|
attemptId: AttemptId,
|
|
38
47
|
message: Schema.NonEmptyString,
|
|
39
48
|
}) {
|
|
40
49
|
}
|
|
41
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* An error for discarding the leftovers of a Worker that is still in `usine.yaml` or still has
|
|
52
|
+
* open Attempts. Nothing is discarded.
|
|
53
|
+
*/
|
|
54
|
+
export class LeftoversDiscardRejectedError extends Schema.TaggedError("@usine/engine/LeftoversDiscardRejectedError")("LeftoversDiscardRejectedError", {
|
|
55
|
+
worker: WorkerName,
|
|
56
|
+
/** The number of open Attempts on `worker`. */
|
|
57
|
+
running: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
58
|
+
}) {
|
|
59
|
+
}
|
|
60
|
+
/** The Run store errors plus `AttemptCancellationError`. */
|
|
42
61
|
export const RunEngineError = Schema.Union([
|
|
43
62
|
RunNotFoundError,
|
|
44
63
|
RunOperationRejectedError,
|
|
64
|
+
RunRetryBlockedError,
|
|
45
65
|
EnginePersistenceError,
|
|
46
66
|
AttemptCancellationError,
|
|
47
67
|
RunInterventionRejectedError,
|
package/dist/engine/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,gDAAgD;AAChD,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,CACtD,gCAAgC,CACjC,CAAC,kBAAkB,EAAE;IACpB,KAAK,EAAE,KAAK;CACb,CAAC;CAAG;AAEL,0EAA0E;AAC1E,MAAM,OAAO,yBAA0B,SAAQ,MAAM,CAAC,WAAW,CAC/D,yCAAyC,CAC1C,CAAC,2BAA2B,EAAE;IAC7B,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC9E,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC;CAAG;AAEL,2GAA2G;AAC3G,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,CAC1D,oCAAoC,CACrC,CAAC,sBAAsB,EAAE;IACxB,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL,kEAAkE;AAClE,MA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empt, AttemptId, AttemptNumber } from "@usine/core/attempt";
|
|
2
2
|
import { AttemptFailure, InfraFailure } from "@usine/core/attempt/failure";
|
|
3
3
|
import { AttemptCanceled, AttemptFailed, AttemptSucceeded } from "@usine/core/attempt/outcome";
|
|
4
|
+
import type { SalvagePushed } from "@usine/core/attempt/salvage";
|
|
5
|
+
import { type AttemptStart, type OperatorRetryStart } from "@usine/core/attempt/start";
|
|
4
6
|
import { EventId } from "@usine/core/event";
|
|
5
7
|
import { Run, RunId } from "@usine/core/run";
|
|
6
8
|
import * as RunState from "@usine/core/run/state";
|
|
7
9
|
import { StepResult } from "@usine/core/step/result";
|
|
8
10
|
import { Option, Result } from "effect";
|
|
9
|
-
import type {
|
|
10
|
-
/** A Run and its Attempts
|
|
11
|
+
import type { IgnoreReason } from "./submission.ts";
|
|
12
|
+
/** A Run and its Attempts, ordered by Attempt number. */
|
|
11
13
|
interface RunProgress {
|
|
12
14
|
readonly run: Run;
|
|
13
15
|
readonly attempts: ReadonlyArray<Attempt>;
|
|
@@ -34,36 +36,35 @@ type RunSucceeded = {
|
|
|
34
36
|
readonly state: RunState.Succeeded;
|
|
35
37
|
readonly result: StepResult;
|
|
36
38
|
};
|
|
37
|
-
/**
|
|
39
|
+
/** The changes committed together when an Attempt finishes. */
|
|
38
40
|
export type FinishDecision = RetryAttempt | RunFailed | RunSucceeded | Unchanged;
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
+
* Returns the changes for the executor result of `attemptId`. An infrastructure failure is
|
|
43
|
+
* retried up to 3 Attempts in total; a late or repeated result returns `Unchanged`.
|
|
42
44
|
*/
|
|
43
45
|
export declare const finishAttempt: (current: RunProgress, attemptId: AttemptId, result: Result.Result<StepResult, AttemptFailure>) => FinishDecision;
|
|
44
|
-
/**
|
|
45
|
-
* Repairs an open Attempt from a final durable result. The workflow has already
|
|
46
|
-
* ended, so even an infrastructure failure closes the Run without auto-retry.
|
|
47
|
-
* The runtime must first translate its completion into a typed result; defects
|
|
48
|
-
* and suspension are not Attempt outcomes here (ADRs 0003 and 0010).
|
|
49
|
-
*/
|
|
50
|
-
export declare const reconcileAttempt: (current: RunProgress, result: Result.Result<StepResult, AttemptFailure>) => FinishDecision;
|
|
51
46
|
type StartDecision = {
|
|
52
47
|
readonly _tag: "StartAttempt";
|
|
53
48
|
readonly state: RunState.Running;
|
|
54
49
|
readonly number: AttemptNumber;
|
|
50
|
+
readonly start: AttemptStart;
|
|
55
51
|
readonly interrupted: Option.Option<RetryAttempt>;
|
|
52
|
+
readonly resume: Option.Option<SalvagePushed>;
|
|
53
|
+
} | {
|
|
54
|
+
readonly _tag: "ReattachAttempt";
|
|
55
|
+
readonly state: RunState.Running;
|
|
56
|
+
readonly attempt: Attempt;
|
|
57
|
+
readonly resume: Option.Option<SalvagePushed>;
|
|
56
58
|
} | RunFailed | {
|
|
57
59
|
readonly _tag: "RunClosed";
|
|
58
60
|
readonly state: RunState.RunState;
|
|
59
61
|
};
|
|
60
62
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* The caller creates the new Attempt's identity and timestamp only when admitted.
|
|
63
|
+
* Returns how the next Attempt starts after a Worker reservation. If an open Attempt's parent
|
|
64
|
+
* task is `live`, reattaches it without using a retry; otherwise fails it with `interruption`,
|
|
65
|
+
* counted against the retry cap. `requested` is the operator retry that reopened the Run, if any.
|
|
65
66
|
*/
|
|
66
|
-
export declare const beginAttempt: (current: RunProgress, interruption: InfraFailure) => StartDecision;
|
|
67
|
+
export declare const beginAttempt: (current: RunProgress, interruption: InfraFailure, live: Option.Option<AttemptId>, requested: Option.Option<OperatorRetryStart>) => StartDecision;
|
|
67
68
|
type CancelDecision = {
|
|
68
69
|
readonly _tag: "AlreadyClosed";
|
|
69
70
|
} | {
|
|
@@ -74,10 +75,7 @@ type CancelDecision = {
|
|
|
74
75
|
readonly outcome: AttemptCanceled;
|
|
75
76
|
}>;
|
|
76
77
|
};
|
|
77
|
-
/**
|
|
78
|
-
* Cancels open work and, if executing, its unfinished Attempt. A Run awaiting
|
|
79
|
-
* capacity may have no Attempt, or only the closed Attempt preceding a retry.
|
|
80
|
-
*/
|
|
78
|
+
/** Returns the cancel decision for an open Run and its open Attempt, if any. */
|
|
81
79
|
export declare const cancelRun: (current: RunProgress) => CancelDecision;
|
|
82
80
|
type RetryDecision = {
|
|
83
81
|
readonly _tag: "Resume";
|
|
@@ -88,11 +86,67 @@ type RetryDecision = {
|
|
|
88
86
|
readonly _tag: "RetryRejected";
|
|
89
87
|
};
|
|
90
88
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
89
|
+
* Returns the operator retry decision, regardless of the Attempt count. A retry of a running Run
|
|
90
|
+
* with no open Attempt changes nothing; a retry of a running Attempt is rejected.
|
|
91
|
+
*/
|
|
92
|
+
export declare const retryRun: (current: RunProgress) => RetryDecision;
|
|
93
|
+
/**
|
|
94
|
+
* The Loop's previous sighting of an Item: `None` if never seen, `Some(None)` after a
|
|
95
|
+
* non-matching sighting, and `Some(Some(event))` for the last submitted Event.
|
|
96
|
+
*/
|
|
97
|
+
export type PreviousSighting = Option.Option<Option.Option<EventId>>;
|
|
98
|
+
/**
|
|
99
|
+
* Returns whether the previous sighting was a non-match or another Event than `eventId`. Returns
|
|
100
|
+
* `false` if the Loop never saw the Item.
|
|
101
|
+
*/
|
|
102
|
+
export declare const cameBack: (previous: PreviousSighting, eventId: EventId) => boolean;
|
|
103
|
+
/** The state of a recorded Event that has a Run or was ignored. */
|
|
104
|
+
export type Settlement = {
|
|
105
|
+
readonly _tag: "Owned";
|
|
106
|
+
readonly run: Run;
|
|
107
|
+
} | {
|
|
108
|
+
readonly _tag: "Ignored";
|
|
109
|
+
readonly reason: IgnoreReason;
|
|
110
|
+
};
|
|
111
|
+
type SightingDecision = {
|
|
112
|
+
readonly _tag: "JoinRun";
|
|
113
|
+
readonly run: Run;
|
|
114
|
+
} | {
|
|
115
|
+
readonly _tag: "StayIgnored";
|
|
116
|
+
readonly reason: IgnoreReason;
|
|
117
|
+
} | {
|
|
118
|
+
readonly _tag: "ReopenEvent";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Returns what a new sighting of the `settled` Event does. The Event reopens only if the Item
|
|
122
|
+
* came back (#267) and its Run was canceled or the queued Event was revoked.
|
|
123
|
+
*/
|
|
124
|
+
export declare const resightEvent: (settled: Settlement, itemCameBack: boolean) => SightingDecision;
|
|
125
|
+
/**
|
|
126
|
+
* The state that keeps a Loop from opening Runs for an Item after an Attempt stopped for the
|
|
127
|
+
* operator: the stopped Run, and the Item's state after the stop once seen (#241, #341).
|
|
128
|
+
*/
|
|
129
|
+
export interface Suppression {
|
|
130
|
+
readonly runId: RunId;
|
|
131
|
+
readonly suppressedEventId: Option.Option<EventId>;
|
|
132
|
+
}
|
|
133
|
+
/** The kind of operator stop: a question or a blocker. */
|
|
134
|
+
export type OperatorStop = "question" | "blocker";
|
|
135
|
+
/** Returns the kind of operator stop that fails the Run in `decision`, or `None` (ADR 0017). */
|
|
136
|
+
export declare const operatorStop: (decision: FinishDecision) => Option.Option<OperatorStop>;
|
|
137
|
+
type SuppressionDecision = {
|
|
138
|
+
readonly _tag: "Suppress";
|
|
139
|
+
} | {
|
|
140
|
+
readonly _tag: "SuppressFrom";
|
|
141
|
+
} | {
|
|
142
|
+
readonly _tag: "Lift";
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Returns what an unclaimed Event does during a suppression. The first Event after the stop,
|
|
146
|
+
* which usually contains the Agent's own comment, becomes the suppressed state (`SuppressFrom`);
|
|
147
|
+
* a different later Event lifts the suppression.
|
|
94
148
|
*/
|
|
95
|
-
export declare const
|
|
149
|
+
export declare const suppressionDecision: (suppression: Suppression, eventId: EventId) => SuppressionDecision;
|
|
96
150
|
type ClaimDecision = {
|
|
97
151
|
readonly _tag: "OpenRun";
|
|
98
152
|
} | {
|
|
@@ -103,9 +157,8 @@ type ClaimDecision = {
|
|
|
103
157
|
readonly state: RunState.Canceled;
|
|
104
158
|
};
|
|
105
159
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* ignored Events before this decision; running Attempts always finish (ADR 0007).
|
|
160
|
+
* Returns what an unclaimed Event does: open a Run, queue behind the Item's running Run, or
|
|
161
|
+
* supersede the Item's unstarted Run (ADR 0007).
|
|
109
162
|
*/
|
|
110
163
|
export declare const claimRun: (blocking: Option.Option<Run>, eventId: EventId) => ClaimDecision;
|
|
111
164
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAmB,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAmB,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,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AAE,CAAC;AAEhG;;;GAGG;AACH,eAAO,MAAM,QAAQ,aAAc,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,OAAO,KAAG,aAQzE,CAAC"}
|
package/dist/engine/lifecycle.js
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import { Attempt, AttemptId, AttemptNumber, shouldAutoRetry } from "@usine/core/attempt";
|
|
2
2
|
import { AttemptFailure, InfraFailure } from "@usine/core/attempt/failure";
|
|
3
3
|
import { AttemptCanceled, AttemptFailed, AttemptSucceeded } from "@usine/core/attempt/outcome";
|
|
4
|
+
import { StartedAfterRestart, StartedByEvent, StartedByInfraRetry, } from "@usine/core/attempt/start";
|
|
4
5
|
import { EventId } from "@usine/core/event";
|
|
5
6
|
import { Run, RunId } from "@usine/core/run";
|
|
6
7
|
import * as RunState from "@usine/core/run/state";
|
|
7
8
|
import { StepResult } from "@usine/core/step/result";
|
|
8
|
-
import { Option, Result } from "effect";
|
|
9
|
-
// Engine policy, not a limit imposed on consumers of the core Attempt model.
|
|
9
|
+
import { Array as EffectArray, Option, Result } from "effect";
|
|
10
10
|
const MAX_AUTO_ATTEMPTS = AttemptNumber.make(3);
|
|
11
11
|
const openAttempt = (current) => Option.fromNullishOr(current.attempts.at(-1)).pipe(Option.filter((attempt) => Option.isNone(attempt.outcome)));
|
|
12
|
-
const failRunningAttempt = (state, attempt, failure
|
|
12
|
+
const failRunningAttempt = (state, attempt, failure) => {
|
|
13
13
|
const outcome = new AttemptFailed({ failure });
|
|
14
|
-
if (
|
|
15
|
-
shouldAutoRetry({ failure, number: attempt.number, maxAutoAttempts: MAX_AUTO_ATTEMPTS })) {
|
|
14
|
+
if (shouldAutoRetry({ failure, number: attempt.number, maxAutoAttempts: MAX_AUTO_ATTEMPTS })) {
|
|
16
15
|
return { _tag: "RetryAttempt", attempt, outcome };
|
|
17
16
|
}
|
|
18
17
|
return { _tag: "RunFailed", attempt, outcome, state: RunState.fail(state) };
|
|
19
18
|
};
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Returns the changes for the executor result of `attemptId`. An infrastructure failure is
|
|
21
|
+
* retried up to 3 Attempts in total; a late or repeated result returns `Unchanged`.
|
|
22
|
+
*/
|
|
23
|
+
export const finishAttempt = (current, attemptId, result) => {
|
|
21
24
|
if (current.run.state._tag !== "Running") {
|
|
22
25
|
return { _tag: "Unchanged", reason: "RunNotRunning" };
|
|
23
26
|
}
|
|
24
27
|
const attempt = openAttempt(current);
|
|
25
28
|
if (Option.isNone(attempt))
|
|
26
29
|
return { _tag: "Unchanged", reason: "NoOpenAttempt" };
|
|
27
|
-
// A
|
|
28
|
-
// replacement Attempt, even though the Run is Running again.
|
|
30
|
+
// A result from before a restart or retry doesn't apply to the replacement Attempt.
|
|
29
31
|
if (attempt.value.id !== attemptId)
|
|
30
32
|
return { _tag: "Unchanged", reason: "AttemptReplaced" };
|
|
31
33
|
if (Result.isFailure(result)) {
|
|
32
|
-
return failRunningAttempt(current.run.state, attempt.value, result.failure
|
|
34
|
+
return failRunningAttempt(current.run.state, attempt.value, result.failure);
|
|
33
35
|
}
|
|
34
36
|
return {
|
|
35
37
|
_tag: "RunSucceeded",
|
|
@@ -39,30 +41,14 @@ const finish = (current, attemptId, result, policy) => {
|
|
|
39
41
|
result: result.success,
|
|
40
42
|
};
|
|
41
43
|
};
|
|
44
|
+
// Only a pushed salvage can be fetched on another Worker, so a retry resumes from the newest one.
|
|
45
|
+
const newestPushedSalvage = (attempts) => EffectArray.findLast(attempts, (attempt) => Option.filter(attempt.salvage, (salvage) => salvage._tag === "Pushed"));
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
export const finishAttempt = (current, attemptId, result) => finish(current, attemptId, result, "Execution");
|
|
47
|
-
/**
|
|
48
|
-
* Repairs an open Attempt from a final durable result. The workflow has already
|
|
49
|
-
* ended, so even an infrastructure failure closes the Run without auto-retry.
|
|
50
|
-
* The runtime must first translate its completion into a typed result; defects
|
|
51
|
-
* and suspension are not Attempt outcomes here (ADRs 0003 and 0010).
|
|
47
|
+
* Returns how the next Attempt starts after a Worker reservation. If an open Attempt's parent
|
|
48
|
+
* task is `live`, reattaches it without using a retry; otherwise fails it with `interruption`,
|
|
49
|
+
* counted against the retry cap. `requested` is the operator retry that reopened the Run, if any.
|
|
52
50
|
*/
|
|
53
|
-
export const
|
|
54
|
-
const attempt = openAttempt(current);
|
|
55
|
-
return Option.isNone(attempt)
|
|
56
|
-
? { _tag: "Unchanged", reason: "NoOpenAttempt" }
|
|
57
|
-
: finish(current, attempt.value.id, result, "FinalReconciliation");
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Admits the next Attempt after a Worker reservation. An unfinished previous
|
|
61
|
-
* Attempt indicates a restart and counts against the same retry cap as ordinary
|
|
62
|
-
* infrastructure failure. `interruption` records the runtime's explanation.
|
|
63
|
-
* The caller creates the new Attempt's identity and timestamp only when admitted.
|
|
64
|
-
*/
|
|
65
|
-
export const beginAttempt = (current, interruption) => {
|
|
51
|
+
export const beginAttempt = (current, interruption, live, requested) => {
|
|
66
52
|
const state = current.run.state;
|
|
67
53
|
if (!RunState.isStartable(state) && state._tag !== "Running") {
|
|
68
54
|
return { _tag: "RunClosed", state };
|
|
@@ -70,22 +56,32 @@ export const beginAttempt = (current, interruption) => {
|
|
|
70
56
|
let interrupted = Option.none();
|
|
71
57
|
const attempt = openAttempt(current);
|
|
72
58
|
if (state._tag === "Running" && Option.isSome(attempt)) {
|
|
73
|
-
|
|
59
|
+
if (Option.contains(live, attempt.value.id)) {
|
|
60
|
+
return {
|
|
61
|
+
_tag: "ReattachAttempt",
|
|
62
|
+
state,
|
|
63
|
+
attempt: attempt.value,
|
|
64
|
+
resume: newestPushedSalvage(current.attempts),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const recovery = failRunningAttempt(state, attempt.value, interruption);
|
|
74
68
|
if (recovery._tag === "RunFailed")
|
|
75
69
|
return recovery;
|
|
76
70
|
interrupted = Option.some(recovery);
|
|
77
71
|
}
|
|
72
|
+
const start = Option.isSome(interrupted)
|
|
73
|
+
? new StartedAfterRestart()
|
|
74
|
+
: Option.getOrElse(requested, () => current.attempts.length === 0 ? new StartedByEvent() : new StartedByInfraRetry());
|
|
78
75
|
return {
|
|
79
76
|
_tag: "StartAttempt",
|
|
80
77
|
state: state._tag === "Running" ? state : RunState.start(state),
|
|
81
78
|
number: AttemptNumber.make((current.attempts.at(-1)?.number ?? 0) + 1),
|
|
79
|
+
start,
|
|
82
80
|
interrupted,
|
|
81
|
+
resume: newestPushedSalvage(current.attempts),
|
|
83
82
|
};
|
|
84
83
|
};
|
|
85
|
-
/**
|
|
86
|
-
* Cancels open work and, if executing, its unfinished Attempt. A Run awaiting
|
|
87
|
-
* capacity may have no Attempt, or only the closed Attempt preceding a retry.
|
|
88
|
-
*/
|
|
84
|
+
/** Returns the cancel decision for an open Run and its open Attempt, if any. */
|
|
89
85
|
export const cancelRun = (current) => {
|
|
90
86
|
if (!RunState.isOpen(current.run.state))
|
|
91
87
|
return { _tag: "AlreadyClosed" };
|
|
@@ -101,22 +97,65 @@ export const cancelRun = (current) => {
|
|
|
101
97
|
};
|
|
102
98
|
};
|
|
103
99
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* after delivery, retrying a Running Run is rejected.
|
|
100
|
+
* Returns the operator retry decision, regardless of the Attempt count. A retry of a running Run
|
|
101
|
+
* with no open Attempt changes nothing; a retry of a running Attempt is rejected.
|
|
107
102
|
*/
|
|
108
|
-
export const retryRun = (
|
|
103
|
+
export const retryRun = (current) => {
|
|
104
|
+
const state = current.run.state;
|
|
109
105
|
if (state._tag === "Failed")
|
|
110
106
|
return { _tag: "Resume", state: RunState.retry(state) };
|
|
111
|
-
if (state._tag === "Running" &&
|
|
107
|
+
if (state._tag === "Running" && Option.isNone(openAttempt(current))) {
|
|
112
108
|
return { _tag: "ResumePending" };
|
|
113
109
|
}
|
|
114
110
|
return { _tag: "RetryRejected" };
|
|
115
111
|
};
|
|
116
112
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
113
|
+
* Returns whether the previous sighting was a non-match or another Event than `eventId`. Returns
|
|
114
|
+
* `false` if the Loop never saw the Item.
|
|
115
|
+
*/
|
|
116
|
+
export const cameBack = (previous, eventId) => Option.match(previous, {
|
|
117
|
+
onNone: () => false,
|
|
118
|
+
onSome: (observed) => !Option.contains(observed, eventId),
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* Returns what a new sighting of the `settled` Event does. The Event reopens only if the Item
|
|
122
|
+
* came back (#267) and its Run was canceled or the queued Event was revoked.
|
|
123
|
+
*/
|
|
124
|
+
export const resightEvent = (settled, itemCameBack) => {
|
|
125
|
+
if (settled._tag === "Owned") {
|
|
126
|
+
return settled.run.state._tag === "Canceled" && itemCameBack
|
|
127
|
+
? { _tag: "ReopenEvent" }
|
|
128
|
+
: { _tag: "JoinRun", run: settled.run };
|
|
129
|
+
}
|
|
130
|
+
return settled.reason === "revoked" && itemCameBack
|
|
131
|
+
? { _tag: "ReopenEvent" }
|
|
132
|
+
: { _tag: "StayIgnored", reason: settled.reason };
|
|
133
|
+
};
|
|
134
|
+
/** Returns the kind of operator stop that fails the Run in `decision`, or `None` (ADR 0017). */
|
|
135
|
+
export const operatorStop = (decision) => {
|
|
136
|
+
if (decision._tag !== "RunFailed")
|
|
137
|
+
return Option.none();
|
|
138
|
+
switch (decision.outcome.failure._tag) {
|
|
139
|
+
case "QuestionFailure":
|
|
140
|
+
return Option.some("question");
|
|
141
|
+
case "BlockedFailure":
|
|
142
|
+
return Option.some("blocker");
|
|
143
|
+
default:
|
|
144
|
+
return Option.none();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Returns what an unclaimed Event does during a suppression. The first Event after the stop,
|
|
149
|
+
* which usually contains the Agent's own comment, becomes the suppressed state (`SuppressFrom`);
|
|
150
|
+
* a different later Event lifts the suppression.
|
|
151
|
+
*/
|
|
152
|
+
export const suppressionDecision = (suppression, eventId) => Option.match(suppression.suppressedEventId, {
|
|
153
|
+
onNone: () => ({ _tag: "SuppressFrom" }),
|
|
154
|
+
onSome: (suppressed) => suppressed === eventId ? { _tag: "Suppress" } : { _tag: "Lift" },
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* Returns what an unclaimed Event does: open a Run, queue behind the Item's running Run, or
|
|
158
|
+
* supersede the Item's unstarted Run (ADR 0007).
|
|
120
159
|
*/
|
|
121
160
|
export const claimRun = (blocking, eventId) => {
|
|
122
161
|
if (Option.isNone(blocking))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/F,OAAO,EAGL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,C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O,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAChE,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;IAChG,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AttemptContext } from "@usine/core/attempt";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
declare const RetryRequest_base: Schema.Class<RetryRequest, Schema.Struct<{
|
|
4
|
+
readonly requestedBy: Schema.Option<Schema.brand<Schema.String, "OperatorLogin">>;
|
|
5
|
+
readonly amendment: Schema.Option<typeof AttemptContext>;
|
|
6
|
+
}>, {}>;
|
|
7
|
+
/**
|
|
8
|
+
* An operator retry of a failed Run. `requestedBy` is `None` if `usine.yaml` sets no operator
|
|
9
|
+
* login, and `amendment` is the edit-and-retry task and Agent (ADR 0018).
|
|
10
|
+
*/
|
|
11
|
+
export declare class RetryRequest extends RetryRequest_base {
|
|
12
|
+
}
|
|
13
|
+
/** A retry without a login that keeps the Run's task and Agent. */
|
|
14
|
+
export declare const plainRetry: RetryRequest;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/engine/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;AAExC;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;AAEL,mEAAmE;AACnE,eAAO,MAAM,UAAU,cAGrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AttemptContext } from "@usine/core/attempt";
|
|
2
|
+
import { OperatorLogin } from "@usine/core/operator";
|
|
3
|
+
import { Option, Schema } from "effect";
|
|
4
|
+
/**
|
|
5
|
+
* An operator retry of a failed Run. `requestedBy` is `None` if `usine.yaml` sets no operator
|
|
6
|
+
* login, and `amendment` is the edit-and-retry task and Agent (ADR 0018).
|
|
7
|
+
*/
|
|
8
|
+
export class RetryRequest extends Schema.Class("@usine/engine/RetryRequest")({
|
|
9
|
+
requestedBy: Schema.Option(OperatorLogin),
|
|
10
|
+
amendment: Schema.Option(AttemptContext),
|
|
11
|
+
}) {
|
|
12
|
+
}
|
|
13
|
+
/** A retry without a login that keeps the Run's task and Agent. */
|
|
14
|
+
export const plainRetry = new RetryRequest({
|
|
15
|
+
requestedBy: Option.none(),
|
|
16
|
+
amendment: Option.none(),
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=retry.js.map
|