8000 Parser-correctness sweep, batch 1: streaming attribution link, empty background, search synopsis by irfan-dahir · Pull Request #676 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

Parser-correctness sweep, batch 1: streaming attribution link, empty background, search synopsis - #676

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

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

Conversation

@irfan-dahir
@irfan-dahir irfan-dahir commented Nov 11, 2026 •
Copy link
Copy Markdown
Collaborator

Batch 1 of the parser-correctness sweep. Every defect here was found by the repo's own honesty checks — scripts/field_witness.php and the model-invariant allowlists — and each shrinks an allowlist to nothing.

1. An unnamed 12th streaming "platform"

getStreamingLinks() selected every <a> in the streaming block, including MyAnimeList's "Streaming platforms provided by JustWatch" attribution link — not a platform, no name, justwatch.com URL. On anime/1 the model had 12 links for 11 platforms, the last name: "".

Netflix, Crunchyroll, Amazon Prime Video, FOD, U-NEXT, Apple TV Store,
Google Play Movies, Watcha, Fandango At Home, Tubi TV, Neon TV   ← 11
+ "" (https://www.justwatch.com/pk/tv-show/cowboy-bebop-1998/season-1)  ← dropped

2. background had two shapes for absence

null when the section was missing, "" when it was present but held no text. It is ?string for exactly that reason.

3. A search result with no synopsis returned "" instead of null

A title with no synopsis still gets the block, empty (<div class="pt4"></div>; "Unmei" on the Fate search page). getSynopsis() cleansed that to '', so search results were the last fields reporting absence as an empty string while the rest of the library returns null (DECISIONS.md, "Missing and unreadable data").

This is the only consumer-visible signature change in the batch: AnimeSearchListItem::getSynopsis() and MangaSearchListItem::getSynopsis() are now ?string. Changelog entry under Changed; UPGRADING.md is v4→v5-only, so nothing to add there.

Verification

  • Red → green: both new corpus tests fail on master and pass here (for the synopsis: 0 results with null before, exactly 1 — "Unmei" — after).
  • 17 allowlist files deleted, none emptied, none gained: 6 for streaming/background, 11 for synopsis.
  • Snapshots regenerated and reviewed line by line: 11 files, 24 lines, all "synopsis": "" → null; the streaming/background diff is 5 unnamed Url removals and 3 "" → null.
  • composer quality green: 1062 tests / 12386 assertions, PHPStan, php-cs-fixer, endpoint manifest.

Merge order

jikan-me/jikan-fixtures#21 first, then this — CI clones fixtures master, so the test jobs here are red on exactly the 17 regenerated snapshots until it lands (comment above has the detail). Unrelated: #675 is untouched and still awaiting review.

8000
The streaming block ends with a "Streaming platforms provided by
JustWatch" link. It is not a platform and carries no name, so it came
out of getStreamingLinks() as an extra Url with name "" and a
justwatch.com URL, on every page that lists platforms.

Also return null from getBackground() when the section exists but holds
no text; it returned "" there while returning null for a title with no
section at all, so absence had two shapes.

Both were the only entries in the model-invariant allowlists that named
this model; the six allowlist files are removed with the fix and a
corpus test pins the behaviour on the recorded anime-1 and anime-5114
pages.
@irfan-dahir
Copy link
Copy Markdown
Collaborator Author

CI note for whoever picks this up: the test jobs here fail on exactly the six snapshots this change regenerates, because link-fixtures clones fixtures master, where they still hold the old values:

Parsed model differs from its snapshot (Corpus/CorpusTest.anime-1.json)
Parsed model differs from its snapshot (Corpus/CorpusTest.anime-5114.json)
… AnimePlaceholderImageTest.json

composer quality:static is green, and the full suite is green locally against jikan-me/jikan-fixtures#21. Merge that fixtures PR first, then re-run here — or merge the two back to back and re-run. Same coupling as fixtures#20/#673.

A title with no synopsis still gets the div, empty: "Unmei" on the Fate
search page carries <div class="pt4"></div>. getSynopsis() cleansed that
to "", so search results reported absence as an empty string while every
other absent field in the library is null.

The getter is now ?string on AnimeSearchListItem and MangaSearchListItem
and returns null for an empty block. Eleven invariant allowlists named
this violation; they are removed with the fix, and a corpus test pins the
Unmei case on the recorded Fate page.
anime/5114 has no #broadcast-block; its platforms hang off div.broadcast
anchors, so the filter is now pinned against that second shape too. And
anime/1 asserts a background that exists survives the new null path,
which until now only had its null branch tested.
@irfan-dahir
Copy link
Copy Markdown
Collaborator Author

Coverage strengthened after an end-to-end pass (commit 72d0ece):

  • Second markup shape. anime/5114 has no #broadcast-block at all — its platforms hang off div.broadcast anchors. The filter is now pinned against that shape too (all links named, no www.justwatch.com URL), not just the #broadcast-block page.
  • The non-null background path. The original test only asserted null for an empty section; anime/1 now asserts a real background survives, so the fix cannot regress to nulling everything.

StreamingLinksTest: 2 → 4 tests. Full quality green: 1064 tests / 12417 assertions, PHPStan, php-cs-fixer, endpoint manifest.

End-to-end through MalClient against the recordings: anime/1 → 11 named links starting with Netflix; anime/5114 → 14 named links; anime/5114 background null; anime/1 background text; getAnimeSearch('Fate') → exactly one null synopsis ("Unmei"), none empty.

@irfan-dahir
irfan-dahir merged commit c3b9d7a into master Nov 12, 2026
1 of 7 checks passed
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