Tell a broken source apart from a stale one

CI failed on Infinity Nikki yielding no events, and was wrong to. Its
snapshot parses to six events; every one of them had ended by the morning
the build ran. The parser is fine — `--now 2026-08-14` gives six, today
gives none — and the page simply has nothing current left on it.

eventCount is counted after expired events are dropped, so "this parser has
stopped reading a redesigned page" and "this page's events have all
finished" arrived as the same zero. Only the first means our code is wrong,
and only the first should redden a build. So the feed now records what each
document yields parsed as of its own capture date, before expiry, and the
check fails on that instead.

Nikki cannot refresh itself out of this, either: docs/SOURCES.md records
that Fandom refuses the Actions runner. A lane with an empty calendar is a
real problem, but it is a refresh problem, so it is reported on the build
log and left visible rather than thrown.

parsedCount is nullable and defaulted, never required: the client validates
the whole feed with safeParse and the service worker serves the last feed it
downloaded, so a required field would have made every cached feed fail
validation and taken the offline promise with it. Null also covers a source
whose bytes were never confirmed live — there is no date to parse "as of",
and a build is not failed on missing information.

The rule moved to shared/feed.ts. A test did pin the old one, by grepping
the workflow for the string — which proved the check existed, never that it
was right.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Lucas Winther
2026-08-28 05:54:17 +02:00
co-authored by Claude Opus 5
parent 96d5230f29
commit ef109f224b
8 changed files with 177 additions and 15 deletions
+7 -3
View File
@@ -1047,12 +1047,16 @@ describe("the workflows that drive the refresh", () => {
expect(refresh.slice(health)).toContain("exit 1");
});
test("ci.yml fails when any one source yields no events", async () => {
test("ci.yml fails a source that parsed nothing, not one whose events ended", async () => {
// The total-event floor is blind to one source going to zero while nine
// others hold the number up, which shows the reader an empty calendar for
// that game.
// that game. But the old rule was `eventCount === 0`, counted after
// expiry, so a page whose events had all merely finished failed the build
// too. Grepping this file can only say which rule is wired up; whether it
// is the right one is exercised in test/feed.test.ts.
const ci = await read("ci.yml");
expect(ci).toContain("eventCount === 0");
expect(ci).toContain("brokenSources");
expect(ci).not.toContain("eventCount === 0");
});
});