@tomflow/chatloop-context 0.1.1 → 0.1.2

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.
@@ -267,6 +267,17 @@ export async function fenceLegacyProjectStore({
267
267
  // Back up without holding a write transaction (sqlite backup cannot
268
268
  // safely snapshot its own live writer). Recheck inside the lock below.
269
269
  const snapshot=await backupContextDb(db,backupPath);
270
+ // An online backup is not cutover evidence until the recovered logical
271
+ // rows match the source that was reviewed before taking the write lock.
272
+ const backedUp=new DatabaseSync(backupPath,{readOnly:true});
273
+ try{
274
+ validateSchema(backedUp);
275
+ ensure(logicalDigest(backedUp)===originalDigest,
276
+ 'CUTOVER_BACKUP_CONTENT_MISMATCH');
277
+ ensure(backedUp.prepare('PRAGMA integrity_check').get()?.integrity_check==='ok'
278
+ &&backedUp.prepare('PRAGMA foreign_key_check').all().length===0,
279
+ 'CUTOVER_BACKUP_INTEGRITY_FAILED');
280
+ }finally{backedUp.close()}
270
281
  db.exec('BEGIN IMMEDIATE');
271
282
  try{
272
283
  const get=k=>db.prepare('SELECT value FROM meta WHERE key=?').get(k)?.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-context",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Independent local Context SDK and short-lived CLI for Chat Loop projects",
6
6
  "publishConfig": {"access": "public"},