@usine/engine 0.2.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 -36
- 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 +16 -9
- package/dist/database/local-sqlite.js.map +1 -1
- package/dist/database/schema.d.ts +581 -22
- package/dist/database/schema.d.ts.map +1 -1
- package/dist/database/schema.js +104 -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 +57 -24
- package/dist/engine/engine.d.ts.map +1 -1
- package/dist/engine/engine.js +144 -120
- package/dist/engine/engine.js.map +1 -1
- package/dist/engine/error.d.ts +36 -9
- package/dist/engine/error.d.ts.map +1 -1
- package/dist/engine/error.js +35 -7
- 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 +65 -9
- 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 +381 -42
- package/dist/store/codec.d.ts.map +1 -1
- package/dist/store/codec.js +59 -15
- 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 +345 -37
- package/dist/store/queries.d.ts.map +1 -1
- package/dist/store/queries.js +333 -160
- 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 +481 -190
- package/dist/store/store.js.map +1 -1
- package/dist/store/transcript.d.ts +9 -0
- package/dist/store/transcript.d.ts.map +1 -0
- package/dist/store/transcript.js +90 -0
- package/dist/store/transcript.js.map +1 -0
- package/dist/transcript.d.ts +41 -20
- package/dist/transcript.d.ts.map +1 -1
- package/dist/transcript.js +45 -25
- 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/20260912111855_operator_intervention/migration.sql +42 -0
- package/drizzle/20260912111855_operator_intervention/snapshot.json +1461 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/database/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/database/schema.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB3B,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYtC,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBtB,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEH,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC"}
|
package/dist/database/schema.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { ModelId } from "@usine/core/agent/brain";
|
|
2
|
+
import { AgentName } from "@usine/core/agent";
|
|
2
3
|
import { AttemptNumber, AttemptTask, AttemptId } from "@usine/core/attempt";
|
|
3
4
|
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
4
5
|
import { DedupKey, EventId } from "@usine/core/event";
|
|
5
6
|
import { ItemKey } from "@usine/core/item";
|
|
6
7
|
import { CycleLimit, CycleBudgetAskId } from "@usine/core/cycle-budget";
|
|
7
|
-
import { LoopName, APPROVAL_REQUIREMENTS } from "@usine/core/loop";
|
|
8
|
+
import { LoopName, APPROVAL_REQUIREMENTS, LOOP_PERMISSIONS, } from "@usine/core/loop";
|
|
9
|
+
import { OperatorLogin } from "@usine/core/operator";
|
|
8
10
|
import { RepositoryName, RepositoryRevision } from "@usine/core/repository";
|
|
9
11
|
import { RunId } from "@usine/core/run";
|
|
12
|
+
import { APPROVAL_CHANNELS } from "@usine/core/run/approval";
|
|
10
13
|
import { StepName } from "@usine/core/step";
|
|
11
14
|
import { WorkerName } from "@usine/core/worker";
|
|
12
15
|
import { sql } from "drizzle-orm";
|
|
13
16
|
import { check, foreignKey, index, integer, primaryKey, snakeCase, text, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
14
17
|
import { IGNORED_REASONS } from "../engine/submission.js";
|
|
15
|
-
import { WORKFLOW_COMMANDS } from "../workflow/command.js";
|
|
16
18
|
export const events = snakeCase.table("usine_events", {
|
|
17
19
|
eventId: text().$type().primaryKey(),
|
|
18
20
|
dedupKey: text().$type().notNull().unique(),
|
|
@@ -28,24 +30,52 @@ export const triggerEvents = snakeCase.table("usine_trigger_events", {
|
|
|
28
30
|
loopName: text().$type().notNull(),
|
|
29
31
|
stepName: text().$type().notNull(),
|
|
30
32
|
approval: text({ enum: APPROVAL_REQUIREMENTS }).$type().notNull(),
|
|
33
|
+
// The Loop's permissions at match time, used by every Attempt of the Run.
|
|
34
|
+
permissions: text({ enum: LOOP_PERMISSIONS })
|
|
35
|
+
.$type()
|
|
36
|
+
.notNull()
|
|
37
|
+
.default("write"),
|
|
31
38
|
cycleLimit: integer().$type(),
|
|
32
|
-
// Item
|
|
39
|
+
// The Item's cycle generation, read before fetching the trigger input.
|
|
33
40
|
cycleGeneration: integer().notNull().default(0),
|
|
34
|
-
// The execution context
|
|
35
|
-
//
|
|
36
|
-
// the Run's own copy below.
|
|
41
|
+
// The submitted execution context, never updated. A queued Event is claimed from these
|
|
42
|
+
// columns; execution reads the Run's copy.
|
|
37
43
|
repository: text().$type().notNull(),
|
|
38
44
|
revision: text().$type().notNull(),
|
|
39
45
|
task: text().$type().notNull(),
|
|
40
46
|
agentJson: text({ mode: "json" }).$type().notNull(),
|
|
41
47
|
parentModel: text().$type(),
|
|
48
|
+
// The Event that this one reopens after its Run was canceled (#267).
|
|
49
|
+
reopensEventId: text()
|
|
50
|
+
.$type()
|
|
51
|
+
.references(() => events.eventId),
|
|
52
|
+
reopening: integer().notNull().default(0),
|
|
42
53
|
}, (table) => [
|
|
43
54
|
check("usine_trigger_events_approval", sql `${table.approval} in ('none', 'required')`),
|
|
44
55
|
check("usine_trigger_events_cycle_limit", sql `${table.cycleLimit} is null or ${table.cycleLimit} >= 1`),
|
|
45
56
|
check("usine_trigger_events_agent_json_valid", sql `json_valid(${table.agentJson})`),
|
|
46
57
|
index("usine_trigger_events_item").on(table.loopName, table.itemKey),
|
|
47
58
|
index("usine_trigger_events_item_history").on(table.itemKey),
|
|
59
|
+
uniqueIndex("usine_trigger_event_reopening").on(table.reopensEventId, table.reopening),
|
|
48
60
|
]);
|
|
61
|
+
/**
|
|
62
|
+
* The Event a trigger last submitted for each Loop and Item, or `null` after a non-matching
|
|
63
|
+
* sighting. After an Attempt stops with a question or blocker, `suppressedByRunId` is its Run and
|
|
64
|
+
* `suppressedEventId` is the Item's state after the stop, which opens no Run (#241, #341).
|
|
65
|
+
*/
|
|
66
|
+
export const loopItems = snakeCase.table("usine_loop_items", {
|
|
67
|
+
loopName: text().$type().notNull(),
|
|
68
|
+
itemKey: text().$type().notNull(),
|
|
69
|
+
observedEventId: text()
|
|
70
|
+
.$type()
|
|
71
|
+
.references(() => events.eventId),
|
|
72
|
+
suppressedByRunId: text()
|
|
73
|
+
.$type()
|
|
74
|
+
.references(() => runs.runId),
|
|
75
|
+
suppressedEventId: text()
|
|
76
|
+
.$type()
|
|
77
|
+
.references(() => events.eventId),
|
|
78
|
+
}, (table) => [primaryKey({ columns: [table.loopName, table.itemKey] })]);
|
|
49
79
|
export const itemCycleBudgets = snakeCase.table("usine_item_cycle_budgets", {
|
|
50
80
|
itemKey: text().$type().primaryKey(),
|
|
51
81
|
repository: text().$type().notNull(),
|
|
@@ -92,14 +122,22 @@ export const runs = snakeCase.table("usine_runs", {
|
|
|
92
122
|
.references(() => triggerEvents.eventId),
|
|
93
123
|
loopName: text().$type().notNull(),
|
|
94
124
|
stateJson: text({ mode: "json" }).$type().notNull(),
|
|
125
|
+
resolvedFailureAttemptId: text().$type(),
|
|
95
126
|
openedAt: text().notNull(),
|
|
96
|
-
|
|
97
|
-
|
|
127
|
+
/**
|
|
128
|
+
* The time the Run last closed, or `null` while open; a retry clears it. Older closed Runs
|
|
129
|
+
* have their last Attempt's end time.
|
|
130
|
+
*/
|
|
131
|
+
closedAt: text(),
|
|
132
|
+
// The Run's effective context, copied from the claiming submission. Edit-and-retry updates
|
|
133
|
+
// these columns; the Event's columns never change (ADR 0018).
|
|
98
134
|
repository: text().$type().notNull(),
|
|
99
135
|
revision: text().$type().notNull(),
|
|
100
136
|
task: text().$type().notNull(),
|
|
101
137
|
agentJson: text({ mode: "json" }).$type().notNull(),
|
|
102
138
|
parentModel: text().$type(),
|
|
139
|
+
/** The operator retry for the Run's next Attempt; cleared when that Attempt starts. */
|
|
140
|
+
nextStartJson: text({ mode: "json" }).$type(),
|
|
103
141
|
}, (table) => [
|
|
104
142
|
check("usine_runs_state_json_valid", sql `json_valid(${table.stateJson})`),
|
|
105
143
|
check("usine_runs_agent_json_valid", sql `json_valid(${table.agentJson})`),
|
|
@@ -122,13 +160,28 @@ export const attempts = snakeCase.table("usine_attempts", {
|
|
|
122
160
|
workerName: text().$type().notNull(),
|
|
123
161
|
attemptNumber: integer({ mode: "number" }).$type().notNull(),
|
|
124
162
|
brainJson: text({ mode: "json" }).$type().notNull(),
|
|
163
|
+
task: text().$type().notNull(),
|
|
164
|
+
agent: text().$type().notNull(),
|
|
165
|
+
operatorIntervened: integer({ mode: "boolean" }).notNull().default(false),
|
|
125
166
|
parentModel: text().$type(),
|
|
126
167
|
startedAt: text().notNull(),
|
|
127
168
|
outcomeJson: text({ mode: "json" }).$type(),
|
|
169
|
+
/** The time the outcome was recorded; `null` while running and for older Attempts. */
|
|
170
|
+
endedAt: text(),
|
|
171
|
+
salvageJson: text({ mode: "json" }).$type(),
|
|
172
|
+
/** The time the operator discarded the Attempt's leftovers on a removed Worker; startup reconciliation then skips it. */
|
|
173
|
+
leftoversDiscardedAt: text(),
|
|
174
|
+
/** The reason the Attempt started; `null` for older Attempts. */
|
|
175
|
+
startJson: text({ mode: "json" }).$type(),
|
|
176
|
+
/** The last time an orchestrator restart reattached the Attempt, or `null`. */
|
|
177
|
+
reattachedAt: text(),
|
|
178
|
+
/** The comments and reviews posted by an unsuccessful Attempt, or `null` if none were recorded. */
|
|
179
|
+
commentsJson: text({ mode: "json" }).$type(),
|
|
128
180
|
}, (table) => [
|
|
129
181
|
check("usine_attempts_number", sql `${table.attemptNumber} >= 1`),
|
|
130
182
|
check("usine_attempts_brain_json_valid", sql `json_valid(${table.brainJson})`),
|
|
131
183
|
check("usine_attempts_outcome_json_valid", sql `${table.outcomeJson} is null or json_valid(${table.outcomeJson})`),
|
|
184
|
+
check("usine_attempts_salvage_json_valid", sql `${table.salvageJson} is null or json_valid(${table.salvageJson})`),
|
|
132
185
|
uniqueIndex("usine_attempt_number").on(table.runId, table.stepName, table.attemptNumber),
|
|
133
186
|
uniqueIndex("usine_one_in_flight_attempt")
|
|
134
187
|
.on(table.runId)
|
|
@@ -155,6 +208,10 @@ export const attemptTranscripts = snakeCase.table("usine_attempt_transcripts", {
|
|
|
155
208
|
uniqueIndex("usine_attempt_transcript_envelope").on(table.attemptId, table.direction, table.channelSequence),
|
|
156
209
|
index("usine_attempt_transcript_tail").on(table.attemptId, table.sequence),
|
|
157
210
|
]);
|
|
211
|
+
/**
|
|
212
|
+
* The approval Event each approved Run consumed, with its source. Older rows have no `channel`
|
|
213
|
+
* or `approver`; a UI approval without a configured operator login has no `approver`.
|
|
214
|
+
*/
|
|
158
215
|
export const approvals = snakeCase.table("usine_approvals", {
|
|
159
216
|
runId: text()
|
|
160
217
|
.$type()
|
|
@@ -165,6 +222,25 @@ export const approvals = snakeCase.table("usine_approvals", {
|
|
|
165
222
|
.notNull()
|
|
166
223
|
.unique()
|
|
167
224
|
.references(() => events.eventId),
|
|
225
|
+
channel: text({ enum: APPROVAL_CHANNELS }).$type(),
|
|
226
|
+
approver: text().$type(),
|
|
227
|
+
}, (table) => [
|
|
228
|
+
check("usine_approvals_source", sql `(${table.channel} is null and ${table.approver} is null) or ${table.channel} = 'ui' or (${table.channel} = 'github-ask' and ${table.approver} is not null)`),
|
|
229
|
+
]);
|
|
230
|
+
/**
|
|
231
|
+
* The Events recorded by running a closed Run again (#152), with the original Run and the
|
|
232
|
+
* requesting login, which is `null` if `usine.yaml` sets no operator login.
|
|
233
|
+
*/
|
|
234
|
+
export const runAgainEvents = snakeCase.table("usine_run_again_events", {
|
|
235
|
+
eventId: text()
|
|
236
|
+
.$type()
|
|
237
|
+
.primaryKey()
|
|
238
|
+
.references(() => triggerEvents.eventId),
|
|
239
|
+
fromRunId: text()
|
|
240
|
+
.$type()
|
|
241
|
+
.notNull()
|
|
242
|
+
.references(() => runs.runId),
|
|
243
|
+
requestedBy: text().$type(),
|
|
168
244
|
});
|
|
169
245
|
export const ignoredEvents = snakeCase.table("usine_ignored_events", {
|
|
170
246
|
eventId: text()
|
|
@@ -175,22 +251,12 @@ export const ignoredEvents = snakeCase.table("usine_ignored_events", {
|
|
|
175
251
|
}, (table) => [
|
|
176
252
|
check("usine_ignored_events_reason", sql `${table.reason} in ('superseded', 'revoked')`),
|
|
177
253
|
]);
|
|
178
|
-
|
|
179
|
-
runId: text()
|
|
180
|
-
.$type()
|
|
181
|
-
.notNull()
|
|
182
|
-
.references(() => runs.runId),
|
|
183
|
-
command: text({ enum: WORKFLOW_COMMANDS }).$type().notNull(),
|
|
184
|
-
}, (table) => [
|
|
185
|
-
check("usine_workflow_commands_command", sql `${table.command} in ('Approve', 'Continue', 'Interrupt', 'Resume')`),
|
|
186
|
-
primaryKey({ columns: [table.runId, table.command] }),
|
|
187
|
-
]);
|
|
188
|
-
/** Cursors that only save work; each owner validates its own value. */
|
|
254
|
+
/** Cursors whose loss only repeats work; each owner validates its value. */
|
|
189
255
|
export const cursors = snakeCase.table("usine_cursors", {
|
|
190
256
|
cursorKey: text().primaryKey(),
|
|
191
257
|
valueJson: text({ mode: "json" }).$type().notNull(),
|
|
192
258
|
}, (table) => [check("usine_cursors_value_json_valid", sql `json_valid(${table.valueJson})`)]);
|
|
193
|
-
/** The latest payload
|
|
259
|
+
/** The latest payload of each Item, and the time a poll found it missing on GitHub. */
|
|
194
260
|
export const itemProjections = snakeCase.table("usine_item_projections", {
|
|
195
261
|
itemKey: text().$type().primaryKey(),
|
|
196
262
|
repository: text().$type().notNull(),
|
|
@@ -198,11 +264,11 @@ export const itemProjections = snakeCase.table("usine_item_projections", {
|
|
|
198
264
|
itemNumber: integer({ mode: "number" }).notNull(),
|
|
199
265
|
contentHash: text().notNull(),
|
|
200
266
|
payloadJson: text({ mode: "json" }).$type().notNull(),
|
|
267
|
+
goneAt: text(),
|
|
201
268
|
}, (table) => [
|
|
202
269
|
check("usine_item_projections_number", sql `${table.itemNumber} >= 1`),
|
|
203
270
|
check("usine_item_projections_payload_json_valid", sql `json_valid(${table.payloadJson})`),
|
|
204
271
|
uniqueIndex("usine_item_projection_number").on(table.repository, table.itemNumber),
|
|
205
|
-
index("usine_item_projection_repository").on(table.repository, table.itemNumber),
|
|
206
272
|
]);
|
|
207
273
|
/** The latest complete label catalog for each managed repository. */
|
|
208
274
|
export const repositoryLabelProjections = snakeCase.table("usine_repository_label_projections", {
|
|
@@ -211,12 +277,27 @@ export const repositoryLabelProjections = snakeCase.table("usine_repository_labe
|
|
|
211
277
|
}, (table) => [
|
|
212
278
|
check("usine_repository_label_projections_labels_json_valid", sql `json_valid(${table.labelsJson})`),
|
|
213
279
|
]);
|
|
214
|
-
/**
|
|
280
|
+
/** The label changes of operator Board moves, each recorded before it's sent to GitHub. */
|
|
281
|
+
export const boardMoves = snakeCase.table("usine_board_moves", {
|
|
282
|
+
moveId: integer({ mode: "number" }).primaryKey({ autoIncrement: true }),
|
|
283
|
+
repository: text().$type().notNull(),
|
|
284
|
+
itemKey: text().$type().notNull(),
|
|
285
|
+
movedAt: text().notNull(),
|
|
286
|
+
fromLane: text().notNull(),
|
|
287
|
+
toLane: text().notNull(),
|
|
288
|
+
addedJson: text({ mode: "json" }).$type().notNull(),
|
|
289
|
+
removedJson: text({ mode: "json" }).$type().notNull(),
|
|
290
|
+
}, (table) => [
|
|
291
|
+
check("usine_board_moves_added_json_valid", sql `json_valid(${table.addedJson})`),
|
|
292
|
+
check("usine_board_moves_removed_json_valid", sql `json_valid(${table.removedJson})`),
|
|
293
|
+
index("usine_board_moves_item").on(table.itemKey, table.movedAt),
|
|
294
|
+
]);
|
|
295
|
+
/** Operator runtime toggles, separate from Loop files (ADR 0009). */
|
|
215
296
|
export const loopRuntime = snakeCase.table("usine_loop_runtime", {
|
|
216
297
|
loopName: text().$type().primaryKey(),
|
|
217
298
|
paused: integer({ mode: "boolean" }).notNull(),
|
|
218
299
|
});
|
|
219
|
-
/**
|
|
300
|
+
/** A single row whose version invalidates cached operator projections. */
|
|
220
301
|
export const projectionRevision = snakeCase.table("usine_projection_revision", {
|
|
221
302
|
singleton: integer({ mode: "number" }).primaryKey().default(1),
|
|
222
303
|
revision: integer({ mode: "number" }).notNull().default(0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/database/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAA4B,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E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CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;CACjE,CACF,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,oBAAoB,EAAE;IAC/D,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAY,CAAC,UAAU,EAAE;IAC/C,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CAC/C,CAAC,CAAC;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAC/C,2BAA2B,EAC3B;IACE,SAAS,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3D,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAA,GAAG,KAAK,CAAC,SAAS,MAAM,CAAC,CAAC,CACvF,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { RunId } from "@usine/core/run";
|
|
2
2
|
import { Context, Effect, Layer } from "effect";
|
|
3
3
|
declare const AttemptAdmission_base: Context.ServiceClass<AttemptAdmission, "@usine/engine/AttemptAdmission", {
|
|
4
|
-
/**
|
|
4
|
+
/** Runs `attempt` and tracks it until its outcome is persisted. If admission is closed, waits for runtime teardown. */
|
|
5
5
|
readonly withAttempt: <A, E, R>(runId: RunId, attempt: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
6
6
|
readonly drain: () => Effect.Effect<void>;
|
|
7
7
|
}>;
|
|
8
|
-
/**
|
|
8
|
+
/** The process-local gate for starting Attempts; closing it leaves durable Runs recoverable (ADR 0023). */
|
|
9
9
|
export declare class AttemptAdmission extends AttemptAdmission_base {
|
|
10
10
|
static readonly layer: Layer.Layer<AttemptAdmission, never, never>;
|
|
11
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admission.d.ts","sourceRoot":"","sources":["../../src/engine/admission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAY,MAAM,EAAE,KAAK,EAAe,MAAM,QAAQ,CAAC;;IAOnE,uHAAuH;0BACjG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC5B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;oBACX,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;AAT7C,2GAA2G;AAC3G,qBAAa,gBAAiB,SAAQ,qBAUD;IACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,8CAkEnB;CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Deferred, Effect, Layer, Option, Ref } from "effect";
|
|
2
|
-
import { RunEngineShutdown } from "
|
|
3
|
-
/**
|
|
2
|
+
import { RunEngineShutdown } from "./shutdown.js";
|
|
3
|
+
/** The process-local gate for starting Attempts; closing it leaves durable Runs recoverable (ADR 0023). */
|
|
4
4
|
export class AttemptAdmission extends Context.Service()("@usine/engine/AttemptAdmission") {
|
|
5
5
|
static layer = Layer.effect(AttemptAdmission, Effect.gen(function* () {
|
|
6
6
|
const hostShutdown = yield* Effect.serviceOption(RunEngineShutdown);
|
|
@@ -11,8 +11,8 @@ export class AttemptAdmission extends Context.Service()("@usine/engine/AttemptAd
|
|
|
11
11
|
const empty = yield* Deferred.make();
|
|
12
12
|
const enter = Effect.fn("AttemptAdmission.enter")(function* (runId) {
|
|
13
13
|
yield* Effect.annotateCurrentSpan({ runId });
|
|
14
|
-
// The host completes the
|
|
15
|
-
//
|
|
14
|
+
// The host completes the latch synchronously on a signal, so the check and the set update
|
|
15
|
+
// are in one atomic `Ref.modify`.
|
|
16
16
|
const admitted = yield* Ref.modify(active, (current) => Deferred.isDoneUnsafe(shutdown)
|
|
17
17
|
? [false, current]
|
|
18
18
|
: [true, new Set([...current, runId])]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admission.js","sourceRoot":"","sources":["../../src/engine/admission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,2GAA2G;AAC3G,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO,EAUlD,CAAC,gCAAgC,CAAC;IACnC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAClC,gBAAgB,EAChB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;YAC1C,CAAC,CAAC,YAAY,CAAC,KAAK;YACpB,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAQ,CAAC;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAqB,IAAI,GAAG,EAAE,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAQ,CAAC;QAE3C,M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AAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAClE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC,CAAC,CACH,CAAC;CACH"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AttemptId } from "@usine/core/attempt";
|
|
2
|
+
import type { AttemptRecovery } from "@usine/core/attempt/salvage";
|
|
3
|
+
import { Effect, Option, Result, Schema } from "effect";
|
|
4
|
+
import type { WorkerLease } from "../step-executor.ts";
|
|
5
|
+
declare const ParentStopUnconfirmedError_base: Schema.Class<ParentStopUnconfirmedError, Schema.TaggedStruct<"ParentStopUnconfirmedError", {
|
|
6
|
+
readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
|
|
7
|
+
readonly cause: Schema.Defect;
|
|
8
|
+
}>, import("effect/Cause").YieldableError>;
|
|
9
|
+
/**
|
|
10
|
+
* An error for an Attempt whose parent task couldn't be confirmed stopped. Its checkout and
|
|
11
|
+
* Worker slot stay kept, and the Run's next Attempt doesn't start.
|
|
12
|
+
*/
|
|
13
|
+
declare class ParentStopUnconfirmedError extends ParentStopUnconfirmedError_base {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates the checkout recovery steps that `RunDriver` uses at startup and on reattach.
|
|
17
|
+
*
|
|
18
|
+
* `atStartup` reconciles the checkouts left on Workers through `StepExecutor.recover`. It keeps
|
|
19
|
+
* the checkout, and occupies a Worker slot through `StepExecutor.occupy` (#177), for an open
|
|
20
|
+
* Attempt whose parent task is live or unreadable and for a closed Attempt whose parent task
|
|
21
|
+
* isn't confirmed stopped. `acquired` hands a kept checkout and slot to the reattaching
|
|
22
|
+
* execution. `reconcile` reconciles a kept checkout that the Run closes without that hand-off
|
|
23
|
+
* (#180), and releases the slot once the parent task is confirmed stopped.
|
|
24
|
+
*/
|
|
25
|
+
export declare const checkoutRecoveryFor: (store: {
|
|
26
|
+
readonly approve: (runId: import("@usine/core/run").RunId, approval: import("@usine/core/event").Event, source: import("@usine/core/run/approval").ApprovalSource) => Effect.Effect<boolean, import("./error.ts").RunStoreError>;
|
|
27
|
+
readonly appendTranscript: (direction: import("@usine/core/attempt/channel").Direction, envelope: import("@usine/core/attempt/channel").Envelope) => Effect.Effect<void, import("./error.ts").RunStoreError>;
|
|
28
|
+
readonly beginAttempt: (runId: import("@usine/core/run").RunId, worker: import("@usine/core/worker").WorkerName, live: Option.Option<AttemptId>) => Effect.Effect<import("../store/store.ts").AttemptStarted | import("../store/store.ts").AttemptRecoveryFailed | import("../store/store.ts").RunClosed, import("./error.ts").RunStoreError>;
|
|
29
|
+
readonly cancel: (runId: import("@usine/core/run").RunId) => Effect.Effect<import("../store/store.ts").CancelOutcome, import("./error.ts").RunStoreError>;
|
|
30
|
+
readonly claimQueued: (submission: import("./submission.ts").Submission, runId: import("@usine/core/run").RunId) => Effect.Effect<Option.Option<import("@usine/core/run").RunId>, import("./error.ts").RunStoreError>;
|
|
31
|
+
readonly finishAttempt: (attempt: import("@usine/core/attempt").Attempt, result: Result.Result<import("@usine/core/step/result").StepResult, import("@usine/core/attempt/failure").AttemptFailure>) => Effect.Effect<import("./lifecycle.ts").FinishDecision, import("./error.ts").RunStoreError>;
|
|
32
|
+
readonly nextQueued: (runId: import("@usine/core/run").RunId) => Effect.Effect<Option.Option<import("../store/queries.ts").QueuedEvents>, import("./error.ts").RunStoreError>;
|
|
33
|
+
readonly parkForApproval: (runId: import("@usine/core/run").RunId) => Effect.Effect<import("@usine/core/run/state").RunState, import("./error.ts").RunStoreError>;
|
|
34
|
+
readonly pendingContinuations: Effect.Effect<ReadonlyArray<import("@usine/core/run").RunId>, import("./error.ts").RunStoreError>;
|
|
35
|
+
readonly runIdsToDrive: Effect.Effect<ReadonlyArray<import("@usine/core/run").RunId>, import("./error.ts").RunStoreError>;
|
|
36
|
+
readonly recordAndClaim: (submission: import("./submission.ts").Submission, requestedRunId: import("@usine/core/run").RunId) => Effect.Effect<import("../store/store.ts").Claim, import("./error.ts").RunStoreError>;
|
|
37
|
+
readonly recordSalvage: (attemptId: AttemptId, salvage: import("@usine/core/attempt/salvage").AttemptSalvage) => Effect.Effect<void, import("./error.ts").RunStoreError>;
|
|
38
|
+
readonly recordComments: (attemptId: AttemptId, comments: ReadonlyArray<import("@usine/core/step/result").Comment>) => Effect.Effect<void, import("./error.ts").RunStoreError>;
|
|
39
|
+
readonly attemptWindows: (attemptId: AttemptId) => Effect.Effect<import("@usine/core/attempt").AttemptWindows, import("./error.ts").RunStoreError>;
|
|
40
|
+
readonly salvageCandidates: Effect.Effect<ReadonlyArray<AttemptRecovery>, import("./error.ts").RunStoreError>;
|
|
41
|
+
readonly salvageCandidate: (attemptId: AttemptId) => Effect.Effect<Option.Option<AttemptRecovery>, import("./error.ts").RunStoreError>;
|
|
42
|
+
readonly discardLeftovers: (worker: import("@usine/core/worker").WorkerName) => Effect.Effect<number, import("./error.ts").RunStoreError>;
|
|
43
|
+
readonly openAttempts: (worker: import("@usine/core/worker").WorkerName) => Effect.Effect<number, import("./error.ts").RunStoreError>;
|
|
44
|
+
readonly resolveFailure: (runId: import("@usine/core/run").RunId, attemptId: AttemptId) => Effect.Effect<boolean, import("./error.ts").RunStoreError>;
|
|
45
|
+
readonly retry: (runId: import("@usine/core/run").RunId, request?: import("./retry.ts").RetryRequest) => Effect.Effect<boolean, import("./error.ts").RunStoreError>;
|
|
46
|
+
readonly runAgain: (runId: import("@usine/core/run").RunId, request: import("./run-again.ts").RunAgainRequest) => Effect.Effect<import("./run-again.ts").RunAgainResult, import("./error.ts").RunStoreError>;
|
|
47
|
+
readonly revoke: (loop: import("@usine/core/loop").LoopName, itemKey: import("@usine/core/item").ItemKey) => Effect.Effect<ReadonlyArray<import("@usine/core/run").RunId>, import("./error.ts").RunStoreError>;
|
|
48
|
+
readonly revokeQueued: (queued: import("../store/queries.ts").QueuedEvents) => Effect.Effect<number, import("./error.ts").RunStoreError>;
|
|
49
|
+
readonly snapshot: (runId: import("@usine/core/run").RunId) => Effect.Effect<import("../run-reader/model.ts").RunSnapshot, import("./error.ts").RunStoreError>;
|
|
50
|
+
readonly submission: (runId: import("@usine/core/run").RunId) => Effect.Effect<import("./submission.ts").Submission, import("./error.ts").RunStoreError>;
|
|
51
|
+
readonly transcript: (query: import("../transcript.ts").TranscriptQuery) => Effect.Effect<ReadonlyArray<import("../transcript.ts").TranscriptEntry>, import("./error.ts").RunStoreError>;
|
|
52
|
+
}, executor: {
|
|
53
|
+
readonly workers: Effect.Effect<ReadonlyArray<import("@usine/core/worker").WorkerName>>;
|
|
54
|
+
readonly isLive: (attemptId: AttemptId) => Effect.Effect<boolean, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
55
|
+
readonly outcome: (attemptId: AttemptId) => Effect.Effect<Option.Option<Result.Result<import("@usine/core/step/result").StepResult, import("@usine/core/attempt/failure").AttemptFailure>>, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
56
|
+
readonly recover: <E>(attempt: AttemptRecovery, record: import("@usine/core/attempt/salvage").RecoverySink<E>) => Effect.Effect<void, E | import("@usine/core/attempt/failure").AttemptFailure>;
|
|
57
|
+
readonly interrupt: (attemptId: AttemptId) => Effect.Effect<void, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
58
|
+
readonly intervene: (attemptId: AttemptId, intervention: import("@usine/core/attempt/channel").Intervention) => Effect.Effect<void, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
59
|
+
readonly reserve: (submission: import("./submission.ts").Submission, worker: Option.Option<import("@usine/core/worker").WorkerName>) => Effect.Effect<WorkerLease, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
60
|
+
readonly occupy: (worker: import("@usine/core/worker").WorkerName) => Effect.Effect<WorkerLease>;
|
|
61
|
+
readonly execute: (execution: import("../step-executor.ts").StepExecution, io: import("../step-executor.ts").ExecutionSink) => Effect.Effect<import("@usine/core/step/result").StepResult, import("@usine/core/attempt/failure").AttemptFailure>;
|
|
62
|
+
}) => Effect.Effect<{
|
|
63
|
+
readonly atStartup: () => Effect.Effect<(string & import("effect/Brand").Brand<"AttemptId">)[], import("./error.ts").EnginePersistenceError | import("./error.ts").RunNotFoundError | import("./error.ts").RunOperationRejectedError | import("./error.ts").RunRetryBlockedError, never>;
|
|
64
|
+
readonly reattachSlot: (attemptId: string & import("effect/Brand").Brand<"AttemptId">) => Effect.Effect<Option.Option<WorkerLease>, never, never>;
|
|
65
|
+
readonly acquired: (attemptId: string & import("effect/Brand").Brand<"AttemptId">) => Effect.Effect<void, never, never>;
|
|
66
|
+
readonly reconcile: (attemptId: string & import("effect/Brand").Brand<"AttemptId">) => Effect.Effect<void, ParentStopUnconfirmedError, never>;
|
|
67
|
+
}, never, never>;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=checkout-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-recovery.d.ts","sourceRoot":"","sources":["../../src/engine/checkout-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAwB,MAAM,EAAE,MAAM,EAAO,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACnF,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,qBAAqB,CAAC;;;;;AAGrE;;;GAGG;AACH,cAAM,0BAA2B,SAAQ,+BAKvC;CAAG;AAWL;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyO9B,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { AttemptId } from "@usine/core/attempt";
|
|
2
|
+
import { Array as EffectArray, Effect, Option, Ref, Result, Schema } from "effect";
|
|
3
|
+
/**
|
|
4
|
+
* An error for an Attempt whose parent task couldn't be confirmed stopped. Its checkout and
|
|
5
|
+
* Worker slot stay kept, and the Run's next Attempt doesn't start.
|
|
6
|
+
*/
|
|
7
|
+
class ParentStopUnconfirmedError extends Schema.TaggedError("@usine/engine/internal/ParentStopUnconfirmedError")("ParentStopUnconfirmedError", {
|
|
8
|
+
attemptId: AttemptId,
|
|
9
|
+
cause: Schema.Defect(),
|
|
10
|
+
}) {
|
|
11
|
+
}
|
|
12
|
+
const without = (leases, attemptId) => {
|
|
13
|
+
const remaining = new Map(leases);
|
|
14
|
+
remaining.delete(attemptId);
|
|
15
|
+
return remaining;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates the checkout recovery steps that `RunDriver` uses at startup and on reattach.
|
|
19
|
+
*
|
|
20
|
+
* `atStartup` reconciles the checkouts left on Workers through `StepExecutor.recover`. It keeps
|
|
21
|
+
* the checkout, and occupies a Worker slot through `StepExecutor.occupy` (#177), for an open
|
|
22
|
+
* Attempt whose parent task is live or unreadable and for a closed Attempt whose parent task
|
|
23
|
+
* isn't confirmed stopped. `acquired` hands a kept checkout and slot to the reattaching
|
|
24
|
+
* execution. `reconcile` reconciles a kept checkout that the Run closes without that hand-off
|
|
25
|
+
* (#180), and releases the slot once the parent task is confirmed stopped.
|
|
26
|
+
*/
|
|
27
|
+
export const checkoutRecoveryFor = Effect.fn("CheckoutRecovery.for")(function* (store, executor) {
|
|
28
|
+
// The checkouts kept at startup, by Attempt, with their occupied slots.
|
|
29
|
+
const kept = yield* Ref.make(new Map());
|
|
30
|
+
/** Reconciles `attempt`'s checkout. On failure, logs an error and leaves the checkout on its Worker. */
|
|
31
|
+
const recover = (attempt) => executor
|
|
32
|
+
.recover(attempt, {
|
|
33
|
+
salvage: (salvage) => store.recordSalvage(attempt.attemptId, salvage),
|
|
34
|
+
comments: (comments) => store.recordComments(attempt.attemptId, comments),
|
|
35
|
+
windows: store.attemptWindows(attempt.attemptId),
|
|
36
|
+
})
|
|
37
|
+
.pipe(Effect.tapError((error) => Effect.logError("Attempt salvage reconciliation failed; work retained", {
|
|
38
|
+
attemptId: attempt.attemptId,
|
|
39
|
+
worker: attempt.worker,
|
|
40
|
+
message: String(error),
|
|
41
|
+
})), Effect.ignore);
|
|
42
|
+
/**
|
|
43
|
+
* Keeps `attempt`'s checkout and occupies a slot on its Worker, recording the lease in the same
|
|
44
|
+
* uninterruptible step. The lease's `release` frees the slot at most once.
|
|
45
|
+
*/
|
|
46
|
+
const keep = Effect.fn("CheckoutRecovery.keep")(function* (attempt) {
|
|
47
|
+
yield* executor.occupy(attempt.worker).pipe(Effect.flatMap((lease) => Effect.cached(lease.release).pipe(Effect.map((release) => ({ worker: lease.worker, release })))), Effect.flatMap((lease) => Ref.update(kept, (leases) => new Map(leases).set(attempt.attemptId, lease))), Effect.uninterruptible);
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Keeps the checkout and a slot for an open Attempt whose parent task is live or whose liveness
|
|
51
|
+
* can't be read. Otherwise reconciles the checkout.
|
|
52
|
+
*/
|
|
53
|
+
const recoverOpen = Effect.fn("CheckoutRecovery.recoverOpen")(function* (attempt) {
|
|
54
|
+
const fields = { attemptId: attempt.attemptId, worker: attempt.worker };
|
|
55
|
+
yield* Effect.annotateCurrentSpan(fields);
|
|
56
|
+
const live = yield* executor.isLive(attempt.attemptId).pipe(Effect.result);
|
|
57
|
+
if (Result.isSuccess(live) && !live.success)
|
|
58
|
+
return yield* recover(attempt);
|
|
59
|
+
if (Result.isFailure(live))
|
|
60
|
+
yield* Effect.logWarning("Could not read whether an open Attempt's parent task is live; its checkout stays for its Run to decide", { ...fields, errorTag: live.failure._tag, message: live.failure.message });
|
|
61
|
+
else
|
|
62
|
+
yield* Effect.logInfo("Leaving the checkout of an open Attempt whose parent task is live for its Run to reattach", fields);
|
|
63
|
+
yield* keep(attempt);
|
|
64
|
+
yield* Effect.logInfo("Occupied a slot on the Worker of an open Attempt kept for its Run to reattach", fields);
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Reconciles a closed Attempt's checkout if its parent task is confirmed stopped. Otherwise
|
|
68
|
+
* keeps the checkout and a slot, and returns the Attempt ID (#177).
|
|
69
|
+
*/
|
|
70
|
+
const recoverClosed = Effect.fn("CheckoutRecovery.recoverClosed")(function* (attempt) {
|
|
71
|
+
const fields = { attemptId: attempt.attemptId, worker: attempt.worker };
|
|
72
|
+
yield* Effect.annotateCurrentSpan(fields);
|
|
73
|
+
// `recover` also stops the task, but its failure doesn't distinguish an unconfirmed stop from
|
|
74
|
+
// a failed salvage.
|
|
75
|
+
const stopped = yield* executor.interrupt(attempt.attemptId).pipe(Effect.result);
|
|
76
|
+
if (Result.isSuccess(stopped)) {
|
|
77
|
+
yield* recover(attempt);
|
|
78
|
+
return Option.none();
|
|
79
|
+
}
|
|
80
|
+
yield* Effect.logWarning("Could not confirm that the parent task of a closed Attempt stopped; its checkout and a slot of its Worker stay kept until a reconcile confirms the stop", { ...fields, errorTag: stopped.failure._tag, message: stopped.failure.message });
|
|
81
|
+
yield* keep(attempt);
|
|
82
|
+
return Option.some(attempt.attemptId);
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* Reconciles every persisted Attempt on a configured Worker. Returns the closed Attempts whose
|
|
86
|
+
* parent task isn't confirmed stopped.
|
|
87
|
+
*/
|
|
88
|
+
const atStartup = Effect.fn("CheckoutRecovery.atStartup")(function* () {
|
|
89
|
+
const configured = new Set(yield* executor.workers);
|
|
90
|
+
const candidates = yield* store.salvageCandidates;
|
|
91
|
+
const reconcilable = candidates.filter(({ worker }) => configured.has(worker));
|
|
92
|
+
const unconfigured = candidates.filter(({ worker }) => !configured.has(worker));
|
|
93
|
+
if (unconfigured.length > 0) {
|
|
94
|
+
yield* Effect.logWarning("Attempts recorded on Workers that are not configured were not reconciled; their checkouts stay until those Workers are configured again or their leftovers are discarded", {
|
|
95
|
+
attempts: unconfigured.length,
|
|
96
|
+
workers: [...new Set(unconfigured.map(({ worker }) => worker))].sort().join(","),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// Runs before Run recovery, so a retry starts only after the previous Attempt's work is
|
|
100
|
+
// recorded. A failed recovery leaves the checkout on disk.
|
|
101
|
+
const unstopped = yield* Effect.forEach(reconcilable, (attempt) => attempt.open
|
|
102
|
+
? recoverOpen(attempt).pipe(Effect.as(Option.none()))
|
|
103
|
+
: recoverClosed(attempt));
|
|
104
|
+
return EffectArray.getSomes(unstopped);
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* Returns the slot that startup occupied for `attemptId`, or `None`. Until the execution
|
|
108
|
+
* acquires the checkout, the slot's `release` does nothing; `reconcile` frees it.
|
|
109
|
+
*/
|
|
110
|
+
const reattachSlot = Effect.fn("CheckoutRecovery.reattachSlot")(function* (attemptId) {
|
|
111
|
+
const occupied = Option.fromUndefinedOr((yield* Ref.get(kept)).get(attemptId));
|
|
112
|
+
return Option.map(occupied, (lease) => ({
|
|
113
|
+
worker: lease.worker,
|
|
114
|
+
release: Ref.get(kept).pipe(Effect.flatMap((leases) => leases.has(attemptId)
|
|
115
|
+
? Effect.logInfo("The slot startup occupied stays kept with the checkout no execution acquired, until the Attempt's parent task is confirmed stopped", { attemptId, worker: lease.worker })
|
|
116
|
+
: lease.release)),
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Hands the kept checkout of `attemptId` to its execution; the Run then releases the slot when
|
|
121
|
+
* the Attempt ends. Does nothing for other Attempts.
|
|
122
|
+
*/
|
|
123
|
+
const acquired = Effect.fn("CheckoutRecovery.acquired")(function* (attemptId) {
|
|
124
|
+
const handedOver = yield* Ref.modify(kept, (leases) => [
|
|
125
|
+
leases.has(attemptId),
|
|
126
|
+
without(leases, attemptId),
|
|
127
|
+
]);
|
|
128
|
+
if (handedOver)
|
|
129
|
+
yield* Effect.logInfo("The reattached Attempt's execution acquired the checkout startup kept; its executor releases the checkout from here, and its Run the slot once the Attempt ends", { attemptId });
|
|
130
|
+
});
|
|
131
|
+
/**
|
|
132
|
+
* Reconciles the kept checkout of `attemptId` after its parent task is confirmed stopped. Fails
|
|
133
|
+
* with `ParentStopUnconfirmedError`, leaving the checkout, if the stop isn't confirmed.
|
|
134
|
+
*/
|
|
135
|
+
const recoverKept = Effect.fn("CheckoutRecovery.recoverKept")(function* (attemptId) {
|
|
136
|
+
// The parent task must stop before the reconcile or the next Attempt. `recover` also stops
|
|
137
|
+
// it, but its failure doesn't distinguish an unconfirmed stop from a failed salvage.
|
|
138
|
+
const stopped = yield* executor.interrupt(attemptId).pipe(Effect.result);
|
|
139
|
+
if (Result.isFailure(stopped)) {
|
|
140
|
+
yield* Effect.logWarning("Could not confirm that the parent task of an Attempt its Run does not reattach stopped; its checkout and its Worker's slot stay, and the Run starts no next Attempt until the stop is confirmed", { attemptId, errorTag: stopped.failure._tag, message: stopped.failure.message });
|
|
141
|
+
return yield* new ParentStopUnconfirmedError({ attemptId, cause: stopped.failure });
|
|
142
|
+
}
|
|
143
|
+
const found = yield* store.salvageCandidate(attemptId).pipe(Effect.result);
|
|
144
|
+
if (Result.isFailure(found)) {
|
|
145
|
+
yield* Effect.logError("Could not read the Attempt whose checkout startup kept; the checkout stays until the next startup", { attemptId, errorTag: found.failure._tag });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (Option.isNone(found.success)) {
|
|
149
|
+
yield* Effect.logWarning("The leftovers of the Attempt whose checkout startup kept were discarded; the checkout stays", { attemptId });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const attempt = found.success.value;
|
|
153
|
+
const fields = { attemptId, worker: attempt.worker, open: attempt.open };
|
|
154
|
+
yield* Effect.annotateCurrentSpan(fields);
|
|
155
|
+
if (!(yield* executor.workers).includes(attempt.worker)) {
|
|
156
|
+
yield* Effect.logWarning("The Worker of the Attempt whose checkout startup kept is no longer configured; the checkout stays until it is configured again or its leftovers are discarded", fields);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// The Run doesn't reattach the Attempt, so reconcile even if `isLive` still reports it, as for
|
|
160
|
+
// an unharvested parent report.
|
|
161
|
+
yield* Effect.logInfo("Reconciling the checkout startup kept for an Attempt that was not reattached", fields);
|
|
162
|
+
yield* recover(attempt);
|
|
163
|
+
});
|
|
164
|
+
const reconcile = Effect.fn("CheckoutRecovery.reconcile")(function* (attemptId) {
|
|
165
|
+
yield* Effect.annotateCurrentSpan({ attemptId });
|
|
166
|
+
const occupied = (yield* Ref.get(kept)).get(attemptId);
|
|
167
|
+
if (occupied === undefined) {
|
|
168
|
+
yield* Effect.logDebug("No checkout startup kept for the Attempt awaits reconciliation", {
|
|
169
|
+
attemptId,
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
yield* recoverKept(attemptId);
|
|
174
|
+
// Removed only after reconciling, so a cancel during the reconcile reconciles again and the
|
|
175
|
+
// slot stays taken while the parent task can still run (#177).
|
|
176
|
+
yield* Ref.update(kept, (leases) => without(leases, attemptId)).pipe(Effect.andThen(occupied.release), Effect.uninterruptible);
|
|
177
|
+
yield* Effect.logInfo("Released the slot startup occupied for an Attempt whose parent task is confirmed stopped", { attemptId, worker: occupied.worker });
|
|
178
|
+
});
|
|
179
|
+
return { atStartup, reattachSlot, acquired, reconcile };
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=checkout-recovery.js.map
|