assert(!saveSource.includes('writeCompactMirror'),'save() still writes the full mirror before persistence');
assert((persistSource.match(/snapshotForStorage\(/g)||[]).length===1&&(persistSource.match(/writeCompactMirror\(/g)||[]).length===1,'IndexedDB persistence still builds or writes a full mirror');
assert(persistSource.includes('scheduleMirrorCheckpoint()'),'Successful IndexedDB persistence does not schedule an idle recovery checkpoint');
assert(!app.includes("pagehide',()=>{try{writeCompactMirror")&&!app.includes("visibilitychange',()=>{if(document.visibilityState==='hidden')try{writeCompactMirror"),'Lifecycle handlers still rebuild the mirror directly');
assert(pullCloudSource.indexOf('cloudProfileIdentity()!==profileIdentity')<pullCloudSource.indexOf('data.cloudRevision='),'Cloud pull mutates revision before confirming the active profile');
assert(pushCloudSource.includes('mergeCloudPending(cloudPushPending,pending)')&&pushCloudSource.indexOf('cloudProfileIdentity()!==profileIdentity')<pushCloudSource.indexOf('acknowledgeCloudPending('),'Cloud push acknowledges work before confirming the active profile');
assert(batch.metaIds.size===1&&batch.metaIds.has('B0')&&batch.stateIds.has('B0')&&remainder.metaIds.size===599&&batch.deleted.has('B999')&&batch.globalChanged,'Cloud batching did not isolate one complete board mutation');
writeCompactMirror:snapshot=>{assert(snapshot.updatedAt===123456,'Mirror did not use the captured persistence snapshot');writes.mirror++;returntrue},safeLocalSet:()=>{writes.mirror++;returntrue},
assert(writes.meta===1&&writes.state===1&&writes.global===1,'Incremental database stores were not written once');
assert(writes.snapshot===0&&writes.mirror===0,'Ordinary IndexedDB persistence built or synchronously wrote a full mirror');
assert(writes.checkpoint===1,'Ordinary IndexedDB persistence did not schedule one idle mirror checkpoint');
assert(recoveryWrites.some(row=>row.key==='covered:test-session'&&row.value.seq===3)&&recoveryWrites.some(row=>row.key==='covered:prior-session'&&row.value.seq===6),'Persistence did not atomically write current and recovered-session coverage markers');
assert(journalClears.length===1&&journalClears[0].seq===3&&journalClears[0].covered[0]._storageKey==='journal:prior','Committed recovery journals were not passed to cleanup after persistence');
assert(context.dirtyMetaIds.size===0&&context.dirtyStateIds.size===0&&!context.globalDirty,'Dirty state was not cleared after persistence');
constsecond=awaitcontext.persistDirtyToDb();
assert(second.skipped,'Unchanged persistence did not exit early');
assert(writes.snapshot===0&&writes.mirror===0&&writes.checkpoint===1&&writes.global===1,'Unchanged persistence performed additional work');
assert(!deletionCommit.skipped&&context.deletedBoardIds.has('B9')&&context.deletedBoardRevisions.get('B9')===11,'A newer deletion tombstone was cleared by an older in-flight commit');
assert(writes.mirror===beforeFailure.mirror&&writes.snapshot===beforeFailure.snapshot&&writes.checkpoint===beforeFailure.checkpoint&&writes.signal===beforeFailure.signal&&writes.cloud===beforeFailure.cloud,'Database failure published or checkpointed an uncommitted save');
assert(profileFailed&&profileRetrySchedules===1&&profileContext.data.cloudProfile?.playerId==='a'.repeat(16),'Uncommitted cloud profile was treated as a completed checkpoint');
assert(profileChangedResult===false&&acknowledged===0&&cloudContext.data.cloudRevision===5,'Cloud response from an obsolete profile was acknowledged');
assert(cloudContext.cloudPushPending.metaIds.has('B0')&&armedDelay===5000,'Profile-switch guard did not restore and defer pending cloud work');