'use strict'; const { test } = require('node:test'); const assert = require('node:assert/strict'); const { MongoClient, ObjectId } = require('mongodb'); const { syncRunReportPage } = require('../../server/lib/syncRunReportPage'); const uri = process.env.WEKAN_SYNC_TEST_MONGO_URL; test('Recovery reads retained Sync reports with stable pages, literal search and no private fields', { skip: !uri }, async t => { const client = await new MongoClient(uri).connect(); const db=client.db(`sync_recovery_${new ObjectId().toHexString()}`), collection=db.collection('reports'); t.after(async()=>{await db.dropDatabase();await client.close();}); const now=new Date(); await collection.insertMany(Array.from({length:23},(_,i)=>({_id:`run-${String(i).padStart(2,'0')}`, startedAt:now,boardId:'board',listId:'literal.*list',status:'unfinished',incarnation:'private-lifetime',token:'SECRET', coverage:{source:{rows:[{path:'/