fix(ci): fail the build when a single source yields no events

The feed sanity check only had a floor on the total, which is blind to the
failure it exists to catch: nine healthy sources hold the number comfortably
over twenty while the tenth has gone to zero and that game shows an empty
calendar. Check per source, and print the per-source counts so a drop is
legible in the log before it is a failure.

Zero is unambiguous here. A live snapshot that parsed to nothing is refused by
the refresh runner and never stored, so a source at zero in the feed means the
checked-in fixture stopped parsing — a regression in our code, not a quiet week
for that game.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Lucas Winther
2026-08-17 21:55:22 +02:00
co-authored by Claude Opus 5
parent 286aadefc4
commit d2615c606c
+15
View File
@@ -61,12 +61,27 @@ jobs:
const feed = await Bun.file("public/data/events.v1.json").json(); const feed = await Bun.file("public/data/events.v1.json").json();
const games = new Set(feed.events.map((e) => e.game)); const games = new Set(feed.events.map((e) => e.game));
console.log(`${feed.events.length} events across ${games.size} games`); console.log(`${feed.events.length} events across ${games.size} games`);
for (const s of feed.sources) {
console.log(` ${s.sourceId.padEnd(24)} ${String(s.eventCount).padStart(3)}`);
}
if (feed.events.length < 20) { if (feed.events.length < 20) {
throw new Error(`feed collapsed to ${feed.events.length} events`); throw new Error(`feed collapsed to ${feed.events.length} events`);
} }
if (feed.events.some((e) => !e.startsAt)) { if (feed.events.some((e) => !e.startsAt)) {
throw new Error("events without a start date"); throw new Error("events without a start date");
} }
// Per source, not just in total: nine healthy sources hide a tenth
// that has gone to zero, and the total stays comfortably over the
// floor while one game shows an empty calendar. A live snapshot
// that parsed to nothing is refused upstream and never stored, so
// zero here means the fixture stopped parsing — a regression in our
// code, not a quiet week for that game.
const empty = feed.sources.filter((s) => s.eventCount === 0);
if (empty.length > 0) {
throw new Error(
`sources yielding no events: ${empty.map((s) => s.sourceId).join(", ")}`,
);
}
' '
build: build: