@smthrs/run-store 0.0.0-stage → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/LICENSE +21 -0
- package/README.md +195 -2
- package/dist/cjs/AttemptStore.d.ts +359 -0
- package/dist/cjs/AttemptStore.d.ts.map +1 -0
- package/dist/cjs/AttemptStore.js +731 -0
- package/dist/cjs/AttemptStore.js.map +7 -0
- package/dist/cjs/Heartbeat.d.ts +46 -0
- package/dist/cjs/Heartbeat.d.ts.map +1 -0
- package/dist/cjs/Heartbeat.js +28 -0
- package/dist/cjs/Heartbeat.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +42 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +55 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/Ownership.d.ts +275 -0
- package/dist/cjs/Ownership.d.ts.map +1 -0
- package/dist/cjs/Ownership.js +129 -0
- package/dist/cjs/Ownership.js.map +7 -0
- package/dist/cjs/RunStore.d.ts +571 -0
- package/dist/cjs/RunStore.d.ts.map +1 -0
- package/dist/cjs/RunStore.js +1079 -0
- package/dist/cjs/RunStore.js.map +7 -0
- package/dist/cjs/RunStoreMetrics.d.ts +151 -0
- package/dist/cjs/RunStoreMetrics.d.ts.map +1 -0
- package/dist/cjs/RunStoreMetrics.js +91 -0
- package/dist/cjs/RunStoreMetrics.js.map +7 -0
- package/dist/cjs/index.d.ts +47 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/Boundary.d.ts +80 -0
- package/dist/cjs/internal/Boundary.d.ts.map +1 -0
- package/dist/cjs/internal/Boundary.js +92 -0
- package/dist/cjs/internal/Boundary.js.map +7 -0
- package/dist/cjs/internal/Companion.d.ts +44 -0
- package/dist/cjs/internal/Companion.d.ts.map +1 -0
- package/dist/cjs/internal/Companion.js +50 -0
- package/dist/cjs/internal/Companion.js.map +7 -0
- package/dist/cjs/internal/SpanOutcome.d.ts +37 -0
- package/dist/cjs/internal/SpanOutcome.d.ts.map +1 -0
- package/dist/cjs/internal/SpanOutcome.js +62 -0
- package/dist/cjs/internal/SpanOutcome.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +15 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +110 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_lineage.d.ts +27 -0
- package/dist/cjs/migrations/0002_lineage.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_lineage.js +43 -0
- package/dist/cjs/migrations/0002_lineage.js.map +7 -0
- package/dist/cjs/migrations/0003_execution_revisions.d.ts +15 -0
- package/dist/cjs/migrations/0003_execution_revisions.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_execution_revisions.js +77 -0
- package/dist/cjs/migrations/0003_execution_revisions.js.map +7 -0
- package/dist/cjs/migrations/0004_waiting_request.d.ts +32 -0
- package/dist/cjs/migrations/0004_waiting_request.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_waiting_request.js +42 -0
- package/dist/cjs/migrations/0004_waiting_request.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/TestRunStore.d.ts +17 -0
- package/dist/cjs/test/TestRunStore.d.ts.map +1 -0
- package/dist/cjs/test/TestRunStore.js +42 -0
- package/dist/cjs/test/TestRunStore.js.map +7 -0
- package/dist/esm/AttemptStore.d.ts +359 -0
- package/dist/esm/AttemptStore.d.ts.map +1 -0
- package/dist/esm/AttemptStore.js +835 -0
- package/dist/esm/AttemptStore.js.map +1 -0
- package/dist/esm/Heartbeat.d.ts +46 -0
- package/dist/esm/Heartbeat.d.ts.map +1 -0
- package/dist/esm/Heartbeat.js +46 -0
- package/dist/esm/Heartbeat.js.map +1 -0
- package/dist/esm/Migrations.d.ts +42 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +56 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/Ownership.d.ts +275 -0
- package/dist/esm/Ownership.d.ts.map +1 -0
- package/dist/esm/Ownership.js +299 -0
- package/dist/esm/Ownership.js.map +1 -0
- package/dist/esm/RunStore.d.ts +571 -0
- package/dist/esm/RunStore.d.ts.map +1 -0
- package/dist/esm/RunStore.js +1287 -0
- package/dist/esm/RunStore.js.map +1 -0
- package/dist/esm/RunStoreMetrics.d.ts +151 -0
- package/dist/esm/RunStoreMetrics.d.ts.map +1 -0
- package/dist/esm/RunStoreMetrics.js +120 -0
- package/dist/esm/RunStoreMetrics.js.map +1 -0
- package/dist/esm/index.d.ts +47 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/Boundary.d.ts +80 -0
- package/dist/esm/internal/Boundary.d.ts.map +1 -0
- package/dist/esm/internal/Boundary.js +109 -0
- package/dist/esm/internal/Boundary.js.map +1 -0
- package/dist/esm/internal/Companion.d.ts +44 -0
- package/dist/esm/internal/Companion.d.ts.map +1 -0
- package/dist/esm/internal/Companion.js +53 -0
- package/dist/esm/internal/Companion.js.map +1 -0
- package/dist/esm/internal/SpanOutcome.d.ts +37 -0
- package/dist/esm/internal/SpanOutcome.d.ts.map +1 -0
- package/dist/esm/internal/SpanOutcome.js +48 -0
- package/dist/esm/internal/SpanOutcome.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +15 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +88 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_lineage.d.ts +27 -0
- package/dist/esm/migrations/0002_lineage.d.ts.map +1 -0
- package/dist/esm/migrations/0002_lineage.js +33 -0
- package/dist/esm/migrations/0002_lineage.js.map +1 -0
- package/dist/esm/migrations/0003_execution_revisions.d.ts +15 -0
- package/dist/esm/migrations/0003_execution_revisions.d.ts.map +1 -0
- package/dist/esm/migrations/0003_execution_revisions.js +58 -0
- package/dist/esm/migrations/0003_execution_revisions.js.map +1 -0
- package/dist/esm/migrations/0004_waiting_request.d.ts +32 -0
- package/dist/esm/migrations/0004_waiting_request.d.ts.map +1 -0
- package/dist/esm/migrations/0004_waiting_request.js +37 -0
- package/dist/esm/migrations/0004_waiting_request.js.map +1 -0
- package/dist/esm/test/TestRunStore.d.ts +17 -0
- package/dist/esm/test/TestRunStore.d.ts.map +1 -0
- package/dist/esm/test/TestRunStore.js +19 -0
- package/dist/esm/test/TestRunStore.js.map +1 -0
- package/docs/README.md +142 -0
- package/docs/api.md +901 -0
- package/docs/concepts/durable-values.md +140 -0
- package/docs/concepts/execution-revisions.md +53 -0
- package/docs/concepts/fencing.md +146 -0
- package/docs/concepts/leases.md +154 -0
- package/docs/concepts/liveness-evidence.md +142 -0
- package/docs/guides/cancel-a-run.md +156 -0
- package/docs/guides/claim-and-finish-a-run.md +175 -0
- package/docs/guides/compose-the-stores.md +142 -0
- package/docs/guides/observe-outcomes.md +182 -0
- package/docs/guides/record-step-attempts.md +170 -0
- package/docs/guides/recover-a-stalled-run.md +173 -0
- package/docs/guides/testing.md +141 -0
- package/docs/installation.md +109 -0
- package/docs/quickstart.md +201 -0
- package/docs/troubleshooting.md +255 -0
- package/package.json +183 -3
- package/src/AttemptStore.ts +1195 -0
- package/src/Heartbeat.ts +47 -0
- package/src/Migrations.ts +59 -0
- package/src/Ownership.ts +407 -0
- package/src/RunStore.ts +2063 -0
- package/src/RunStoreMetrics.ts +165 -0
- package/src/index.ts +51 -0
- package/src/internal/Boundary.ts +130 -0
- package/src/internal/Companion.ts +64 -0
- package/src/internal/SpanOutcome.ts +71 -0
- package/src/migrations/0001_initial.ts +114 -0
- package/src/migrations/0002_lineage.ts +38 -0
- package/src/migrations/0003_execution_revisions.ts +69 -0
- package/src/migrations/0004_waiting_request.ts +39 -0
- package/src/test/TestRunStore.ts +22 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fenced run persistence and ownership compare-and-swap operations.
|
|
3
|
+
*
|
|
4
|
+
* Operations that accept or verify `LivenessEvidence` (`claim`,
|
|
5
|
+
* `claimAndOwn`, `steal`, `heartbeat`, `requestCancel`, and `recoverClaim`)
|
|
6
|
+
* take the caller's `nowMs` and judge it literally, including the lease cutoff
|
|
7
|
+
* and exact `evidence.checkedAtMs === nowMs` rule. The lease operations
|
|
8
|
+
* (`claim`, `claimAndOwn`, `steal`, `heartbeat`, and `recoverClaim`) also
|
|
9
|
+
* refuse a `nowMs` that runs ahead of the injected Effect `Clock` by more than
|
|
10
|
+
* `heartbeatSkewAllowance`: no composition produces one honestly, because the
|
|
11
|
+
* caller and the store share a process, and such a reading is the one lever
|
|
12
|
+
* that steals a fresh owner or pins a lease past the cutoff. A reading behind
|
|
13
|
+
* the clock is admitted, since it only makes staleness judgments more
|
|
14
|
+
* conservative and the monotonic heartbeat absorbs it. `requestCancel` keeps
|
|
15
|
+
* the literal reading because its timestamp is request data, never a lease
|
|
16
|
+
* predicate. Lifecycle stamps use the Effect `Clock`: `create` writes
|
|
17
|
+
* `created_at_ms`, `activate` writes `started_at_ms` and `heartbeat_at_ms`,
|
|
18
|
+
* and `transitionOwned` writes `finished_at_ms`. A row can therefore carry
|
|
19
|
+
* readings from two clocks. Within the allowance the store trusts the caller's
|
|
20
|
+
* clock, which is right for an in-process library over local SQLite and must
|
|
21
|
+
* not cross a trust boundary.
|
|
22
|
+
*
|
|
23
|
+
* Arbitration itself — who holds the claim, who holds the lease, whether the
|
|
24
|
+
* fence still stands — is delegated to `@smthrs/journal`'s injected
|
|
25
|
+
* `Consensus` strategy. The run row mirrors the strategy's answer in the same
|
|
26
|
+
* write transaction, and every ownership transition the strategy grants is
|
|
27
|
+
* appended to the run's `run-store` companion journal stream in that
|
|
28
|
+
* transaction (see {@link OwnershipTransition}); heartbeats renew the lease
|
|
29
|
+
* and never enter the journal.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
*/
|
|
33
|
+
import { DurableWriter } from "@smthrs/database/DurableWriter";
|
|
34
|
+
import { Consensus, type LivenessEvidence } from "@smthrs/journal/Consensus";
|
|
35
|
+
import { OwnerId } from "@smthrs/journal/OwnerId";
|
|
36
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
37
|
+
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
38
|
+
/**
|
|
39
|
+
* Maximum nesting admitted for executable run state.
|
|
40
|
+
*
|
|
41
|
+
* @since 1.0.0-rc.0
|
|
42
|
+
* @category constants
|
|
43
|
+
*/
|
|
44
|
+
export declare const maximumRunJsonDepth = 128;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum values and members admitted for executable run state.
|
|
47
|
+
*
|
|
48
|
+
* @since 1.0.0-rc.0
|
|
49
|
+
* @category constants
|
|
50
|
+
*/
|
|
51
|
+
export declare const maximumRunJsonNodes = 100000;
|
|
52
|
+
/**
|
|
53
|
+
* Stable run states understood by the durability layer.
|
|
54
|
+
*
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
* @category models
|
|
57
|
+
*/
|
|
58
|
+
export declare const RunStatus: Schema.Literals<readonly ["pending", "running", "suspended", "completed", "failed", "cancelled"]>;
|
|
59
|
+
/**
|
|
60
|
+
* A stable run state.
|
|
61
|
+
*
|
|
62
|
+
* @since 0.1.0
|
|
63
|
+
* @category models
|
|
64
|
+
*/
|
|
65
|
+
export type RunStatus = typeof RunStatus.Type;
|
|
66
|
+
/**
|
|
67
|
+
* The run states a run never leaves.
|
|
68
|
+
*
|
|
69
|
+
* Named because two rules are written against exactly this set: a settled run
|
|
70
|
+
* refuses new cancellation intent ({@link RequestCancelOutcome}), and a
|
|
71
|
+
* settled row is never claimed, activated, or swept.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
* @category models
|
|
75
|
+
*/
|
|
76
|
+
export declare const TerminalRunStatus: Schema.Literals<readonly ["completed", "failed", "cancelled"]>;
|
|
77
|
+
/**
|
|
78
|
+
* The type of {@link TerminalRunStatus}.
|
|
79
|
+
*
|
|
80
|
+
* @since 0.1.0
|
|
81
|
+
* @category models
|
|
82
|
+
*/
|
|
83
|
+
export type TerminalRunStatus = typeof TerminalRunStatus.Type;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a status is one a run never leaves.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.1.0
|
|
88
|
+
* @category models
|
|
89
|
+
*/
|
|
90
|
+
export declare const isTerminalRunStatus: (status: RunStatus) => status is TerminalRunStatus;
|
|
91
|
+
/**
|
|
92
|
+
* Stable failure codes surfaced by `RunStore`.
|
|
93
|
+
*
|
|
94
|
+
* @since 0.1.0
|
|
95
|
+
* @category errors
|
|
96
|
+
*/
|
|
97
|
+
export declare const RunStoreErrorCode: Schema.Literals<readonly ["invalid_run", "not_found_row", "constraint", "decode_failed", "persistence_failed"]>;
|
|
98
|
+
/**
|
|
99
|
+
* A stable `RunStore` failure code.
|
|
100
|
+
*
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
* @category errors
|
|
103
|
+
*/
|
|
104
|
+
export type RunStoreErrorCode = typeof RunStoreErrorCode.Type;
|
|
105
|
+
declare const RunStoreError_base: Schema.Class<RunStoreError, Schema.TaggedStruct<"@smthrs/run-store/RunStoreError", {
|
|
106
|
+
readonly code: Schema.Literals<readonly ["invalid_run", "not_found_row", "constraint", "decode_failed", "persistence_failed"]>;
|
|
107
|
+
readonly method: Schema.String;
|
|
108
|
+
readonly message: Schema.String;
|
|
109
|
+
readonly cause: Schema.Unknown;
|
|
110
|
+
}>, import("effect/Cause").YieldableError>;
|
|
111
|
+
/**
|
|
112
|
+
* A normalized run persistence failure.
|
|
113
|
+
*
|
|
114
|
+
* Compare-and-swap competition is represented by successful outcome values,
|
|
115
|
+
* never by this error channel.
|
|
116
|
+
*
|
|
117
|
+
* The identity string equals the defining module path, which is how every
|
|
118
|
+
* tagged identity in this package is named.
|
|
119
|
+
*
|
|
120
|
+
* @since 0.1.0
|
|
121
|
+
* @category errors
|
|
122
|
+
*/
|
|
123
|
+
export declare class RunStoreError extends RunStoreError_base {
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The exact persisted fields guarded by a claim and its later activation.
|
|
127
|
+
*
|
|
128
|
+
* @since 0.1.0
|
|
129
|
+
* @category models
|
|
130
|
+
*/
|
|
131
|
+
export interface RunSnapshot {
|
|
132
|
+
readonly status: RunStatus;
|
|
133
|
+
readonly owner: OwnerId | null;
|
|
134
|
+
readonly heartbeatAtMs: number | null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A decoded row in `flows_runs`.
|
|
138
|
+
*
|
|
139
|
+
* @since 0.1.0
|
|
140
|
+
* @category models
|
|
141
|
+
*/
|
|
142
|
+
export interface RunRow extends RunSnapshot {
|
|
143
|
+
readonly runId: string;
|
|
144
|
+
readonly createdAtMs: number;
|
|
145
|
+
readonly startedAtMs: number | null;
|
|
146
|
+
readonly finishedAtMs: number | null;
|
|
147
|
+
readonly claim: OwnerId | null;
|
|
148
|
+
readonly claimedAtMs: number | null;
|
|
149
|
+
readonly parentRunId: string | null;
|
|
150
|
+
readonly cancelRequestedAtMs: number | null;
|
|
151
|
+
/**
|
|
152
|
+
* The trampoline lineage this run is a round of, and which round it is.
|
|
153
|
+
* `null` on every run that is not part of a lineage, which reads as round 0
|
|
154
|
+
* of a lineage of one.
|
|
155
|
+
*
|
|
156
|
+
* Optional on the interface so a caller that builds a `RunRow` by hand —
|
|
157
|
+
* a time-travel fixture, a recovery double — keeps compiling: the pair was
|
|
158
|
+
* added by an append-only migration, and every reader must already tolerate
|
|
159
|
+
* a row written before it.
|
|
160
|
+
*/
|
|
161
|
+
readonly lineageId?: string | null | undefined;
|
|
162
|
+
readonly roundOrdinal?: number | null | undefined;
|
|
163
|
+
readonly stateJson: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Metadata recorded when a run row is created.
|
|
167
|
+
*
|
|
168
|
+
* `parentRunId` is the ancestry edge a fork, rewind, child, or later
|
|
169
|
+
* trampoline round carries. It is a column rather than a `state_json` field
|
|
170
|
+
* because ancestry is walked in SQL.
|
|
171
|
+
*
|
|
172
|
+
* `lineageId` and `roundOrdinal` are the trampoline pair: which lineage a run
|
|
173
|
+
* is a round of, and which round. Both absent — the ordinary case — means the
|
|
174
|
+
* run is a lineage of one, and is read back as round 0 of itself.
|
|
175
|
+
*
|
|
176
|
+
* @since 0.1.0
|
|
177
|
+
* @category models
|
|
178
|
+
*/
|
|
179
|
+
export interface CreateOptions {
|
|
180
|
+
readonly parentRunId?: string | undefined;
|
|
181
|
+
readonly lineageId?: string | undefined;
|
|
182
|
+
readonly roundOrdinal?: number | undefined;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* An extra compare-and-swap predicate over first-class run metadata.
|
|
186
|
+
*
|
|
187
|
+
* A guard is the seam for lifecycle rules a harness must enforce atomically —
|
|
188
|
+
* `{ cancelRequested: "absent" }` is the "do not finalize a run someone asked
|
|
189
|
+
* to cancel" rule, expressed as SQL rather than as a read-then-write race.
|
|
190
|
+
*
|
|
191
|
+
* @since 0.1.0
|
|
192
|
+
* @category models
|
|
193
|
+
*/
|
|
194
|
+
export declare const TransitionGuard: Schema.Struct<{
|
|
195
|
+
readonly cancelRequested: Schema.optional<Schema.Literals<readonly ["absent", "present"]>>;
|
|
196
|
+
}>;
|
|
197
|
+
/**
|
|
198
|
+
* An extra compare-and-swap predicate over first-class run metadata.
|
|
199
|
+
*
|
|
200
|
+
* @since 0.1.0
|
|
201
|
+
* @category models
|
|
202
|
+
*/
|
|
203
|
+
export type TransitionGuard = typeof TransitionGuard.Type;
|
|
204
|
+
/**
|
|
205
|
+
* Result of recording a cancellation request.
|
|
206
|
+
*
|
|
207
|
+
* The request is deliberately unfenced: any observer may ask, and the owner
|
|
208
|
+
* decides. `requestedAtMs` is the winning request, so a repeat request reports
|
|
209
|
+
* the original time rather than overwriting it.
|
|
210
|
+
*
|
|
211
|
+
* @since 0.1.0
|
|
212
|
+
* @category models
|
|
213
|
+
*/
|
|
214
|
+
export type RequestCancelOutcome = {
|
|
215
|
+
readonly _tag: "CancelRequested";
|
|
216
|
+
readonly requestedAtMs: number;
|
|
217
|
+
} | {
|
|
218
|
+
readonly _tag: "AlreadyRequested";
|
|
219
|
+
readonly requestedAtMs: number;
|
|
220
|
+
} | {
|
|
221
|
+
readonly _tag: "NotFound";
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The run had already settled, so nothing was recorded. A terminal run has
|
|
225
|
+
* no owner and no drive to observe a request, so writing one would leave
|
|
226
|
+
* intent nothing ever acts on — and a reader that takes the column as live
|
|
227
|
+
* intent (`RunDriver.inheritParentCancellation`) would cancel children a
|
|
228
|
+
* `completed` parent had finished with. The status says which ending the
|
|
229
|
+
* request lost to.
|
|
230
|
+
*/
|
|
231
|
+
| {
|
|
232
|
+
readonly _tag: "Terminal";
|
|
233
|
+
readonly status: TerminalRunStatus;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Result of acquiring claim columns for a later activation.
|
|
237
|
+
*
|
|
238
|
+
* @since 0.1.0
|
|
239
|
+
* @category models
|
|
240
|
+
*/
|
|
241
|
+
export type ClaimOutcome = {
|
|
242
|
+
readonly _tag: "Claimed";
|
|
243
|
+
readonly claimedAtMs: number;
|
|
244
|
+
} | {
|
|
245
|
+
readonly _tag: "NotFound";
|
|
246
|
+
} | {
|
|
247
|
+
readonly _tag: "AlreadyClaimed";
|
|
248
|
+
} | {
|
|
249
|
+
readonly _tag: "HeartbeatFresh";
|
|
250
|
+
} | {
|
|
251
|
+
readonly _tag: "SnapshotChanged";
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Result of stealing an exact run snapshot after liveness evidence is checked.
|
|
255
|
+
*
|
|
256
|
+
* `LivenessUnconfirmed` means the supplied evidence did not match the
|
|
257
|
+
* snapshot's owner, the host relation its `kind` requires, or `nowMs`, so the
|
|
258
|
+
* steal was refused before any compare-and-swap ran. The other tags have the
|
|
259
|
+
* same meaning as {@link ClaimOutcome} after the comparison runs.
|
|
260
|
+
*
|
|
261
|
+
* @since 1.0.0-rc.0
|
|
262
|
+
* @category models
|
|
263
|
+
*/
|
|
264
|
+
export type StealOutcome = ClaimOutcome | {
|
|
265
|
+
readonly _tag: "LivenessUnconfirmed";
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Result of claiming and activating ownership in one compare-and-swap.
|
|
269
|
+
*
|
|
270
|
+
* @since 0.1.0
|
|
271
|
+
* @category models
|
|
272
|
+
*/
|
|
273
|
+
export type ClaimAndOwnOutcome = {
|
|
274
|
+
readonly _tag: "Activated";
|
|
275
|
+
} | {
|
|
276
|
+
readonly _tag: "NotFound";
|
|
277
|
+
} | {
|
|
278
|
+
readonly _tag: "AlreadyClaimed";
|
|
279
|
+
} | {
|
|
280
|
+
readonly _tag: "HeartbeatFresh";
|
|
281
|
+
} | {
|
|
282
|
+
readonly _tag: "SnapshotChanged";
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The caller's exact snapshot is still current, its different owner has a
|
|
286
|
+
* stale heartbeat, and no matching `LivenessEvidence` was supplied, so no
|
|
287
|
+
* compare-and-swap ran. Re-reading and retrying cannot make progress; supply
|
|
288
|
+
* evidence, or use `steal`. A current fresh heartbeat instead reports
|
|
289
|
+
* `HeartbeatFresh`, because evidence cannot satisfy the stale-lease predicate.
|
|
290
|
+
*/
|
|
291
|
+
| {
|
|
292
|
+
readonly _tag: "EvidenceRequired";
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Result of activating a held claim.
|
|
296
|
+
*
|
|
297
|
+
* @since 0.1.0
|
|
298
|
+
* @category models
|
|
299
|
+
*/
|
|
300
|
+
export type ActivateOutcome = {
|
|
301
|
+
readonly _tag: "Activated";
|
|
302
|
+
} | {
|
|
303
|
+
readonly _tag: "ClaimLost";
|
|
304
|
+
} | {
|
|
305
|
+
readonly _tag: "SnapshotChanged";
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Result of clearing a held claim.
|
|
309
|
+
*
|
|
310
|
+
* @since 0.1.0
|
|
311
|
+
* @category models
|
|
312
|
+
*/
|
|
313
|
+
export type AbandonClaimOutcome = {
|
|
314
|
+
readonly _tag: "Abandoned";
|
|
315
|
+
} | {
|
|
316
|
+
readonly _tag: "ClaimLost";
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Result of clearing an exact stale claim after its claimant was proven dead.
|
|
320
|
+
*
|
|
321
|
+
* @since 0.1.0
|
|
322
|
+
* @category models
|
|
323
|
+
*/
|
|
324
|
+
export type RecoverClaimOutcome = {
|
|
325
|
+
readonly _tag: "Recovered";
|
|
326
|
+
} | {
|
|
327
|
+
readonly _tag: "NotFound";
|
|
328
|
+
} | {
|
|
329
|
+
readonly _tag: "ClaimFresh";
|
|
330
|
+
} | {
|
|
331
|
+
readonly _tag: "ClaimChanged";
|
|
332
|
+
} | {
|
|
333
|
+
readonly _tag: "LivenessUnconfirmed";
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Result of a fenced ownership heartbeat.
|
|
337
|
+
*
|
|
338
|
+
* @since 0.1.0
|
|
339
|
+
* @category models
|
|
340
|
+
*/
|
|
341
|
+
export type HeartbeatOutcome = {
|
|
342
|
+
readonly _tag: "Updated";
|
|
343
|
+
} | {
|
|
344
|
+
readonly _tag: "FenceLost";
|
|
345
|
+
} | {
|
|
346
|
+
readonly _tag: "NotFound";
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* Result of a fenced owned transition.
|
|
350
|
+
*
|
|
351
|
+
* @since 0.1.0
|
|
352
|
+
* @category models
|
|
353
|
+
*/
|
|
354
|
+
export type TransitionOutcome = {
|
|
355
|
+
readonly _tag: "Transitioned";
|
|
356
|
+
} | {
|
|
357
|
+
readonly _tag: "FenceLost";
|
|
358
|
+
} | {
|
|
359
|
+
readonly _tag: "NotFound";
|
|
360
|
+
} | {
|
|
361
|
+
readonly _tag: "GuardFailed";
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* An ownership transition the consensus strategy granted on a run.
|
|
365
|
+
*
|
|
366
|
+
* `claimed` and `stolen` reserve the run for a claimant, `activated` promotes
|
|
367
|
+
* a claim to ownership, `released` gives a claim or ownership back, and
|
|
368
|
+
* `expired` clears a dead claimant's stale claim. Each is appended as a
|
|
369
|
+
* `flows.consensus.<transition>` fact, with payload `{ runId, owner,
|
|
370
|
+
* grantedAtMs }`, to the run's companion stream
|
|
371
|
+
* `JournalEvent.companionRunId("run-store", runId)` in the transaction that
|
|
372
|
+
* made it; a rolled-back transition leaves no fact. Heartbeats are not
|
|
373
|
+
* transitions and never enter the journal.
|
|
374
|
+
*
|
|
375
|
+
* The facts live beside the run's own stream rather than in it, so a consumer
|
|
376
|
+
* that reads the run's stream by position never sees one, and a rewind or
|
|
377
|
+
* compaction of that stream never truncates one. They are recorded when the
|
|
378
|
+
* caller runs with a `Journal` in its context.
|
|
379
|
+
*
|
|
380
|
+
* @since 1.0.0
|
|
381
|
+
* @category models
|
|
382
|
+
*/
|
|
383
|
+
export declare const OwnershipTransition: Schema.Literals<readonly ["claimed", "activated", "released", "stolen", "expired"]>;
|
|
384
|
+
/**
|
|
385
|
+
* The type of {@link OwnershipTransition}.
|
|
386
|
+
*
|
|
387
|
+
* @since 1.0.0
|
|
388
|
+
* @category models
|
|
389
|
+
*/
|
|
390
|
+
export type OwnershipTransition = typeof OwnershipTransition.Type;
|
|
391
|
+
/**
|
|
392
|
+
* The name of the run store's journal companion stream: every fact the store
|
|
393
|
+
* records about a run goes to `JournalEvent.companionRunId(companionStream,
|
|
394
|
+
* runId)`.
|
|
395
|
+
*
|
|
396
|
+
* @since 1.0.0
|
|
397
|
+
* @category constants
|
|
398
|
+
*/
|
|
399
|
+
export declare const companionStream: string;
|
|
400
|
+
/**
|
|
401
|
+
* The journal event type an ownership transition is appended under.
|
|
402
|
+
*
|
|
403
|
+
* @since 1.0.0
|
|
404
|
+
* @category constants
|
|
405
|
+
*/
|
|
406
|
+
export declare const ownershipEventType: (transition: OwnershipTransition) => string;
|
|
407
|
+
/**
|
|
408
|
+
* Fenced persistence operations for durable runs.
|
|
409
|
+
*
|
|
410
|
+
* @since 0.1.0
|
|
411
|
+
* @category models
|
|
412
|
+
*/
|
|
413
|
+
export interface Service {
|
|
414
|
+
readonly create: (runId: string, stateJson: string, options?: CreateOptions | undefined) => Effect.Effect<void, RunStoreError>;
|
|
415
|
+
readonly get: (runId: string) => Effect.Effect<RunRow, RunStoreError>;
|
|
416
|
+
/**
|
|
417
|
+
* Reads every persisted round of this run's trampoline lineage, in ordinal
|
|
418
|
+
* order, from any member execution ID. An older root with null lineage
|
|
419
|
+
* columns is included as round zero. Missing IDs return an empty array.
|
|
420
|
+
* Fork ancestry alone does not join lineages. This is a snapshot read;
|
|
421
|
+
* callers making lifecycle decisions must hold their shared write transaction.
|
|
422
|
+
*/
|
|
423
|
+
readonly lineage: (runId: string) => Effect.Effect<ReadonlyArray<RunRow>, RunStoreError>;
|
|
424
|
+
/** Reads only the highest persisted round; fails with not_found_row for an unknown ID. */
|
|
425
|
+
readonly latestRound: (runId: string) => Effect.Effect<RunRow, RunStoreError>;
|
|
426
|
+
/** Records an unfenced cancellation request that later guarded transitions observe. */
|
|
427
|
+
readonly requestCancel: (runId: string, nowMs: number) => Effect.Effect<RequestCancelOutcome, RunStoreError>;
|
|
428
|
+
/**
|
|
429
|
+
* Records the first owner observation of durable intent. Returns false if
|
|
430
|
+
* intent is absent or the running owner fence no longer matches.
|
|
431
|
+
*/
|
|
432
|
+
readonly acknowledgeCancel: (runId: string, owner: OwnerId, nowMs: number) => Effect.Effect<boolean, RunStoreError>;
|
|
433
|
+
/**
|
|
434
|
+
* Resolves and requests every non-terminal round in one write transaction.
|
|
435
|
+
* Terminal is returned only when the entire logical run has settled; its
|
|
436
|
+
* status is the last round's status. Child-DAG cascading belongs to the
|
|
437
|
+
* engine. Ordinary requestCancel remains the explicitly round-scoped port.
|
|
438
|
+
*/
|
|
439
|
+
readonly requestCancelLineage: (runId: string, nowMs: number) => Effect.Effect<RequestCancelOutcome, RunStoreError>;
|
|
440
|
+
/**
|
|
441
|
+
* Claims an exact pending or suspended snapshot for a later `activate`.
|
|
442
|
+
* `nowMs` becomes `claimed_at_ms`, so it must not run ahead of the Effect
|
|
443
|
+
* `Clock` by more than `heartbeatSkewAllowance`; a reading that does fails
|
|
444
|
+
* with `invalid_run`.
|
|
445
|
+
*/
|
|
446
|
+
readonly claim: (runId: string, expected: RunSnapshot, claimant: OwnerId, nowMs: number) => Effect.Effect<ClaimOutcome, RunStoreError>;
|
|
447
|
+
/**
|
|
448
|
+
* Claims and activates an exact snapshot atomically under the supplied owner.
|
|
449
|
+
* Replacing a different running owner also requires matching liveness evidence.
|
|
450
|
+
* A composition builds that `LivenessEvidence` with a `LivenessProbe`.
|
|
451
|
+
* `evidence.checkedAtMs` must equal `nowMs` exactly, so evidence probed at T
|
|
452
|
+
* is refused when this operation is called at T+1. `nowMs` is the lease
|
|
453
|
+
* cutoff and the new heartbeat, so it must not run ahead of the Effect
|
|
454
|
+
* `Clock` by more than `heartbeatSkewAllowance`; a reading that does fails
|
|
455
|
+
* with `invalid_run`.
|
|
456
|
+
*/
|
|
457
|
+
readonly claimAndOwn: (runId: string, expected: RunSnapshot, owner: OwnerId, nowMs: number, evidence?: LivenessEvidence | undefined) => Effect.Effect<ClaimAndOwnOutcome, RunStoreError>;
|
|
458
|
+
readonly activate: (runId: string, claimant: OwnerId, claimedAtMs: number, expected: RunSnapshot) => Effect.Effect<ActivateOutcome, RunStoreError>;
|
|
459
|
+
readonly abandonClaim: (runId: string, claimant: OwnerId, claimedAtMs: number) => Effect.Effect<AbandonClaimOutcome, RunStoreError>;
|
|
460
|
+
/**
|
|
461
|
+
* Recovers an exact stale claim after matching its claimant and liveness
|
|
462
|
+
* evidence. A composition builds `LivenessEvidence` with a `LivenessProbe`.
|
|
463
|
+
* `evidence.checkedAtMs` must equal `nowMs` exactly, so evidence probed at T
|
|
464
|
+
* is refused when this operation is called at T+1. `nowMs` is the staleness
|
|
465
|
+
* cutoff, so it must not run ahead of the Effect `Clock` by more than
|
|
466
|
+
* `heartbeatSkewAllowance`; a reading that does fails with `invalid_run`.
|
|
467
|
+
* `claimedAtMs` is the fence token compared against the row and carries no
|
|
468
|
+
* such bound.
|
|
469
|
+
*/
|
|
470
|
+
readonly recoverClaim: (runId: string, staleClaimant: OwnerId, claimedAtMs: number, observer: OwnerId, nowMs: number, evidence: LivenessEvidence) => Effect.Effect<RecoverClaimOutcome, RunStoreError>;
|
|
471
|
+
/**
|
|
472
|
+
* Renews the owner's lease. The write is monotonic, so a reading behind the
|
|
473
|
+
* persisted heartbeat still reports `Updated` without moving it back. `nowMs`
|
|
474
|
+
* must not run ahead of the Effect `Clock` by more than
|
|
475
|
+
* `heartbeatSkewAllowance`; a reading that does fails with `invalid_run`
|
|
476
|
+
* instead of pinning the lease past the cutoff.
|
|
477
|
+
*/
|
|
478
|
+
readonly heartbeat: (runId: string, owner: OwnerId, nowMs: number) => Effect.Effect<HeartbeatOutcome, RunStoreError>;
|
|
479
|
+
/**
|
|
480
|
+
* Reconfirms an exclusively owned lease after a missed heartbeat budget.
|
|
481
|
+
* Uses the same validation and transactional mirror as `heartbeat`, but
|
|
482
|
+
* refuses a pending takeover claim even before the claimant activates.
|
|
483
|
+
*/
|
|
484
|
+
readonly reconfirm: (runId: string, owner: OwnerId, nowMs: number) => Effect.Effect<HeartbeatOutcome, RunStoreError>;
|
|
485
|
+
readonly transitionOwned: (runId: string, owner: OwnerId, toStatus: RunStatus, stateJson?: string | undefined, guard?: TransitionGuard | undefined) => Effect.Effect<TransitionOutcome, RunStoreError>;
|
|
486
|
+
/**
|
|
487
|
+
* Steals an exact run snapshot after matching liveness evidence for its
|
|
488
|
+
* recorded owner. A composition builds `LivenessEvidence` with a
|
|
489
|
+
* `LivenessProbe`. `evidence.checkedAtMs` must equal `nowMs` exactly, so
|
|
490
|
+
* evidence probed at T is refused when this operation is called at T+1.
|
|
491
|
+
* `LivenessUnconfirmed` means the evidence did not match and no
|
|
492
|
+
* compare-and-swap ran. `nowMs` is the staleness cutoff, so it must not run
|
|
493
|
+
* ahead of the Effect `Clock` by more than `heartbeatSkewAllowance`; a
|
|
494
|
+
* reading that does fails with `invalid_run` before any comparison.
|
|
495
|
+
*/
|
|
496
|
+
readonly steal: (runId: string, expected: RunSnapshot, claimant: OwnerId, nowMs: number, evidence: LivenessEvidence) => Effect.Effect<StealOutcome, RunStoreError>;
|
|
497
|
+
}
|
|
498
|
+
declare const RunStore_base: Context.ServiceClass<RunStore, "@smthrs/run-store/RunStore", Service>;
|
|
499
|
+
/**
|
|
500
|
+
* Service tag for fenced run persistence.
|
|
501
|
+
*
|
|
502
|
+
* The identity string equals the defining module path, which is how every
|
|
503
|
+
* service in this package is named.
|
|
504
|
+
*
|
|
505
|
+
* @since 0.1.0
|
|
506
|
+
* @category services
|
|
507
|
+
*/
|
|
508
|
+
export declare class RunStore extends RunStore_base {
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Constructs the production `RunStore` implementation.
|
|
512
|
+
*
|
|
513
|
+
* `state_json` is executable state: it is decoded and re-entered on every
|
|
514
|
+
* resume, so it is persisted and returned byte-for-byte. Nothing rewrites it
|
|
515
|
+
* on the way through — a redactor here would silently change what the flow
|
|
516
|
+
* re-reads (issue #72). `Schema.Redacted` hides inspection but allows schema
|
|
517
|
+
* JSON encoding by default. Use `Schema.Redacted(Schema.String, {
|
|
518
|
+
* disallowJsonEncode: true })` to refuse JSON encoding, or exclude credentials
|
|
519
|
+
* from the persistence schema and store a secret reference resolved from a
|
|
520
|
+
* secret provider on resume. Publication hygiene belongs on journal-event
|
|
521
|
+
* and export surfaces.
|
|
522
|
+
*
|
|
523
|
+
* `state_json` and `flows_attempts.outcome_json` therefore hold unredacted
|
|
524
|
+
* run inputs and results, so the run's SQLite file (`.flows/*.db`) must be
|
|
525
|
+
* handled as a secret store.
|
|
526
|
+
*
|
|
527
|
+
* @since 0.1.0
|
|
528
|
+
* @category constructors
|
|
529
|
+
*/
|
|
530
|
+
export declare const make: Effect.Effect<Service, never, Consensus | DurableWriter | SqlClient.SqlClient>;
|
|
531
|
+
/**
|
|
532
|
+
* Constructs a stub `RunStore` whose direct operations fail and whose
|
|
533
|
+
* compare-and-swap operations report typed losses until overridden.
|
|
534
|
+
*
|
|
535
|
+
* @since 0.1.0
|
|
536
|
+
* @category constructors
|
|
537
|
+
*/
|
|
538
|
+
export declare const makeNoop: (overrides?: Partial<Service>) => Service;
|
|
539
|
+
/**
|
|
540
|
+
* Provides a stub `RunStore`.
|
|
541
|
+
*
|
|
542
|
+
* @since 0.1.0
|
|
543
|
+
* @category layers
|
|
544
|
+
*/
|
|
545
|
+
export declare const layerNoop: (overrides?: Partial<Service>) => Layer.Layer<RunStore>;
|
|
546
|
+
/**
|
|
547
|
+
* Provides the database-backed `RunStore` over an explicitly injected
|
|
548
|
+
* consensus strategy.
|
|
549
|
+
*
|
|
550
|
+
* Arbitration — claims, activation, steals, heartbeats, and fence checks — is
|
|
551
|
+
* delegated to the `Consensus` service in context; the run row mirrors the
|
|
552
|
+
* outcome in the same transaction. Provide the SAME strategy instance the
|
|
553
|
+
* journal fences through (`SqlJournal.layerWith`), because
|
|
554
|
+
* `Consensus.layerLocal` keeps its leases per layer build.
|
|
555
|
+
*
|
|
556
|
+
* @since 1.0.0
|
|
557
|
+
* @category layers
|
|
558
|
+
*/
|
|
559
|
+
export declare const layerWith: Layer.Layer<RunStore, never, Consensus | DurableWriter | SqlClient.SqlClient>;
|
|
560
|
+
/**
|
|
561
|
+
* Provides the database-backed `RunStore` arbitrated by the database-backed
|
|
562
|
+
* strategy, `SqlConsensus`, over the same client — the strategy
|
|
563
|
+
* `SqlJournal.layer` fences through. Use {@link layerWith} to inject a
|
|
564
|
+
* different strategy.
|
|
565
|
+
*
|
|
566
|
+
* @since 0.1.0
|
|
567
|
+
* @category layers
|
|
568
|
+
*/
|
|
569
|
+
export declare const layer: Layer.Layer<RunStore, never, DurableWriter | SqlClient.SqlClient>;
|
|
570
|
+
export {};
|
|
571
|
+
//# sourceMappingURL=RunStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunStore.d.ts","sourceRoot":"","sources":["../../src/RunStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAA8B,aAAa,EAAgB,MAAM,gCAAgC,CAAA;AACxG,OAAO,EAEL,SAAS,EAET,KAAK,gBAAgB,EAGtB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD,OAAO,EAAS,OAAO,EAAY,MAAM,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AAChF,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAiC1D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SAAU,CAAA;AAQ1C;;;;;GAKG;AACH,eAAO,MAAM,SAAS,mGAOpB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,gEAAwD,CAAA;AAEtF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,KAAG,MAAM,IAAI,iBACO,CAAA;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,iHAM5B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