@effect-agent/storage-sqlite 0.1.0-beta.53 → 0.1.0-beta.54

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.
@@ -799,7 +799,20 @@ const makeServices = Effect.fn("SqliteThreadStore.makeServices")(function* () {
799
799
  message: `Expected at most one checkpoint row but found ${rows.length}.`,
800
800
  });
801
801
  }
802
- const checkpoint = yield* decodeCheckpoint(rows[0].checkpoint_json);
802
+ const row = rows[0];
803
+ const checkpoint = yield* decodeCheckpoint(row.checkpoint_json);
804
+
805
+ if (
806
+ row.thread_id !== validated.threadId ||
807
+ checkpoint.threadId !== row.thread_id ||
808
+ checkpoint.throughSequence !== row.through_sequence ||
809
+ checkpoint.tailDigest !== row.tail_digest
810
+ ) {
811
+ return yield* ThreadStoreError.make({
812
+ operation: "load checkpoint",
813
+ message: "Stored checkpoint metadata does not match its canonical row.",
814
+ });
815
+ }
803
816
 
804
817
  const canonicalDigest = yield* tailDigestAt(
805
818
  journal,
@@ -1164,6 +1164,7 @@ export const initializeSqliteJournal = Effect.fn("SqliteJournal.initialize")(fun
1164
1164
  saveCheckpoint,
1165
1165
  scanStoredPayloads,
1166
1166
  withWriteTransaction,
1167
+ withReadTransaction,
1167
1168
  } as const;
1168
1169
  });
1169
1170