Skip to content

LIBERATED AI CHAT

TypeScript

fix: use recursive listing when scanning archive/legacy for manifests

faber9f714a09fce3
diff --git a/scripts/compact-hf-telemetry.mjs b/scripts/compact-hf-telemetry.mjs
index d23e4ec..586bec2 100644
--- a/scripts/compact-hf-telemetry.mjs
+++ b/scripts/compact-hf-telemetry.mjs
@@ -39,13 +39,14 @@ if (!TOKEN) {
const headers = { Authorization: `Bearer ${TOKEN}` };
// ── Paginated file listing ──────────────────────────────────────────
-async function listAllFiles(prefix) {
+async function listAllFiles(prefix, recursive = false) {
const allFiles = [];
let cursor = null;
while (true) {
const params = new URLSearchParams();
if (cursor) params.set('cursor', cursor);
+ if (recursive) params.set('recursive', 'true');
const url = `${HF_API}/datasets/${DATASET_REPO}/tree/${BRANCH}/${prefix}?${params}`;
const res = await fetch(url, { headers });
if (!res.ok) throw new Error(`List failed (${res.status}): ${await res.text()}`);
@@ -145,7 +146,7 @@ async function main() {
console.log(`Step 2: Checking for existing manifest (run ID: ${currentRunId})...`);
// Also check if a DIFFERENT run's manifest exists (partial deletion scenario)
- const archiveLegacyEntries = await listAllFiles('archive/legacy');
+ const archiveLegacyEntries = await listAllFiles('archive/legacy', true);
const existingManifests = archiveLegacyEntries.filter(
f => f.type === 'file' && f.path.endsWith('/manifest.json')
);