8000 Close the sweep: teach the pagination invariant about "next"-only pages by irfan-dahir · Pull Request #682 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

Close the sweep: teach the pagination invariant about "next"-only pages - #682

Merged
irfan-dahir merged 1 commit into
masterfrom
chore/pagination-invariant
Nov 12, 2026
Merged

irfan-dahir merged 1 commit into
masterfrom
chore/pagination-invariant

Conversation

@irfan-dahir
Copy link
Copy Markdown
Collaborator

Settles #679. The last ten model-invariant allowlists were not parser bugs — they were a rule's blind spot.

What the rule assumed

if ($props['hasNextPage'] === true && $props['lastVisiblePage'] < 2) {
    $found[] = "pagination $path";
}

That is sound when lastVisiblePage counts numbered pager links. Five pages have none: they link a single "More reviews"/"next" target:

model page
Anime\AnimeReviews, Manga\MangaReviews, Reviews\Reviews review lists ("More Reviews → p?=")
Top\TopAnime top anime ("next")
User\Friends friends list

The parsers were right on both getters; the invariant was applying a numbered-pager rule to pages that do not have one.

The change

ModelInvariants::NO_NUMBERED_PAGER names those five classes, with a comment explaining the exemption and pointing at the decision. The rule skips them; all ten allowlist files are deleted (not emptied), so:

  • model-invariant debt: 34 → 0
  • no consumer-visible change — no getter, signature, or JSON output moves
  • nullable getLastVisiblePage() (the honest long-term answer) is recorded in DECISIONS.md as the v6 alternative with the model overhaul, since it changes five public signatures and the v4 JSON mapping

Rejected here: reporting lastVisiblePage = 2 from the "next" link — a number that looks authoritative and is not.

Verification

  • composer quality green: 1070 tests / 12530 assertions, PHPStan, php-cs-fixer, endpoint manifest.
  • test/unit/__invariants__/ is now empty — no per-fixture exception survives the sweep.
  • Decision recorded in DECISIONS.md under a new "Pagination" section; PLAN.md's sweep summary updated to 34 → 0.

Five models (anime/manga reviews, recent reviews, top anime, user friends)
sit on pages that link only a "next"/"More ..." page. The rule "hasNextPage
implies lastVisiblePage >= 2" assumed numbered links, so it reported the
ten recordings as violations and they were allowlisted per fixture.

The rule now names those five models in one place and explains why. The ten
allowlist files are deleted; invariant debt is 0. Nullable
getLastVisiblePage() stays the v6 alternative, recorded in DECISIONS.md.
@irfan-dahir
irfan-dahir merged commit 7a564ed into master Nov 12, 2026
6 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