@effect-agent/storage-cloudflare 0.1.0-beta.18 → 0.1.0-beta.20

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.18",
3
+ "version": "0.1.0-beta.20",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.mts",
@@ -8,10 +8,10 @@
8
8
  }
9
9
  },
10
10
  "dependencies": {
11
- "@effect-agent/session": "0.1.0-beta.18",
12
- "@effect/platform-browser": "4.0.0-beta.107",
13
- "@effect/sql-sqlite-do": "4.0.0-beta.107",
14
- "effect": "4.0.0-beta.107"
11
+ "@effect-agent/session": "0.1.0-beta.20",
12
+ "@effect/platform-browser": "4.0.0-rc.110",
13
+ "@effect/sql-sqlite-do": "4.0.0-rc.110",
14
+ "effect": "4.0.0-rc.110"
15
15
  },
16
16
  "description": "Durable Object SQLite storage adapters and the routed port protocol for Effect Agent on Cloudflare.",
17
17
  "license": "MIT",
@@ -36,8 +36,8 @@
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.14",
40
- "@effect/vitest": "4.0.0-beta.107",
39
+ "@effect-agent/testing": "0.1.0-beta.19",
40
+ "@effect/vitest": "4.0.0-rc.110",
41
41
  "typescript": "7.0.2",
42
42
  "vite-plus": "0.2.6",
43
43
  "vitest": "4.1.10"
package/src/do-ledger.ts CHANGED
@@ -62,6 +62,7 @@ import {
62
62
  SubmissionSnapshot,
63
63
  SubmissionState,
64
64
  SettlementReservationSnapshot,
65
+ settlementFailureFromRecord,
65
66
  SuspendRequest,
66
67
  SuspensionReason,
67
68
  SuspensionSnapshot,
@@ -1593,6 +1594,27 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1593
1594
  existingOutcome: reservation.value.outcome,
1594
1595
  });
1595
1596
  }
1597
+ const reservationRecord = yield* decodeRecordEnvelopeText(
1598
+ reservation.value.record_json,
1599
+ ).pipe(
1600
+ Effect.mapError((error) =>
1601
+ corruptionFailure(
1602
+ operation,
1603
+ "effect_agent_settlement_reservations",
1604
+ validated.submissionId,
1605
+ error.message,
1606
+ ),
1607
+ ),
1608
+ );
1609
+ const settlementFailure = settlementFailureFromRecord(reservationRecord);
1610
+ if ((reservation.value.outcome === "failed") !== (settlementFailure !== undefined)) {
1611
+ return yield* corruptionFailure(
1612
+ operation,
1613
+ "effect_agent_settlement_reservations",
1614
+ validated.submissionId,
1615
+ "The reserved outcome and canonical failure diagnostic disagree.",
1616
+ );
1617
+ }
1596
1618
  const submission = yield* requireSubmission(operation, validated.submissionId);
1597
1619
  if (submission.state === "settled") {
1598
1620
  if (reservation.value.finalized_at === null) {
@@ -1608,6 +1630,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1608
1630
  settlementId: validated.settlementId,
1609
1631
  receiptId: submission.receipt_id,
1610
1632
  outcome: reservation.value.outcome,
1633
+ ...(settlementFailure === undefined ? {} : { failure: settlementFailure }),
1611
1634
  settledAt: reservation.value.finalized_at,
1612
1635
  }).pipe(Effect.mapError(internalFailure(operation)));
1613
1636
  }
@@ -1631,6 +1654,7 @@ const makeServices = Effect.fn("DoSubmissionLedger.makeServices")(function* () {
1631
1654
  settlementId: validated.settlementId,
1632
1655
  receiptId: submission.receipt_id,
1633
1656
  outcome: reservation.value.outcome,
1657
+ ...(settlementFailure === undefined ? {} : { failure: settlementFailure }),
1634
1658
  settledAt: now.iso,
1635
1659
  }).pipe(Effect.mapError(internalFailure(operation)));
1636
1660
  }),