fix: stop failing the build on a page that says it has no events
Infinity Nikki's wiki prints "There are no Events in this category" between versions, and the refresh runner has honoured that since 2026-09-03 — it stores the empty parse as the source's real answer rather than letting a quiet lane reach the broken tier. The feed build never asked, so the same page arrived at CI as parsedCount 0, indistinguishable from a parser that has stopped reading a redesigned page, and brokenSources failed every build while every refresh stayed green. The runner's verdict cannot travel on its own: only a parser has seen the page, and by the time brokenSources runs there is nothing left but the feed. So the fact rides on SourceHealth, defaulted so an older feed the service worker cached keeps validating and reads as the strict answer. Both ends now ask it the same way — of an empty parse only, from the page's own words only — because a redesign yields zero rows too, and excusing that is the silently emptied calendar the gate exists for. The rule sits in a module rather than in build-feed.ts, which writes public/ and so runs a build if a test imports it. That is how the two ends drifted apart with nothing to catch it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
e51585f2b2
commit
1156c358a7
+27
-1
@@ -34,6 +34,26 @@ export const SourceHealth = z.object({
|
||||
* than evidence of a fault.
|
||||
*/
|
||||
parsedCount: z.number().int().nonnegative().nullable().default(null),
|
||||
/**
|
||||
* The page itself says it currently lists no events.
|
||||
*
|
||||
* The third of the three ways a source can read zero, and the only one the
|
||||
* feed could not previously express. A redesigned page the parser can no
|
||||
* longer read, a page whose events have all ended, and a page printing
|
||||
* "There are no Events in this category" all arrive as `parsedCount: 0` —
|
||||
* and the last one is a source *answering*, not failing.
|
||||
*
|
||||
* `scripts/refresh-sources.ts` has drawn this distinction since 2026-09-03
|
||||
* and the feed did not, so a correctly quiet lane reddened CI every build.
|
||||
* Carried here because `brokenSources` runs against the feed and has nothing
|
||||
* else to go on: only the parser has seen the page.
|
||||
*
|
||||
* **Set from the page's own words, never from a row count** — a redesign
|
||||
* yields zero rows too, and excusing *that* is the silently emptied calendar
|
||||
* the check exists for. Defaulted rather than required, for the reason
|
||||
* `parsedCount` is: an older cached feed must keep validating.
|
||||
*/
|
||||
statesNoEvents: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export const EventFeed = z.object({
|
||||
@@ -120,9 +140,15 @@ export function freshness(
|
||||
* page and a broken parser arrived as the same zero. Only an explicit zero
|
||||
* counts here; a null is an older feed that never recorded the figure, and
|
||||
* failing on missing information would be the same mistake in a new place.
|
||||
*
|
||||
* Nor is a page that states its own emptiness, which is that same mistake a
|
||||
* third time: a gacha calendar goes quiet between versions, and Infinity
|
||||
* Nikki's wiki says so in words. `statesNoEvents` is the page answering, so it
|
||||
* is excused here exactly as the refresh runner already excuses it — see that
|
||||
* field, and `scripts/refresh-sources.ts`.
|
||||
*/
|
||||
export function brokenSources(sources: readonly SourceHealth[]): SourceHealth[] {
|
||||
return sources.filter((s) => s.parsedCount === 0);
|
||||
return sources.filter((s) => s.parsedCount === 0 && !s.statesNoEvents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user