@@ -53,6 +53,15 @@ export interface DownloadResult {
5353 path : string ;
5454}
5555
56+ export interface DownloadAllOptions {
57+ /**
58+ * Ignore the stored incremental cursor and reconcile from the beginning of the
59+ * owner's file registry. This repairs browser caches whose cursor advanced
60+ * while local IndexedDB/OPFS lost or failed to index some older records.
61+ */
62+ fullReconcile ?: boolean ;
63+ }
64+
5665interface SyncFailureMetadata {
5766 stage ?: SyncFailureStage ;
5867 scope ?: string ;
@@ -284,6 +293,7 @@ export async function downloadOne(
284293 */
285294export async function downloadAll (
286295 deps : DownloadWorkerDeps ,
296+ options : DownloadAllOptions = { } ,
287297) : Promise < DownloadResult [ ] > {
288298 const { gateway, cursor, serverOwner, logger } = deps ;
289299 const syncRunId = createSyncRunId ( ) ;
@@ -292,7 +302,14 @@ export async function downloadAll(
292302
293303 // 1. Read cursor
294304 const lastProcessedTimestamp =
295- repairSummary . missingEnvelopeEntries > 0 ? null : await cursor . read ( ) ;
305+ options . fullReconcile || repairSummary . missingEnvelopeEntries > 0
306+ ? null
307+ : await cursor . read ( ) ;
308+ if ( options . fullReconcile ) {
309+ logger . info (
310+ "Running full registry reconciliation to repair any missing local scope records" ,
311+ ) ;
312+ }
296313 if ( repairSummary . missingEnvelopeEntries > 0 ) {
297314 logger . warn (
298315 { missingEnvelopeEntries : repairSummary . missingEnvelopeEntries } ,
0 commit comments