@effect-agent/storage-cloudflare 0.1.0-beta.14 → 0.1.0-beta.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-agent/storage-cloudflare",
3
- "version": "0.1.0-beta.14",
3
+ "version": "0.1.0-beta.16",
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.14",
11
+ "@effect-agent/session": "0.1.0-beta.16",
12
12
  "@effect/platform-browser": "4.0.0-beta.107",
13
13
  "@effect/sql-sqlite-do": "4.0.0-beta.107",
14
14
  "effect": "4.0.0-beta.107"
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@cloudflare/vitest-pool-workers": "0.21.3",
38
38
  "@cloudflare/workers-types": "5.20260813.1",
39
- "@effect-agent/testing": "0.1.0-beta.6",
39
+ "@effect-agent/testing": "0.1.0-beta.14",
40
40
  "@effect/vitest": "4.0.0-beta.107",
41
41
  "typescript": "7.0.2",
42
42
  "vite-plus": "0.2.6",
package/src/do-ledger.ts CHANGED
@@ -2254,12 +2254,18 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2254
2254
  Effect.gen(function* () {
2255
2255
  const parent = yield* requireSubmission(operation, validated.parentSubmissionId);
2256
2256
  // The child's canonical Settlement is the authority for this wake. When the child's
2257
- // row lives in THIS store (single-store latitude, and every conformance lane), an
2258
- // unsettled child makes the notification a caller error exactly as on Node. When it
2259
- // does not the normal cross-DO case the routed notification from the child's
2260
- // owning Durable Object is the settlement evidence this store records durably.
2257
+ // row lives in THIS store (single-store latitude, and every conformance lane), either a
2258
+ // finalized row or an exact terminalizing reservation admits the notification: the
2259
+ // runtime calls only after the canonical append and before ledger finalization. When the
2260
+ // row does not live here — the normal cross-DO case the routed notification from the
2261
+ // child's owning Durable Object is the settlement evidence this store records durably.
2261
2262
  const child = yield* readSubmission(operation, validated.childSubmissionId);
2262
- if (Option.isSome(child) && child.value.state !== "settled") {
2263
+ const childReservation = yield* readReservation(operation, validated.childSubmissionId);
2264
+ if (
2265
+ Option.isSome(child) &&
2266
+ child.value.state !== "settled" &&
2267
+ !(child.value.state === "terminalizing" && Option.isSome(childReservation))
2268
+ ) {
2263
2269
  return yield* LedgerError.make({
2264
2270
  operation,
2265
2271
  message: `Child submission ${validated.childSubmissionId} has no recorded settlement.`,
@@ -2279,7 +2285,13 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
2279
2285
  ) VALUES (
2280
2286
  ${validated.parentSubmissionId},
2281
2287
  ${validated.childSubmissionId},
2282
- ${Option.isSome(child) ? child.value.settled_outcome : null},
2288
+ ${
2289
+ Option.isSome(child) && child.value.state === "settled"
2290
+ ? child.value.settled_outcome
2291
+ : Option.isSome(childReservation)
2292
+ ? childReservation.value.outcome
2293
+ : null
2294
+ },
2283
2295
  ${now.iso}
2284
2296
  )
2285
2297
  ON CONFLICT (parent_submission_id, child_submission_id) DO NOTHING