feat(p5x): track Persona 5: The Phantom X

Adds the game and its Game8 events page, the second of the games named in
the release thread. `parseAdjacentFullRange` reads the shape this page
uses: two full dates divided by an `<hr>` rather than a dash, so a
tag-stripping reader sees only whitespace between them. It is anchored at
both ends and needs a year on each half, because without that "August 12,
2026 Day 3 rewards" reads "Day 3" as an end.

Three of the four live rows publish. "Take Your Heart" ends 30 days after
each player makes an account, so it has no calendar date and no honest
place on a calendar. "Login Campaigns" names two candidate ends
("July 16/30, 2026") — it keeps its real start and takes no end, and the
leftover is not shown as a summary either, since a date the parser
refused to trust must not reappear dressed as information.

The page lists each live event twice: once in a bare Event|Duration table
and again under its own heading with Start Date / End Date rows and a
paragraph of prose. The second copy corroborates the dates, so deduping
now fills a missing summary from the copy it drops. Dates are still taken
wholesale from the better-dated copy and never blended.

Verified by re-extracting the page independently of the parser: 4 rows,
3 events, the fourth correctly skipped.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Lucas Winther
2026-08-17 17:21:10 +02:00
co-authored by Claude Opus 5
parent 67951e81b4
commit d8b539bce1
9 changed files with 1324 additions and 6 deletions
+34
View File
@@ -1,5 +1,6 @@
import { describe, expect, test } from "bun:test";
import {
parseAdjacentFullRange,
parseFullRange,
parseLabelledStartEnd,
parseMonthDayRange,
@@ -129,6 +130,39 @@ describe("parseOpenRange", () => {
});
});
describe("parseAdjacentFullRange", () => {
test("reads two dates separated by nothing but whitespace", () => {
// Persona 5 separates the halves of a duration cell with an <hr>, which a
// tag-stripping reader flattens to a single space.
expect(parseAdjacentFullRange("July 30, 2026 August 13, 2026")).toEqual({
start: { iso: "2026-07-30T00:00:00.000Z", precision: "day" },
end: { iso: "2026-08-13T00:00:00.000Z", precision: "day" },
});
});
test("requires a year on both halves", () => {
expect(parseAdjacentFullRange("July 30, 2026 August 13")).toBeNull();
});
test("refuses a second half that is only partly a date", () => {
// "July 16/30" names two candidate ends. Reading either as the end would
// be a coin flip presented as a fact.
expect(parseAdjacentFullRange("June 25, 2026 July 16/30, 2026")).toBeNull();
});
test("is anchored, so prose after a date is not read as an end", () => {
// Without the anchors, "Day 3" parses as a month and a day.
expect(
parseAdjacentFullRange("August 12, 2026 Day 3 rewards are doubled"),
).toBeNull();
expect(parseAdjacentFullRange("Starts August 12, 2026")).toBeNull();
});
test("rejects an impossible calendar date rather than rolling it over", () => {
expect(parseAdjacentFullRange("February 30, 2026 March 4, 2026")).toBeNull();
});
});
describe("parseLabelledStartEnd", () => {
test("reads a labelled cell", () => {
expect(