Repository navigation
Fix anime/manga news pages (#661) and recently-updated progress cells (#663) - #668
Merged
Merged
Conversation
…#663) #661: getNewsList() returned no articles for an anime's or manga's news page. Those pages have their own layout (no div.news-unit); a TitleNewsListItemParser reads it into the same ResourceNewsListItem, with absolute links. lastVisiblePage was always 1, and hasNextPage() counted the "News" tab (a link to the current page): both now follow the links beyond the current page. #663: the progress cell of "recently updated by users" is often a bare "-" (39 of 75 manga rows on manga 2), which made the total getters read a missing array key, and the catch-all in getResults() then returned no rows at all where warnings become exceptions. One Parser::parseProgress() reads every shape; "5/?" is now a null total instead of 0; an unparseable row is an error, not an empty page. Tests use six pages recorded live; each new test fails on the old code. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… news parser The PR's mutation run (85%, floor 88%) flagged untested new code: a comment count that is singular, capitalised or absent, and the current page when the URL has no ?p= or ?p=0. Also a progress cell with more than two parts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #661. Fixes #663. Both were reported from testing jikan-rest #614 on
v5.0.0-beta.2. I reproduced each on pages recorded live today before changing anything.#661:
getNewsList()returns nothing for an anime's or manga's newsA regression from v4: those pages parsed in v4. When #630 realigned the parser to the main news index (
div.news-unit), the per-title pages (/anime/{id}/_/news) lost their parser, and nothing in the corpus covered them.TitleNewsListItemParser(extends the index item parser, so the sameResourceNewsListItemcomes out).ResourceNewsListParserfalls back to it when a page has nodiv.news-unit; the index is untouched./news/{id}, author and discussion links, UTC date, comment count, excerpt without the "read more" link, and the real image (the page lazy-loads it).lastVisiblePagewas always1;hasNextPage()treated any link beyond page 1 as a next page, but on page 2 the "News" tab links to?p=2, the page itself. Both now use links beyond the current page. The index'slastVisiblePageis now 20, not 1.#663: a bare
-in a progress cell-in the volumes column. Anime 21: 4 rows (the issue said it wasn't reproduced for anime). With warnings as exceptions,getResults()returned 0 rows, because of its catch-all.Parser::parseProgress()reads every shape (5/12,5/?,-/12,-, empty) and all six getters use it.5/?(a series that's still running) gave a total of0. 71 of One Piece's 75 rows. It'snullnow. If you treated0as unknown, check fornull.MalClientreports aParserException, instead of an empty page next to ahasNextPage()that could be true. This is the one judgment call here: the alternative is skipping the bad row, but that hides markup changes, so I chose to fail loudly.Tests
TitleNewsTest(12) andRecentlyUpdatedProgressTest(13) run on the recorded pages. Run against the old code, 8 of 12 and 3 of 13 fail; the rest cover things that were already right. Six new corpus variants have snapshots, and the invariants allowlist and PHPStan baseline each shrank. 1,047 tests pass locally.Changelog entries are under Fixed.
🤖 Generated with Claude Code