From 70840af187923f97c3ebd6d018b69bd8c2bba84f Mon Sep 17 00:00:00 2001 From: Florent Tapponnier Date: Tue, 26 May 2026 21:51:45 +0200 Subject: [PATCH] fix(build): tolerate all-bench-draft state instead of crashing build The safety throw 'every bench draft, refusing to update cache' crashes next build when Prom is fully unreachable during the build window. Replace the throw with a [DRAFT-TRACE] warning + return the draft array. With the snapshot/KV fallback + 10s Prom timeout + cron pre-warm already mitigating user-visible drafts, this safety net's value is marginal. --- src/lib/spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/spec.ts b/src/lib/spec.ts index b7e18659..10e5136e 100644 --- a/src/lib/spec.ts +++ b/src/lib/spec.ts @@ -126,8 +126,18 @@ const loadAllBenchmarksCached = unstable_cache( } const live = benchmarks.filter((b) => b.status === "live"); if (benchmarks.length > 0 && live.length === 0) { - throw new Error( - "loadAllBenchmarks: every bench draft, refusing to update cache", + // Previously this threw to make unstable_cache keep the previous + // value during a Prom blackout. The throw, however, propagates + // unhandled into the BUILD-time page-generation path (no previous + // cache there) and crashes `next build` with "Error: every bench + // draft". With the snapshot/KV fallback + 10s Prom timeout + cron + // pre-warm now in place, this safety net mostly fires during the + // build window of a cold deploy. Warn loudly and return the + // draft set — the page renders with placeholders and recovers on + // the next revalidate cycle. Avoids deploy crashes. + console.warn( + "[DRAFT-TRACE] all_draft slug_count=" + benchmarks.length + + " — Prom blackout during build/cold-start, returning placeholders", ); } return benchmarks.sort((a, b) => a.number.localeCompare(b.number));