From af8aaaa51254adfbe064a6bdea1d48508d0a93b4 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 5 Aug 2026 17:17:25 +0200 Subject: [PATCH] fix: rebuild asset sets after repair to accurately report stillMissing --- src/lib/services/catalog-audit.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/lib/services/catalog-audit.ts b/src/lib/services/catalog-audit.ts index 08bf8280..158cf20f 100644 --- a/src/lib/services/catalog-audit.ts +++ b/src/lib/services/catalog-audit.ts @@ -183,8 +183,8 @@ export async function runCatalogAudit( } })(), ]); - const iconSet = new Set(iconFiles); - const nitroSet = new Set(nitroFiles); + let iconSet = new Set(iconFiles); + let nitroSet = new Set(nitroFiles); // Badge detection: `items_base.type = 'b'` is authoritative. The album1584 // `.gif` listing is kept as a fallback for hotels that store badges with a // non-standard type. @@ -466,6 +466,15 @@ export async function runCatalogAudit( } }); + // Re-read directories so the set reflects files written + // by the repair pass. + const [repairedIconFiles, repairedNitroFiles] = await Promise.all([ + readdir(iconDir).catch(() => [] as string[]), + readdir(nitroDir).catch(() => [] as string[]), + ]); + iconSet = new Set(repairedIconFiles); + nitroSet = new Set(repairedNitroFiles); + // Re-check which of the previously-missing icons are still missing // and drop the ones the repair fixed from the issue list. The ones // left over cannot be restored from any source → legacy/broken. @@ -530,6 +539,15 @@ export async function runCatalogAudit( } }); + // Re-read directories so the set reflects files written + // by the repair pass. + const [repairedIconFiles2, repairedNitroFiles2] = await Promise.all([ + readdir(iconDir).catch(() => [] as string[]), + readdir(nitroDir).catch(() => [] as string[]), + ]); + iconSet = new Set(repairedIconFiles2); + nitroSet = new Set(repairedNitroFiles2); + // Re-check which of the previously-missing nitros are still missing // and drop the ones the repair fixed from the issue list. The ones // left over cannot be restored from any source → legacy/broken.