8000 Parser-correctness sweep, batch 2: a card with an empty Source property is null by irfan-dahir · Pull Request #677 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

Parser-correctness sweep, batch 2: a card with an empty Source property is null - #677

Merged
irfan-dahir merged 2 commits into
masterfrom
v5/parser-correctness-sweep-source
Nov 12, 2026
Merged

irfan-dahir merged 2 commits into
masterfrom
v5/parser-correctness-sweep-source

Conversation

@irfan-dahir
Copy link
Copy Markdown
Collaborator

Batch 2 of the parser-correctness sweep — stacked on #676 so the changelog does not collide; retarget to master once #676 merges.

What was wrong

AnimeCardParser::getSource() returned '' for a card whose "Source" property is present but empty. MyAnimeList does this for titles it has no source for — the caption and the (empty) item span are both rendered:

<div class="property"><span class="caption">Source</span><span class="item"></span></div>

21 cards on the 1990 spring page and 1 on the current "later" page are like that. A card with no Source property already returned null, so absence had two shapes; the getter was already ?string.

Scope check first

I checked whether the positional selector (div[2]/span[2]) is the real problem before changing it: across the recorded seasonal pages, every card that has properties carries Source as the second property (420/421; the exception has no properties at all). So the selector is not wrong today, and I left it alone rather than making an unprovable change — the defect is only the empty item. That is recorded in the PR so the next person knows the check happened.

Verification

  • Red → green: the new corpus test fails on master ('' is not null) and passes here; it asserts the empty-source card, a card that does list a source, and that no card is left with ''.
  • 5 allowlist files deleted (CorpusTest.schedule, CorpusTest.seasonal-1990-spring, CorpusTest.seasonal-later, ScheduleParserTest, SeasonalParserTest) — all of the remaining .source debt.
  • Snapshots: 5 files, 31 lines, all "source": "" → null. PR: Snapshot anime cards without a source as null jikan-fixtures#22.
  • composer quality green: 1063 tests / 12476 assertions, PHPStan, php-cs-fixer, endpoint manifest.

Remaining sweep debt

Only the 10 pagination violations are left, and they are a semantics question (lastVisiblePage on lists that don't paginate) — filed separately as an issue rather than patched here.

MyAnimeList renders the "Source" property for every card, sometimes with an
empty item: "Eigo de Asobo: Tanken Goblin Tou" on the 1990 spring page has
<span class="item"></span>. getSource() returned "" there while returning
null for a card with no Source property at all, so absence had two shapes.

The getter was already ?string; it now returns null for an empty item. Five
invariant allowlists named this violation and are removed with the fix, and
a corpus test pins the empty-source card and a card that does list one.
The schedule page shares AnimeCardParser, and it carried one of the five
allowlist entries this fix deletes. The seasonal test was the only one
asserting the new behaviour.
@irfan-dahir
Copy link
Copy Markdown
Collaborator Author

Coverage strengthened after an end-to-end pass (commit 833c614): the schedule page carries one of the five allowlist entries this PR deletes, and it shares AnimeCardParser, but only the seasonal page was asserted. SeasonSourceTest now covers both — Tuesday's "Origami Ninja Koyankinte" is null, no card keeps ''.

Full quality green: 1064 tests / 12486 assertions.

End-to-end through MalClient: getSeasonal(1990, 'spring') → 17 null sources, 0 empty; getSchedule()->getTuesday() → 1 null source, 0 empty.

@irfan-dahir
irfan-dahir changed the base branch from v5/parser-correctness-sweep to master November 12, 2026 13:14
@irfan-dahir
irfan-dahir merged commit 434591f into master Nov 12, 2026
1 of 7 checks passed
irfan-dahir added a commit that referenced this pull request Nov 12, 2026
fixtures#21/#22/#23 and jikan#676/#677/#680/#681 merged today, so the
section no longer describes work in flight and the witness count is 18
rather than 19.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0