feat(holodori): track hololive Dreams from its own wiki
New holodoriwiki parser plus the holodori-holodoriwiki-events source, giving the game its two live and upcoming events at exact precision. holodori.wiki is Miraheze, so this is the same call bawiki makes and for the same reason: robots.txt disallows /w/ and /*?action=, which closes the API route and leaves the rendered /wiki/Events page as the surface * is allowed. It serves our own User-Agent a 200, sets no Content-Signal and no Crawl-delay for us, and the wiki is CC BY-SA 4.0. What makes this source unusually good is that it states its timezone on every cell — 08/17/2026 8:00PM (JST) — so it is the only wiki source here publishing exact precision on both boundaries without a per-region timer. parseSlashClockZone requires that zone rather than defaulting to UTC: a row that ever loses it drops out instead of silently landing nine hours off, and an abbreviation absent from the table is refused rather than guessed, which is why the table holds only JST and not the plausible-looking candidates that are not fixed offsets. The 12-hour clock gets its own handling and its own tests, because 12PM and 12AM are the two readings a naive parser gets wrong while still producing a valid-looking instant. Inclusion is fenced by the Current Events <h2> and bounded by the next one. That matters more than it looks: Past Events sits directly below with identical columns, so a reader taking every wikitable would put the back catalogue on the calendar with nothing to mark it. Rows are still checked against ctx.now on top of the heading, because Current is maintained by hand and goes stale before anyone moves a row down. Two rows are deliberately missing. Beginner Mission runs Game Launch → Unknown, and no start means no event ID — a permanent tutorial chore is not what a calendar of deadlines is for. An Unknown end is kept as endsAt null, and unlike bawiki this parser does not drop a started-but-undated row: the heading has already said the event is running, which is the fact bawiki lacks when reading an archive. Every event title is still a red link — the wiki has no article for any of them yet — so each points at ?action=edit&redlink=1, a create-page form on a path this robots.txt disallows. Refusing a href with a query keeps those out and falls back to the events page; the articles get linked when they exist, with no change here. holodori gets resetOffsets of UTC+9 across all three regions, evidenced rather than assumed the way Arknights' is: the game launched worldwide simultaneously on one service, every boundary is stated in JST, and Training Support Missions ends at 3:59AM JST, one minute before a 04:00 local reset. Only the offset is overridden; the hour is the default. Setting it now is free, because no reader has a day key for a game the app has never shipped — the same override a year from now would re-label ticks already logged. Both boundaries and the exclusions are asserted against an independent extraction off the fixture, computed through a timezone library rather than by the parser's own arithmetic. Several counts in AGENTS.md and PRD.md were already stale before this — the Fate/Grand Order source did not update them — and are corrected to what the tree now holds rather than to what it held yesterday. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f3d0df9fda
commit
7ab801f409
@@ -410,3 +410,72 @@ export function parseSlashDateTimeRange(
|
||||
end: { iso: endIso, precision: "exact" },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Named timezone abbreviations this file will convert from, in milliseconds.
|
||||
*
|
||||
* Deliberately only the ones a source actually states, and deliberately only
|
||||
* ones with a fixed offset. An abbreviation absent here parses to null, which
|
||||
* is the same answer this file gives every other missing fact — and the reason
|
||||
* the map is not pre-populated with the obvious candidates is that half of them
|
||||
* are not fixed: `CST` names three different zones and `PT` shifts by an hour
|
||||
* twice a year, so a plausible-looking entry is a wrong date waiting for the
|
||||
* source to use it.
|
||||
*/
|
||||
const NAMED_ZONE_OFFSET_MS: Record<string, number> = {
|
||||
// Japan observes no daylight saving, so UTC+9 holds all year.
|
||||
jst: 9 * 60 * 60 * 1000,
|
||||
};
|
||||
|
||||
/**
|
||||
* "08/17/2026 8:00PM (JST)" → 2026-08-17T11:00:00.000Z, exact precision.
|
||||
*
|
||||
* One boundary, not a range: the hololive Dreams wiki gives Start Date and End
|
||||
* Date their own columns, so there is nothing to split and the whole cell is
|
||||
* anchored at both ends.
|
||||
*
|
||||
* Three things separate this from the readers above:
|
||||
*
|
||||
* - **A 12-hour clock**, which is the detail most likely to be got wrong
|
||||
* silently. `12:00PM` is noon and `12:00AM` is midnight — the hour is not
|
||||
* `12 + 12` in the first case and not `12` in the second — and a naive
|
||||
* reading puts an event's start twelve hours out without ever failing.
|
||||
* - **The zone is named, not offset.** `parseOrdinalDateTimeRange` reads a
|
||||
* stated `(UTC-5)`; here the source writes `(JST)`, so the abbreviation is
|
||||
* resolved through `NAMED_ZONE_OFFSET_MS` and an unrecognised one returns
|
||||
* null rather than being read as UTC.
|
||||
* - **The zone is required.** A cell stating a wall clock and no zone is a
|
||||
* missing fact, and this page always states one — so the day a row loses it,
|
||||
* that row should vanish rather than silently land nine hours off.
|
||||
*
|
||||
* Month-first, like `parseShortSlashRange`: the source is written for an
|
||||
* English-speaking audience and its own rows settle it — `08/17/2026` and
|
||||
* `08/27/2026` are both readable either way, but `08/30/2026` is not a day-first
|
||||
* date at all.
|
||||
*/
|
||||
export function parseSlashClockZone(input: string): ParsedInstant | null {
|
||||
const re =
|
||||
/^\s*(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(\d{1,2}):(\d{2})\s*([AP])M\s*\(([A-Za-z]+)\)\s*$/i;
|
||||
const m = re.exec(input);
|
||||
if (!m) return null;
|
||||
|
||||
const offsetMs = NAMED_ZONE_OFFSET_MS[(m[7] ?? "").toLowerCase()];
|
||||
if (offsetMs === undefined) return null;
|
||||
|
||||
const hour12 = Number(m[4]);
|
||||
if (hour12 < 1 || hour12 > 12) return null;
|
||||
const pm = (m[6] ?? "").toUpperCase() === "P";
|
||||
// Noon and midnight are the two readings a 12-hour clock gets wrong: 12PM is
|
||||
// hour 12 and 12AM is hour 0, so the wrap happens before the PM shift.
|
||||
const hour = (hour12 % 12) + (pm ? 12 : 0);
|
||||
|
||||
const value = offsetIso(
|
||||
Number(m[3]),
|
||||
Number(m[1]),
|
||||
Number(m[2]),
|
||||
hour,
|
||||
Number(m[5]),
|
||||
offsetMs,
|
||||
);
|
||||
return value === null ? null : { iso: value, precision: "exact" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user