@usine/engine 0.4.0 → 0.5.1-next.240.g158c84b
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/LICENSE +661 -21
- package/README.md +9 -6
- package/dist/cycle-budget/cycle-budget.d.ts +8 -2
- package/dist/cycle-budget/cycle-budget.d.ts.map +1 -1
- package/dist/cycle-budget/cycle-budget.js +46 -5
- package/dist/cycle-budget/cycle-budget.js.map +1 -1
- package/dist/cycle-budget/model.d.ts +4 -0
- package/dist/cycle-budget/model.d.ts.map +1 -1
- package/dist/cycle-budget/model.js +3 -0
- package/dist/cycle-budget/model.js.map +1 -1
- package/dist/database/local-sqlite.d.ts +4 -3
- package/dist/database/local-sqlite.d.ts.map +1 -1
- package/dist/database/local-sqlite.js +11 -7
- package/dist/database/local-sqlite.js.map +1 -1
- package/dist/database/schema.d.ts +121 -0
- package/dist/database/schema.d.ts.map +1 -1
- package/dist/database/schema.js +23 -0
- package/dist/database/schema.js.map +1 -1
- package/dist/engine/checkout-recovery.d.ts +28 -18
- package/dist/engine/checkout-recovery.d.ts.map +1 -1
- package/dist/engine/checkout-recovery.js +100 -43
- package/dist/engine/checkout-recovery.js.map +1 -1
- package/dist/engine/engine.d.ts +20 -8
- package/dist/engine/engine.d.ts.map +1 -1
- package/dist/engine/engine.js +26 -9
- package/dist/engine/engine.js.map +1 -1
- package/dist/engine/error.d.ts +1 -1
- package/dist/engine/error.js +1 -1
- package/dist/engine/error.js.map +1 -1
- package/dist/engine/lifecycle.d.ts +3 -1
- package/dist/engine/lifecycle.d.ts.map +1 -1
- package/dist/engine/lifecycle.js +13 -3
- package/dist/engine/lifecycle.js.map +1 -1
- package/dist/engine/run-driver.d.ts +21 -7
- package/dist/engine/run-driver.d.ts.map +1 -1
- package/dist/engine/run-driver.js +118 -32
- package/dist/engine/run-driver.js.map +1 -1
- package/dist/engine/submission.d.ts.map +1 -1
- package/dist/engine/submission.js +3 -2
- package/dist/engine/submission.js.map +1 -1
- package/dist/engine/unconfirmed-stops.d.ts +27 -0
- package/dist/engine/unconfirmed-stops.d.ts.map +1 -0
- package/dist/engine/unconfirmed-stops.js +26 -0
- package/dist/engine/unconfirmed-stops.js.map +1 -0
- package/dist/item-projection/item-projection.d.ts +3 -1
- package/dist/item-projection/item-projection.d.ts.map +1 -1
- package/dist/item-projection/item-projection.js +20 -9
- package/dist/item-projection/item-projection.js.map +1 -1
- package/dist/run-reader/run-reader.d.ts +6 -1
- package/dist/run-reader/run-reader.d.ts.map +1 -1
- package/dist/run-reader/run-reader.js +2 -0
- package/dist/run-reader/run-reader.js.map +1 -1
- package/dist/step-executor.d.ts +30 -11
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/step-executor.js.map +1 -1
- package/dist/store/codec.d.ts +38 -4
- package/dist/store/codec.d.ts.map +1 -1
- package/dist/store/codec.js +9 -2
- package/dist/store/codec.js.map +1 -1
- package/dist/store/leftovers.d.ts +1 -1
- package/dist/store/leftovers.js +2 -2
- package/dist/store/leftovers.js.map +1 -1
- package/dist/store/queries.d.ts +45 -3
- package/dist/store/queries.d.ts.map +1 -1
- package/dist/store/queries.js +59 -6
- package/dist/store/queries.js.map +1 -1
- package/dist/store/store.d.ts +22 -7
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +32 -3
- package/dist/store/store.js.map +1 -1
- package/drizzle/20261024162954_cycle_ask_closures/migration.sql +10 -0
- package/drizzle/20261024162954_cycle_ask_closures/snapshot.json +1948 -0
- package/drizzle/20261027104206_attempt_out_of_memory/migration.sql +1 -0
- package/drizzle/20261027104206_attempt_out_of_memory/snapshot.json +1958 -0
- package/drizzle/20261027191944_failure_resolution/migration.sql +1 -0
- package/drizzle/20261027191944_failure_resolution/snapshot.json +1968 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The default adapter stores the event ledger and run records in `<instance>/.usin
|
|
|
10
10
|
|
|
11
11
|
- `CursorStore` stores typed keys with JSON values, for efficiency-only trigger cursors such as GitHub watermarks and ETags. Deleting one safely replays events; the ledger deduplicates.
|
|
12
12
|
- `LoopControl` stores loop pause state; pausing never edits the loop file.
|
|
13
|
-
- `ItemProjectionReader` and `ItemProjectionWriter` store the latest issue and pull request snapshots from polling, which the board reads after a restart without querying GitHub. `list` returns the newest items first, up to `limit`; `openIssues` returns the numbers of open issues not marked gone. Writes change the projection revision only if the content hash changes.
|
|
13
|
+
- `ItemProjectionReader` and `ItemProjectionWriter` store the latest issue and pull request snapshots from polling, which the board reads after a restart without querying GitHub. `get` returns one item's projection; `list` returns the newest items first, up to `limit`; `openIssues` returns the numbers of open issues not marked gone. Writes change the projection revision only if the content hash changes.
|
|
14
14
|
- `RepositoryLabelProjectionReader` and `RepositoryLabelProjectionWriter` store each repo's full label catalog from polling, so repos without items still get proposed lanes. Writes change the revision only if the label set changes.
|
|
15
15
|
- `BoardMoves` (`/board-moves`) stores each board move: repo, item, send time, source and destination lanes, and labels added and removed. The orchestrator records a move before sending its labels, so the factory app's label change for the operator isn't taken for an agent's. `onItem(itemKey, since)` returns an item's moves from `since`, oldest first. Moves don't change the revision.
|
|
16
16
|
|
|
@@ -37,7 +37,8 @@ The default adapter stores the event ledger and run records in `<instance>/.usin
|
|
|
37
37
|
|
|
38
38
|
- A newer event supersedes a pending, waiting, or queued run. A running attempt finishes first; then only the item's newest queued event opens.
|
|
39
39
|
- Before it opens, `TriggerCondition` (`/trigger-condition`, supplied by the deployment) re-evaluates the loop's trigger on the item's current state. If it no longer matches, the event is recorded as ignored (revoked) and opens no run. If the item's source no longer has the item, the events are revoked and `ItemProjectionWriter.markGone` marks it gone, so the board stops showing it as open.
|
|
40
|
-
- Revoke stops pending, waiting, and queued runs; operator cancel also stops a running attempt.
|
|
40
|
+
- Revoke stops pending, waiting, and queued runs; operator cancel also stops a running attempt. Cancel rejects failed and succeeded runs with `RunOperationRejectedError` and preserves their outcomes. Repeating cancel on a canceled run succeeds without changing it.
|
|
41
|
+
- If `StepExecutor.interrupt` can't confirm that a canceled attempt's parent task stopped, `RunEngine.cancel` fails with `AttemptCancellationError`, and the attempt keeps its run's worker slot. After `StepExecutor.execute` fails, the engine also calls `interrupt` before it closes the attempt, and keeps the slot the same way if the stop isn't confirmed. While the stop is unconfirmed, no run of the attempt's loop starts an attempt on the item, on any worker; the run's fiber ends instead of reserving a slot. Each reconcile retries the stop, with its reason (`cancel`, `failed`, or `startup`) passed to `interrupt`, releases the slot once the stop is confirmed, and then starts the fibers of the waiting runs. `UnconfirmedStops` (`/engine`) lists these attempts with their loop and item, and `UnconfirmedStops.empty` lists none, for a process that drives no run.
|
|
41
42
|
- The engine records what each loop last saw of an item: a submitted event, or a non-matching sighting. A canceled, superseded, or revoked run keeps its event while the item stays the same, and so does a queued event that a revoke ignored. If the loop saw the item not matching or changed, and it then matches again, the event reopens with the dedup key `["reopened", n, <original key>]`, so the new run gets its own id.
|
|
42
43
|
- Succeeded and failed runs always keep their event. A queued event superseded by a newer one stays ignored.
|
|
43
44
|
|
|
@@ -49,7 +50,7 @@ The default adapter stores the event ledger and run records in `<instance>/.usin
|
|
|
49
50
|
|
|
50
51
|
An attempt ending with `QuestionFailure` or `BlockedFailure` starts a suppression of the item for its loop. The loop's next event, usually the agent's own comment, returns `Suppressed` and opens no run; queued events wait. An event with other content, a non-matching sighting, an operator retry, or `RunEngine.resolveFailure` lifts the suppression, and resolving gives the newest queued event its turn.
|
|
51
52
|
|
|
52
|
-
`RunEngine.resolveFailure(runId, attemptId)` stores the
|
|
53
|
+
`RunEngine.resolveFailure(runId, attemptId, operator)` stores the time and operator login of the current failed attempt's resolution in `Attempt.failureResolution`. Pass `Option.none()` if no operator login is configured. Repeats preserve the first resolution time and operator; another attempt or a run no longer failed is rejected. Snapshots and summaries include `resolvedFailureAttemptId`, and resolution updates the revision. The failed outcome and transcript stay in history, and retry remains available.
|
|
53
54
|
|
|
54
55
|
### Run fibers and restarts
|
|
55
56
|
|
|
@@ -61,15 +62,15 @@ After a stop during an attempt, the engine asks `StepExecutor.isLive` whether it
|
|
|
61
62
|
- Finished, and `StepExecutor.outcome` returns the stored result: the engine finishes the attempt with it.
|
|
62
63
|
- Otherwise: the attempt fails as an infrastructure failure, and the run continues with attempt N+1.
|
|
63
64
|
|
|
64
|
-
At startup, before any fiber starts, `StepExecutor.occupy` takes a slot on the worker of each open attempt whose checkout the engine keeps, so no new attempt takes it while the run calls `isLive`. The reattached attempt runs in that slot until it ends. If the run doesn't reattach, the reattachment fails before `ExecutionSink.checkoutAcquired`, or the operator cancels
|
|
65
|
+
At startup, before any fiber starts, `StepExecutor.occupy` takes a slot on the worker of each open attempt whose checkout the engine keeps, so no new attempt takes it while the run calls `isLive`. The reattached attempt runs in that slot until it ends. If the run doesn't reattach, the reattachment fails before `ExecutionSink.checkoutAcquired`, or the operator cancels, before or after `checkoutAcquired`, the slot stays taken until `StepExecutor.interrupt` confirms that the parent task stopped. A reattaching run without such a slot passes the worker to `StepExecutor.reserve`, then calls `isLive` again.
|
|
65
66
|
|
|
66
|
-
Also at startup, the engine passes every stored attempt on a worker in `StepExecutor.workers` to `StepExecutor.recover`, which records its salvage and reconciles its checkout. It first stops the parent task of each closed attempt. An open attempt whose parent task is live, or whose liveness can't be read, keeps its checkout for the run.
|
|
67
|
+
Also at startup, the engine passes every stored attempt on a worker in `StepExecutor.workers` to `StepExecutor.recover`, which records its salvage and reconciles its checkout. An attempt whose recorded salvage is `Rejected` carries it in `AttemptRecovery.rejected`, so the recovery doesn't push the same commit again. It first stops the parent task of each closed attempt. An open attempt whose parent task is live, or whose liveness can't be read, keeps its checkout for the run. Each reconcile, the startup one included, ends with `StepExecutor.sweep`, which removes the worker resources that no attempt holds, such as a provisioned worker's machines ([#550](https://github.com/basaltbytes/usine/issues/550)) or the Codex homes that a crash left on an SSH worker ([#592](https://github.com/basaltbytes/usine/issues/592)).
|
|
67
68
|
|
|
68
69
|
The engine handles that checkout's recovery until the reattaching execution runs `ExecutionSink.checkoutAcquired`, which `StepExecutor.execute` runs once preparation has the checkout, never on a failed preparation. If the run closes the attempt first (the task stopped before the run reserved a worker, liveness can't be read, the reattachment failed, or the operator canceled), the engine stops the parent task with `interrupt` and passes the still-open attempt to `recover`, which reconciles regardless of `isLive`. The next attempt resumes from that salvage.
|
|
69
70
|
|
|
70
71
|
If `interrupt` can't confirm the stop, the checkout and slot stay, the fiber stops before the next attempt and logs `Could not confirm that the parent task of an Attempt its Run does not reattach stopped`, and each reconcile tries again: it reattaches if the task is live, or retries the stop. This applies after another restart too.
|
|
71
72
|
|
|
72
|
-
Attempts on a worker that `StepExecutor.workers` doesn't list aren't reconciled. `RunEngine.discardLeftovers(worker)` stops tracking them
|
|
73
|
+
Attempts on a worker that `StepExecutor.workers` doesn't list aren't reconciled. `RunEngine.discardLeftovers(worker)` stops tracking them, then passes them to `StepExecutor.discard`, which removes what they left outside their checkouts, such as their Codex homes on an SSH worker, and never fails. Their checkouts stay. For a listed worker (declared, or removed with attempts still running), it fails with `LeftoversDiscardRejectedError`, which names the worker and counts its open attempts.
|
|
73
74
|
|
|
74
75
|
### Transcripts
|
|
75
76
|
|
|
@@ -95,6 +96,8 @@ The [lifecycle decisions](src/engine/lifecycle.ts) decide attempt completion, in
|
|
|
95
96
|
|
|
96
97
|
A reset records a fresh polling request. Trigger adapters read `CycleBudgets.generation(itemKey)` before fetching and put it in `Submission.cycleGeneration` and the event identity. Admission supersedes older observations, including in-flight polls and queued events, and new polling creates an event with current settings. Labels, restarts, and loop changes never clear an ask. See [ADR 0022](../../docs/adr/0022-item-cycle-budgets-and-comment-reviews.md).
|
|
97
98
|
|
|
99
|
+
`CycleBudgets.close(askId, "ItemClosed")` closes an ask without a reset, for an item that was closed or merged. It records the ask and the reason in `usine_cycle_ask_closures` and keeps the generation and reservations, so the item's next admission at the limit opens a new ask.
|
|
100
|
+
|
|
98
101
|
## Drain and shutdown
|
|
99
102
|
|
|
100
103
|
`RunEngine.drain()` closes attempt admission for good and waits for admitted attempts to store their outcomes. Reservations, approval gates, and retries resume after a restart; interrupting the wait leaves admission closed. The host sets a deadline and closes its runtime scope afterward ([ADR 0023](../../docs/adr/0023-graceful-attempt-drain.md)).
|
|
@@ -4,7 +4,7 @@ import { Event } from "@usine/core/event";
|
|
|
4
4
|
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import { RunDatabase } from "../database/database.ts";
|
|
6
6
|
import { EnginePersistenceError } from "../engine/error.ts";
|
|
7
|
-
import { CycleBudgetReset, CycleBudgetResetRejectedError } from "./model.ts";
|
|
7
|
+
import { type CycleBudgetAskCloseReason, CycleBudgetReset, CycleBudgetResetRejectedError } from "./model.ts";
|
|
8
8
|
declare const CycleBudgets_base: Context.ServiceClass<CycleBudgets, "@usine/engine/CycleBudgets", {
|
|
9
9
|
/** Returns the Item's cycle generation; callers read it before fetching trigger input and include it in the Event identity. */
|
|
10
10
|
readonly generation: (itemKey: ItemKey) => Effect.Effect<CycleGeneration, EnginePersistenceError>;
|
|
@@ -12,6 +12,12 @@ declare const CycleBudgets_base: Context.ServiceClass<CycleBudgets, "@usine/engi
|
|
|
12
12
|
readonly asks: () => Effect.Effect<ReadonlyArray<CycleBudgetAsk>, EnginePersistenceError>;
|
|
13
13
|
/** Records the answer to the Ask and requests fresh trigger evaluation; repeated calls are idempotent. */
|
|
14
14
|
readonly reset: (askId: CycleBudgetAskId, answer: Event) => Effect.Effect<void, EnginePersistenceError | CycleBudgetResetRejectedError>;
|
|
15
|
+
/**
|
|
16
|
+
* Closes the Ask without a reset and records `reason`. The Item keeps its cycle generation and
|
|
17
|
+
* reservations, so its next admission at the limit opens a new Ask. Returns `false` if the Ask
|
|
18
|
+
* isn't open.
|
|
19
|
+
*/
|
|
20
|
+
readonly close: (askId: CycleBudgetAskId, reason: CycleBudgetAskCloseReason) => Effect.Effect<boolean, EnginePersistenceError>;
|
|
15
21
|
/** Returns the resets that still wait for a durable polling-cursor restart. */
|
|
16
22
|
readonly pendingResets: () => Effect.Effect<ReadonlyArray<CycleBudgetReset>, EnginePersistenceError>;
|
|
17
23
|
/** Acknowledges the reset for its generation only, after fresh polling progress is recorded. */
|
|
@@ -21,5 +27,5 @@ declare const CycleBudgets_base: Context.ServiceClass<CycleBudgets, "@usine/engi
|
|
|
21
27
|
export declare class CycleBudgets extends CycleBudgets_base {
|
|
22
28
|
static readonly layer: Layer.Layer<CycleBudgets, never, RunDatabase>;
|
|
23
29
|
}
|
|
24
|
-
export { CycleBudgetReset, CycleBudgetResetRejectedError } from "./model.ts";
|
|
30
|
+
export { CycleBudgetAskCloseReason, CycleBudgetReset, CycleBudgetResetRejectedError, } from "./model.ts";
|
|
25
31
|
//# sourceMappingURL=cycle-budget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycle-budget.d.ts","sourceRoot":"","sources":["../../src/cycle-budget/cycle-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"cycle-budget.d.ts","sourceRoot":"","sources":["../../src/cycle-budget/cycle-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAY,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAStD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EACL,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,YAAY,CAAC;;IAgBhB,+HAA+H;yBAC1G,CACnB,OAAO,EAAE,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC;IAC3D,wGAAwG;mBACzF,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACzF,0GAA0G;oBAC1F,CACd,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,KAAK,KACV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,sBAAsB,GAAG,6BAA6B,CAAC;IAChF;;;;OAIG;oBACa,CACd,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,yBAAyB,KAC9B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACnD,+EAA+E;4BACvD,MAAM,MAAM,CAAC,MAAM,CACzC,aAAa,CAAC,gBAAgB,CAAC,EAC/B,sBAAsB,CACvB;IACD,gGAAgG;+BACrE,CACzB,KAAK,EAAE,gBAAgB,KACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,sBAAsB,CAAC;;AAhCpD,wEAAwE;AACxE,qBAAa,YAAa,SAAQ,iBAiCD;IAC/B,MAAM,CAAC,QAAQ,CAAC,KAAK,gDAiMnB;CACH;AAED,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
|
|
@@ -3,12 +3,12 @@ import { ItemKey } from "@usine/core/item";
|
|
|
3
3
|
import { Event } from "@usine/core/event";
|
|
4
4
|
import * as RunState from "@usine/core/run/state";
|
|
5
5
|
import { and, eq, inArray, sql } from "drizzle-orm";
|
|
6
|
-
import { Context, Effect, Layer, Option } from "effect";
|
|
6
|
+
import { Context, DateTime, Effect, Layer, Option, Schema } from "effect";
|
|
7
7
|
import { RunDatabase } from "../database/database.js";
|
|
8
|
-
import { cycleReservations, cycleResets, events, itemCycleBudgets, runs, } from "../database/schema.js";
|
|
8
|
+
import { cycleAskClosures, cycleReservations, cycleResets, events, itemCycleBudgets, runs, } from "../database/schema.js";
|
|
9
9
|
import { EnginePersistenceError } from "../engine/error.js";
|
|
10
10
|
import { encodeDateTime, encodePayload } from "../store/codec.js";
|
|
11
|
-
import { CycleBudgetReset, CycleBudgetResetRejectedError } from "./model.js";
|
|
11
|
+
import { CycleBudgetReset, CycleBudgetResetRejectedError, } from "./model.js";
|
|
12
12
|
import { cycleQueries } from "./queries.js";
|
|
13
13
|
const persistence = (effect) => effect.pipe(Effect.mapError((cause) => cause instanceof CycleBudgetResetRejectedError
|
|
14
14
|
? cause
|
|
@@ -96,6 +96,47 @@ export class CycleBudgets extends Context.Service()("@usine/engine/CycleBudgets"
|
|
|
96
96
|
}))
|
|
97
97
|
.pipe(persistence);
|
|
98
98
|
});
|
|
99
|
+
const close = Effect.fn("CycleBudgets.close")(function* (askId, reason) {
|
|
100
|
+
yield* Effect.annotateCurrentSpan({ askId, reason });
|
|
101
|
+
const closedAt = encodeDateTime(yield* DateTime.now);
|
|
102
|
+
return yield* database
|
|
103
|
+
.transaction((transaction) => Effect.gen(function* () {
|
|
104
|
+
const ask = (yield* cycleQueries(transaction).asks()).find(({ id }) => id === askId);
|
|
105
|
+
if (ask === undefined) {
|
|
106
|
+
yield* Effect.logInfo("Cycle-budget Ask is no longer open; nothing to close", {
|
|
107
|
+
askId,
|
|
108
|
+
reason,
|
|
109
|
+
});
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
const askJson = Schema.encodeSync(CycleBudgetAsk)(ask);
|
|
113
|
+
// An Item that matches again in the same generation raises an Ask with the same ID.
|
|
114
|
+
yield* transaction
|
|
115
|
+
.insert(cycleAskClosures)
|
|
116
|
+
.values({ askId, itemKey: ask.itemKey, reason, askJson, closedAt })
|
|
117
|
+
.onConflictDoUpdate({
|
|
118
|
+
target: cycleAskClosures.askId,
|
|
119
|
+
set: { reason, askJson, closedAt },
|
|
120
|
+
})
|
|
121
|
+
.execute();
|
|
122
|
+
yield* transaction
|
|
123
|
+
.update(itemCycleBudgets)
|
|
124
|
+
.set({ askJson: null })
|
|
125
|
+
.where(eq(itemCycleBudgets.itemKey, ask.itemKey))
|
|
126
|
+
.execute();
|
|
127
|
+
yield* Effect.logInfo("Closed cycle-budget Ask without a reset", {
|
|
128
|
+
askId,
|
|
129
|
+
reason,
|
|
130
|
+
itemKey: ask.itemKey,
|
|
131
|
+
repository: ask.repository,
|
|
132
|
+
loop: ask.loop,
|
|
133
|
+
completedCycles: ask.completedCycles,
|
|
134
|
+
counts: ask.counts,
|
|
135
|
+
});
|
|
136
|
+
return true;
|
|
137
|
+
}))
|
|
138
|
+
.pipe(Effect.mapError((cause) => new EnginePersistenceError({ operation: "close cycle ask", cause })));
|
|
139
|
+
});
|
|
99
140
|
const pendingResets = Effect.fn("CycleBudgets.pendingResets")(() => queries.pendingResets().pipe(Effect.map((rows) => rows.map((row) => new CycleBudgetReset(row))), Effect.mapError((cause) => new EnginePersistenceError({ operation: "read pending cycle resets", cause }))));
|
|
100
141
|
const acknowledgeReset = Effect.fn("CycleBudgets.acknowledgeReset")(function* (reset) {
|
|
101
142
|
yield* Effect.annotateCurrentSpan({ itemKey: reset.itemKey, generation: reset.generation });
|
|
@@ -110,8 +151,8 @@ export class CycleBudgets extends Context.Service()("@usine/engine/CycleBudgets"
|
|
|
110
151
|
generation: reset.generation,
|
|
111
152
|
});
|
|
112
153
|
});
|
|
113
|
-
return { generation, asks, reset, pendingResets, acknowledgeReset };
|
|
154
|
+
return { generation, asks, reset, close, pendingResets, acknowledgeReset };
|
|
114
155
|
}));
|
|
115
156
|
}
|
|
116
|
-
export { CycleBudgetReset, CycleBudgetResetRejectedError } from "./model.js";
|
|
157
|
+
export { CycleBudgetAskCloseReason, CycleBudgetReset, CycleBudgetResetRejectedError, } from "./model.js";
|
|
117
158
|
//# sourceMappingURL=cycle-budget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycle-budget.js","sourceRoot":"","sources":["../../src/cycle-budget/cycle-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"cycle-budget.js","sourceRoot":"","sources":["../../src/cycle-budget/cycle-budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,IAAI,GACL,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,aAAa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AE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;YAC5F,KAAK,CAAC,CAAC,QAAQ;iBACZ,MAAM,CAAC,gBAAgB,CAAC;iBACxB,GAAG,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;iBAC5B,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAC3C,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAClD,CACF;iBACA,OAAO,EAAE;iBACT,IAAI,CACH,MAAM,CAAC,QAAQ,CACb,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,sBAAsB,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,KAAK,EAAE,CAAC,CAC9E,CACF,CAAC;YACJ,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,sCAAsC,EAAE;gBAC5D,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAC7E,CAAC,CAAC,CACH,CAAC;CACH;AAED,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
|
|
@@ -14,6 +14,10 @@ declare const CycleBudgetResetRejectedError_base: Schema.Class<CycleBudgetResetR
|
|
|
14
14
|
/** An error for an Ask that is absent, answered differently, or no longer current. */
|
|
15
15
|
export declare class CycleBudgetResetRejectedError extends CycleBudgetResetRejectedError_base {
|
|
16
16
|
}
|
|
17
|
+
/** The reasons a cycle-budget Ask closes without a reset. `ItemClosed`: the Item was closed or merged. */
|
|
18
|
+
export declare const CYCLE_BUDGET_ASK_CLOSE_REASONS: readonly ["ItemClosed"];
|
|
19
|
+
export declare const CycleBudgetAskCloseReason: Schema.Literals<readonly ["ItemClosed"]>;
|
|
20
|
+
export type CycleBudgetAskCloseReason = typeof CycleBudgetAskCloseReason.Type;
|
|
17
21
|
export declare const BudgetRow: Schema.Struct<{
|
|
18
22
|
readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
|
|
19
23
|
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/cycle-budget/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,0BAA0B,CAAC;AAG7F,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;AAEhC,iGAAiG;AACjG,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;AAEL,sFAAsF;AACtF,qBAAa,6BAA8B,SAAQ,kCAEY;CAAG;AAElE,eAAO,MAAM,SAAS;;;;;;EAIpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/cycle-budget/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,0BAA0B,CAAC;AAG7F,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;AAEhC,iGAAiG;AACjG,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;AAEL,sFAAsF;AACtF,qBAAa,6BAA8B,SAAQ,kCAEY;CAAG;AAElE,0GAA0G;AAC1G,eAAO,MAAM,8BAA8B,YAAI,YAAY,CAAU,CAAC;AACtE,eAAO,MAAM,yBAAyB,0CAAkD,CAAC;AACzF,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAC;AAE9E,eAAO,MAAM,SAAS;;;;;;EAIpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC"}
|
|
@@ -12,6 +12,9 @@ export class CycleBudgetReset extends Schema.Class("CycleBudgetReset")({
|
|
|
12
12
|
/** An error for an Ask that is absent, answered differently, or no longer current. */
|
|
13
13
|
export class CycleBudgetResetRejectedError extends Schema.TaggedError("CycleBudgetResetRejectedError")("CycleBudgetResetRejectedError", { askId: CycleBudgetAskId }) {
|
|
14
14
|
}
|
|
15
|
+
/** The reasons a cycle-budget Ask closes without a reset. `ItemClosed`: the Item was closed or merged. */
|
|
16
|
+
export const CYCLE_BUDGET_ASK_CLOSE_REASONS = ["ItemClosed"];
|
|
17
|
+
export const CycleBudgetAskCloseReason = Schema.Literals(CYCLE_BUDGET_ASK_CLOSE_REASONS);
|
|
15
18
|
export const BudgetRow = Schema.Struct({
|
|
16
19
|
...CycleBudgetReset.fields,
|
|
17
20
|
ask: Schema.OptionFromNullOr(CycleBudgetAsk),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/cycle-budget/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,iGAAiG;AACjG,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,KAAK,CAAmB,kBAAkB,CAAC,CAAC;IACvF,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,cAAc;IAC1B,UAAU,EAAE,eAAe;CAC5B,CAAC;CAAG;AAEL,sFAAsF;AACtF,MAAM,OAAO,6BAA8B,SAAQ,MAAM,CAAC,WAAW,CACnE,+BAA+B,CAChC,CAAC,+BAA+B,EAAE,EAAE,KA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CAAC,OAAO;CAC7B,CAAC,CAAC"}
|
|
@@ -7,17 +7,18 @@ import { LoopControl } from "../loop-control/loop-control.ts";
|
|
|
7
7
|
import { BoardMoves } from "../board-moves/board-moves.ts";
|
|
8
8
|
import { CycleBudgets } from "../cycle-budget/cycle-budget.ts";
|
|
9
9
|
import { type RunEngine } from "../engine/engine.ts";
|
|
10
|
+
import { UnconfirmedStops } from "../engine/unconfirmed-stops.ts";
|
|
10
11
|
import type { InstanceDirectory } from "@usine/core/instance";
|
|
11
12
|
import { EnginePersistenceError, type RunEngineError } from "../engine/error.ts";
|
|
12
13
|
import { RunReader } from "../run-reader/run-reader.ts";
|
|
13
14
|
import type { StepExecutor } from "../step-executor.ts";
|
|
14
15
|
import type { TriggerCondition } from "../trigger-condition.ts";
|
|
15
16
|
import { RunDatabase } from "./database.ts";
|
|
16
|
-
export declare const localSqliteLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<RunDatabase | import("effect/
|
|
17
|
+
export declare const localSqliteLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<RunDatabase | import("effect/sql/SqlClient").SqlClient | SqliteClient.SqliteClient, EnginePersistenceError, never>;
|
|
17
18
|
/** Returns the local runtime layer on `.usine/runtime.sqlite`. */
|
|
18
|
-
export declare const layer: (instanceDirectory: InstanceDirectory) => Layer.Layer<BoardMoves | CursorStore | CycleBudgets | ItemProjectionReader | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | RunEngine | RunReader, RunEngineError, StepExecutor | TriggerCondition>;
|
|
19
|
+
export declare const layer: (instanceDirectory: InstanceDirectory) => Layer.Layer<BoardMoves | CursorStore | CycleBudgets | ItemProjectionReader | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | RunEngine | RunReader | UnconfirmedStops, RunEngineError, StepExecutor | TriggerCondition>;
|
|
19
20
|
/** Returns the observation layer, which initializes the local database but never recovers Runs or starts Attempts. */
|
|
20
|
-
export declare const observationLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<CycleBudgets | ItemProjectionReader | LoopControl | RepositoryLabelProjectionReader | RunReader, RunEngineError>;
|
|
21
|
+
export declare const observationLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<CycleBudgets | ItemProjectionReader | LoopControl | RepositoryLabelProjectionReader | RunReader | UnconfirmedStops, RunEngineError>;
|
|
21
22
|
/** Returns a layer that opens an existing `.usine/runtime.sqlite` read-only, without initializing or migrating it. */
|
|
22
23
|
export declare const runReaderLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<RunReader, EnginePersistenceError>;
|
|
23
24
|
declare const RuntimeStoreBackupError_base: Schema.Class<RuntimeStoreBackupError, Schema.TaggedStruct<"RuntimeStoreBackupError", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-sqlite.d.ts","sourceRoot":"","sources":["../../src/database/local-sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAc,KAAK,EAA+B,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,C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+B5C,eAAO,MAAM,gBAAgB,sBAAuB,iBAAiB,mIAyBpE,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,KAAK,sBACG,iBAAiB,KACnC,KAAK,CAAC,KAAK,CACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,oBAAoB,GACpB,oBAAoB,GACpB,WAAW,GACX,+BAA+B,GAC/B,+BAA+B,GAC/B,SAAS,GACT,SAAS,GACT,gBAAgB,EAClB,cAAc,EACd,YAAY,GAAG,gBAAgB,CACkE,CAAC;AAEpG,sHAAsH;AACtH,eAAO,MAAM,gBAAgB,sBACR,iBAAiB,KACnC,KAAK,CAAC,KAAK,CACV,YAAY,GACZ,oBAAoB,GACpB,WAAW,GACX,+BAA+B,GAC/B,SAAS,GACT,gBAAgB,EAClB,cAAc,CAUf,CAAC;AAmCF,sHAAsH;AACtH,eAAO,MAAM,cAAc,sBACN,iBAAiB,KACnC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAM/C,CAAC;;;;;;;;AAEF,8FAA8F;AAC9F,qBAAa,uBAAwB,SAAQ,4BAQ3C;CAAG;AAmBL;;;GAGG;AACH,eAAO,MAAM,MAAM,6JAwDlB,CAAC"}
|
|
@@ -12,17 +12,20 @@ import { LoopControl } from "../loop-control/loop-control.js";
|
|
|
12
12
|
import { BoardMoves } from "../board-moves/board-moves.js";
|
|
13
13
|
import { CycleBudgets } from "../cycle-budget/cycle-budget.js";
|
|
14
14
|
import { layerWithDatabase } from "../engine/engine.js";
|
|
15
|
+
import { UnconfirmedStops } from "../engine/unconfirmed-stops.js";
|
|
15
16
|
import { EnginePersistenceError } from "../engine/error.js";
|
|
16
17
|
import { RunReader } from "../run-reader/run-reader.js";
|
|
17
18
|
import { RunDatabase } from "./database.js";
|
|
18
19
|
const migrationsFolder = fileURLToPath(new URL("../../drizzle", import.meta.url));
|
|
19
20
|
const startupError = (operation, cause) => new EnginePersistenceError({ operation, cause });
|
|
20
21
|
const runtimeStorePath = (path, instanceDirectory) => path.join(instanceDirectory, ".usine", "runtime.sqlite");
|
|
22
|
+
/** Returns `SqliteClient.layer`, failing with `onError` when the database can't be opened. */
|
|
23
|
+
const openSqliteLayer = (config, onError) => Layer.effectContext(Layer.build(SqliteClient.layer(config)).pipe(Effect.mapError(onError)));
|
|
21
24
|
const sqliteClientLayer = (instanceDirectory) => Layer.unwrap(Effect.gen(function* () {
|
|
22
25
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
23
26
|
const path = yield* Path.Path;
|
|
24
27
|
yield* fileSystem.makeDirectory(path.join(instanceDirectory, ".usine"), { recursive: true });
|
|
25
|
-
return
|
|
28
|
+
return openSqliteLayer({ filename: runtimeStorePath(path, instanceDirectory) }, (cause) => startupError("open local database", cause));
|
|
26
29
|
}).pipe(Effect.mapError((cause) => startupError("prepare local database directory", cause)), Effect.provide(NodeServices.layer)));
|
|
27
30
|
export const localSqliteLayer = (instanceDirectory) => {
|
|
28
31
|
const sqlClient = sqliteClientLayer(instanceDirectory);
|
|
@@ -48,7 +51,7 @@ export const layer = (instanceDirectory) => layerWithDatabase(localSqliteLayer(i
|
|
|
48
51
|
/** Returns the observation layer, which initializes the local database but never recovers Runs or starts Attempts. */
|
|
49
52
|
export const observationLayer = (instanceDirectory) => {
|
|
50
53
|
const database = localSqliteLayer(instanceDirectory);
|
|
51
|
-
return Layer.mergeAll(CycleBudgets.layer, ItemProjectionReader.layer, LoopControl.layer, RepositoryLabelProjectionReader.layer, RunReader.layer).pipe(Layer.provide(database));
|
|
54
|
+
return Layer.mergeAll(CycleBudgets.layer, ItemProjectionReader.layer, LoopControl.layer, RepositoryLabelProjectionReader.layer, RunReader.layer).pipe(Layer.provide(database), Layer.merge(UnconfirmedStops.empty));
|
|
52
55
|
};
|
|
53
56
|
const readableRuntimeStore = Effect.fn("LocalSqlite.readableRuntimeStore")(function* (filename) {
|
|
54
57
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
@@ -63,11 +66,11 @@ const readableRuntimeStore = Effect.fn("LocalSqlite.readableRuntimeStore")(funct
|
|
|
63
66
|
description: `Expected a regular SQLite file, found ${info.type}`,
|
|
64
67
|
});
|
|
65
68
|
});
|
|
66
|
-
const readOnlySqliteLayer = (filename) =>
|
|
69
|
+
const readOnlySqliteLayer = (filename, onError) => openSqliteLayer({ filename, readonly: true, disableWAL: true }, onError);
|
|
67
70
|
const existingSqliteLayer = (instanceDirectory) => Layer.unwrap(Effect.gen(function* () {
|
|
68
71
|
const filename = runtimeStorePath(yield* Path.Path, instanceDirectory);
|
|
69
72
|
yield* readableRuntimeStore(filename);
|
|
70
|
-
return readOnlySqliteLayer(filename);
|
|
73
|
+
return readOnlySqliteLayer(filename, (cause) => startupError("open existing local database", cause));
|
|
71
74
|
}).pipe(Effect.mapError((cause) => startupError("open existing local database", cause)), Effect.provide(NodeServices.layer)));
|
|
72
75
|
/** Returns a layer that opens an existing `.usine/runtime.sqlite` read-only, without initializing or migrating it. */
|
|
73
76
|
export const runReaderLayer = (instanceDirectory) => {
|
|
@@ -111,13 +114,14 @@ export const backup = Effect.fn("LocalSqlite.backup")(function* (instanceDirecto
|
|
|
111
114
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
112
115
|
const path = yield* Path.Path;
|
|
113
116
|
const source = runtimeStorePath(path, instanceDirectory);
|
|
114
|
-
const
|
|
117
|
+
const failure = (operation) => (cause) => new RuntimeStoreBackupError({
|
|
115
118
|
operation,
|
|
116
119
|
source,
|
|
117
120
|
destination,
|
|
118
121
|
reason: failureReason(cause),
|
|
119
122
|
cause,
|
|
120
|
-
})
|
|
123
|
+
});
|
|
124
|
+
const failed = (operation) => Effect.mapError(failure(operation));
|
|
121
125
|
yield* readableRuntimeStore(source).pipe(failed("open"));
|
|
122
126
|
const { totalPages } = yield* Effect.scoped(Effect.gen(function* () {
|
|
123
127
|
const directory = path.dirname(destination);
|
|
@@ -130,7 +134,7 @@ export const backup = Effect.fn("LocalSqlite.backup")(function* (instanceDirecto
|
|
|
130
134
|
.pipe(failed("stage"));
|
|
131
135
|
const metadata = yield* Effect.flatMap(SqliteClient.SqliteClient, (client) =>
|
|
132
136
|
// Node's backup can't be canceled; wait before closing the database or deleting staging.
|
|
133
|
-
client.backup(staged).pipe(failed("copy"), Effect.uninterruptible)).pipe(Effect.provide(readOnlySqliteLayer(source)));
|
|
137
|
+
client.backup(staged).pipe(failed("copy"), Effect.uninterruptible)).pipe(Effect.provide(readOnlySqliteLayer(source, failure("open"))));
|
|
134
138
|
// A hard link atomically creates the destination without overwriting it.
|
|
135
139
|
yield* fileSystem.link(staged, destination).pipe(failed("publish"));
|
|
136
140
|
return metadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-sqlite.js","sourceRoot":"","sources":["../../src/database/local-sqlite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,aAAa,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCA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AU;KACX,CAAC,CAAC;AACL,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,UAAU,CAAC,6BAA6B,EAAE;IAC/C,QAAQ,EAAE,KAAK,CAAC,IAAI;IACpB,SAAS,EAAE,KAAK,CAAC,SAAS;IAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,WAAW,EAAE,KAAK,CAAC,WAAW;IAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;CACrB,CAAC,CACH,EACD,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CACnC,CAAC"}
|
|
@@ -627,6 +627,95 @@ export declare const cycleResets: import("drizzle-orm/sqlite-core").SQLiteTableW
|
|
|
627
627
|
dialect: 'sqlite';
|
|
628
628
|
isAlias: false;
|
|
629
629
|
}>;
|
|
630
|
+
/** Asks closed without a reset; the Item keeps its generation and reservations. */
|
|
631
|
+
export declare const cycleAskClosures: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
632
|
+
name: "usine_cycle_ask_closures";
|
|
633
|
+
schema: undefined;
|
|
634
|
+
columns: {
|
|
635
|
+
askId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
636
|
+
name: string;
|
|
637
|
+
tableName: "usine_cycle_ask_closures";
|
|
638
|
+
dataType: "string";
|
|
639
|
+
data: string & import("effect/Brand").Brand<"EventId"> & import("effect/Brand").Brand<"CycleBudgetAskId">;
|
|
640
|
+
driverParam: string;
|
|
641
|
+
notNull: true;
|
|
642
|
+
hasDefault: false;
|
|
643
|
+
isPrimaryKey: true;
|
|
644
|
+
isAutoincrement: false;
|
|
645
|
+
hasRuntimeDefault: false;
|
|
646
|
+
enumValues: [string, ...string[]];
|
|
647
|
+
baseColumn: never;
|
|
648
|
+
identity: undefined;
|
|
649
|
+
generated: undefined;
|
|
650
|
+
}, {}>;
|
|
651
|
+
itemKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
652
|
+
name: string;
|
|
653
|
+
tableName: "usine_cycle_ask_closures";
|
|
654
|
+
dataType: "string";
|
|
655
|
+
data: string & import("effect/Brand").Brand<"ItemKey">;
|
|
656
|
+
driverParam: string;
|
|
657
|
+
notNull: true;
|
|
658
|
+
hasDefault: false;
|
|
659
|
+
isPrimaryKey: false;
|
|
660
|
+
isAutoincrement: false;
|
|
661
|
+
hasRuntimeDefault: false;
|
|
662
|
+
enumValues: [string, ...string[]];
|
|
663
|
+
baseColumn: never;
|
|
664
|
+
identity: undefined;
|
|
665
|
+
generated: undefined;
|
|
666
|
+
}, {}>;
|
|
667
|
+
reason: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
668
|
+
name: string;
|
|
669
|
+
tableName: "usine_cycle_ask_closures";
|
|
670
|
+
dataType: "string enum";
|
|
671
|
+
data: "ItemClosed";
|
|
672
|
+
driverParam: string;
|
|
673
|
+
notNull: true;
|
|
674
|
+
hasDefault: false;
|
|
675
|
+
isPrimaryKey: false;
|
|
676
|
+
isAutoincrement: false;
|
|
677
|
+
hasRuntimeDefault: false;
|
|
678
|
+
enumValues: ["ItemClosed"];
|
|
679
|
+
baseColumn: never;
|
|
680
|
+
identity: undefined;
|
|
681
|
+
generated: undefined;
|
|
682
|
+
}, {}>;
|
|
683
|
+
askJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
684
|
+
name: string;
|
|
685
|
+
tableName: "usine_cycle_ask_closures";
|
|
686
|
+
dataType: "object json";
|
|
687
|
+
data: unknown;
|
|
688
|
+
driverParam: string;
|
|
689
|
+
notNull: true;
|
|
690
|
+
hasDefault: false;
|
|
691
|
+
isPrimaryKey: false;
|
|
692
|
+
isAutoincrement: false;
|
|
693
|
+
hasRuntimeDefault: false;
|
|
694
|
+
enumValues: undefined;
|
|
695
|
+
baseColumn: never;
|
|
696
|
+
identity: undefined;
|
|
697
|
+
generated: undefined;
|
|
698
|
+
}, {}>;
|
|
699
|
+
closedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
700
|
+
name: string;
|
|
701
|
+
tableName: "usine_cycle_ask_closures";
|
|
702
|
+
dataType: "string";
|
|
703
|
+
data: string;
|
|
704
|
+
driverParam: string;
|
|
705
|
+
notNull: true;
|
|
706
|
+
hasDefault: false;
|
|
707
|
+
isPrimaryKey: false;
|
|
708
|
+
isAutoincrement: false;
|
|
709
|
+
hasRuntimeDefault: false;
|
|
710
|
+
enumValues: [string, ...string[]];
|
|
711
|
+
baseColumn: never;
|
|
712
|
+
identity: undefined;
|
|
713
|
+
generated: undefined;
|
|
714
|
+
}, {}>;
|
|
715
|
+
};
|
|
716
|
+
dialect: 'sqlite';
|
|
717
|
+
isAlias: false;
|
|
718
|
+
}>;
|
|
630
719
|
export declare const runs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
631
720
|
name: "usine_runs";
|
|
632
721
|
schema: undefined;
|
|
@@ -1159,6 +1248,22 @@ export declare const attempts: import("drizzle-orm/sqlite-core").SQLiteTableWith
|
|
|
1159
1248
|
identity: undefined;
|
|
1160
1249
|
generated: undefined;
|
|
1161
1250
|
}, {}>;
|
|
1251
|
+
failureResolutionJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1252
|
+
name: string;
|
|
1253
|
+
tableName: "usine_attempts";
|
|
1254
|
+
dataType: "object json";
|
|
1255
|
+
data: unknown;
|
|
1256
|
+
driverParam: string;
|
|
1257
|
+
notNull: false;
|
|
1258
|
+
hasDefault: false;
|
|
1259
|
+
isPrimaryKey: false;
|
|
1260
|
+
isAutoincrement: false;
|
|
1261
|
+
hasRuntimeDefault: false;
|
|
1262
|
+
enumValues: undefined;
|
|
1263
|
+
baseColumn: never;
|
|
1264
|
+
identity: undefined;
|
|
1265
|
+
generated: undefined;
|
|
1266
|
+
}, {}>;
|
|
1162
1267
|
reattachedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1163
1268
|
name: string;
|
|
1164
1269
|
tableName: "usine_attempts";
|
|
@@ -1191,6 +1296,22 @@ export declare const attempts: import("drizzle-orm/sqlite-core").SQLiteTableWith
|
|
|
1191
1296
|
identity: undefined;
|
|
1192
1297
|
generated: undefined;
|
|
1193
1298
|
}, {}>;
|
|
1299
|
+
outOfMemoryJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1300
|
+
name: string;
|
|
1301
|
+
tableName: "usine_attempts";
|
|
1302
|
+
dataType: "object json";
|
|
1303
|
+
data: unknown;
|
|
1304
|
+
driverParam: string;
|
|
1305
|
+
notNull: false;
|
|
1306
|
+
hasDefault: false;
|
|
1307
|
+
isPrimaryKey: false;
|
|
1308
|
+
isAutoincrement: false;
|
|
1309
|
+
hasRuntimeDefault: false;
|
|
1310
|
+
enumValues: undefined;
|
|
1311
|
+
baseColumn: never;
|
|
1312
|
+
identity: undefined;
|
|
1313
|
+
generated: undefined;
|
|
1314
|
+
}, {}>;
|
|
1194
1315
|
};
|
|
1195
1316
|
dialect: 'sqlite';
|
|
1196
1317
|
isAlias: false;
|
|
@@ -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":"AAqCA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASlB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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O,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
|
@@ -14,6 +14,7 @@ import { StepName } from "@usine/core/step";
|
|
|
14
14
|
import { WorkerName } from "@usine/core/worker";
|
|
15
15
|
import { sql } from "drizzle-orm";
|
|
16
16
|
import { check, foreignKey, index, integer, primaryKey, snakeCase, text, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
17
|
+
import { CYCLE_BUDGET_ASK_CLOSE_REASONS, } from "../cycle-budget/model.js";
|
|
17
18
|
import { IGNORED_REASONS } from "../engine/submission.js";
|
|
18
19
|
export const events = snakeCase.table("usine_events", {
|
|
19
20
|
eventId: text().$type().primaryKey(),
|
|
@@ -113,6 +114,22 @@ export const cycleResets = snakeCase.table("usine_cycle_resets", {
|
|
|
113
114
|
.notNull()
|
|
114
115
|
.references(() => itemCycleBudgets.itemKey),
|
|
115
116
|
});
|
|
117
|
+
/** Asks closed without a reset; the Item keeps its generation and reservations. */
|
|
118
|
+
export const cycleAskClosures = snakeCase.table("usine_cycle_ask_closures", {
|
|
119
|
+
askId: text().$type().primaryKey(),
|
|
120
|
+
itemKey: text()
|
|
121
|
+
.$type()
|
|
122
|
+
.notNull()
|
|
123
|
+
.references(() => itemCycleBudgets.itemKey),
|
|
124
|
+
reason: text({ enum: CYCLE_BUDGET_ASK_CLOSE_REASONS })
|
|
125
|
+
.$type()
|
|
126
|
+
.notNull(),
|
|
127
|
+
askJson: text({ mode: "json" }).$type().notNull(),
|
|
128
|
+
closedAt: text().notNull(),
|
|
129
|
+
}, (table) => [
|
|
130
|
+
check("usine_cycle_ask_closures_reason", sql `${table.reason} in ('ItemClosed')`),
|
|
131
|
+
check("usine_cycle_ask_closures_ask_json", sql `json_valid(${table.askJson})`),
|
|
132
|
+
]);
|
|
116
133
|
export const runs = snakeCase.table("usine_runs", {
|
|
117
134
|
runId: text().$type().primaryKey(),
|
|
118
135
|
eventId: text()
|
|
@@ -173,10 +190,16 @@ export const attempts = snakeCase.table("usine_attempts", {
|
|
|
173
190
|
leftoversDiscardedAt: text(),
|
|
174
191
|
/** The reason the Attempt started; `null` for older Attempts. */
|
|
175
192
|
startJson: text({ mode: "json" }).$type(),
|
|
193
|
+
failureResolutionJson: text({ mode: "json" }).$type(),
|
|
176
194
|
/** The last time an orchestrator restart reattached the Attempt, or `null`. */
|
|
177
195
|
reattachedAt: text(),
|
|
178
196
|
/** The comments and reviews posted by an unsuccessful Attempt, or `null` if none were recorded. */
|
|
179
197
|
commentsJson: text({ mode: "json" }).$type(),
|
|
198
|
+
/**
|
|
199
|
+
* The processes the kernel killed for memory in each of the Attempt's containers that had
|
|
200
|
+
* kills, by container ID, or `null` if none.
|
|
201
|
+
*/
|
|
202
|
+
outOfMemoryJson: text({ mode: "json" }).$type(),
|
|
180
203
|
}, (table) => [
|
|
181
204
|
check("usine_attempts_number", sql `${table.attemptNumber} >= 1`),
|
|
182
205
|
check("usine_attempts_brain_json_valid", sql `json_valid(${table.brainJson})`),
|