@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.
- package/lib/project-diagnostic.mjs +11 -0
- package/package.json +1 -1
|
@@ -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;
|