@effect-agent/storage-sqlite 0.1.0-beta.14 → 0.1.0-beta.15
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/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/sqlite-ledger.ts +17 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-agent/storage-sqlite",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.15",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@effect-agent/session": "0.1.0-beta.
|
|
11
|
+
"@effect-agent/session": "0.1.0-beta.15",
|
|
12
12
|
"@effect/platform-node": "4.0.0-beta.107",
|
|
13
13
|
"@effect/sql-sqlite-node": "4.0.0-beta.107",
|
|
14
14
|
"effect": "4.0.0-beta.107"
|
package/src/sqlite-ledger.ts
CHANGED
|
@@ -2173,10 +2173,16 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
|
|
|
2173
2173
|
operation,
|
|
2174
2174
|
Effect.gen(function* () {
|
|
2175
2175
|
const parent = yield* requireSubmission(operation, validated.parentSubmissionId);
|
|
2176
|
-
// The
|
|
2177
|
-
//
|
|
2176
|
+
// The caller may notify after the canonical Settlement append but before ledger
|
|
2177
|
+
// finalization. An exact reservation plus `terminalizing` is the narrow durable prefix
|
|
2178
|
+
// that makes that ordering admissible; earlier states remain a caller error.
|
|
2178
2179
|
const child = yield* readSubmission(operation, validated.childSubmissionId);
|
|
2179
|
-
|
|
2180
|
+
const childReservation = yield* readReservation(operation, validated.childSubmissionId);
|
|
2181
|
+
const announced =
|
|
2182
|
+
Option.isSome(child) &&
|
|
2183
|
+
(child.value.state === "settled" ||
|
|
2184
|
+
(child.value.state === "terminalizing" && Option.isSome(childReservation)));
|
|
2185
|
+
if (!announced) {
|
|
2180
2186
|
return yield* LedgerError.make({
|
|
2181
2187
|
operation,
|
|
2182
2188
|
message: `Child submission ${validated.childSubmissionId} has no recorded settlement.`,
|
|
@@ -2205,11 +2211,16 @@ const makeServices = Effect.fn("SqliteSubmissionLedger.makeServices")(function*
|
|
|
2205
2211
|
) {
|
|
2206
2212
|
return "not-waiting" as ChildSettledOutcome;
|
|
2207
2213
|
}
|
|
2208
|
-
//
|
|
2209
|
-
//
|
|
2214
|
+
// Every listed child must be either finalized or canonically announced from the exact
|
|
2215
|
+
// terminalizing reservation. Replays re-run this coverage check idempotently.
|
|
2210
2216
|
for (const entry of reason.children) {
|
|
2211
2217
|
const listed = yield* readSubmission(operation, entry.childSubmissionId);
|
|
2212
|
-
|
|
2218
|
+
const reservation = yield* readReservation(operation, entry.childSubmissionId);
|
|
2219
|
+
const covered =
|
|
2220
|
+
Option.isSome(listed) &&
|
|
2221
|
+
(listed.value.state === "settled" ||
|
|
2222
|
+
(listed.value.state === "terminalizing" && Option.isSome(reservation)));
|
|
2223
|
+
if (!covered) {
|
|
2213
2224
|
return "still-waiting" as ChildSettledOutcome;
|
|
2214
2225
|
}
|
|
2215
2226
|
}
|