Repository navigation
refactor: compare MAL display strings through named constants - #606
Merged
irfan-dahir merged 1 commit intoOct 11, 2026
Merged
Conversation
Resolves the 20 backend-suite audit_api_consistency findings
(load-bearing-copy) on jikan. The parsers and models compared scraped text
against hand-typed display strings ('Unknown', 'N/A', 'Filler', 'Recap',
'Currently Airing', ...) at 21 sites. Those strings are upstream data from
MyAnimeList, not jikan's own copy, so the failure mode is silent drift: an
upstream rename no longer matches the sentinel, and the parser quietly
changes what the API returns.
- src/Helper/Constants.php: new DISPLAY_* constants, each with a docblock
note that it is an upstream display string compared by value.
- 10 parser/model files: every comparison AND the one AnimeCardParser
emission now reference the constant (so comparison and emission cannot
diverge); adding the missing Jikan\Helper\Constants imports.
- DECISIONS.md: first authored entry recording the decision and why an enum
was rejected.
Verified: audit_api_consistency clean (exit 0) over 388 files; phpunit
394/394 (behaviour unchanged - constants carry identical strings);
php-cs-fixer clean.
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.
Stacked on #605. Resolves all 20
audit_api_consistency(load-bearing-copy) findings on jikan — the item from the gap analysis that makes the suite's "paid for itself" claim concrete.The defect
The parsers/models compared scraped text against hand-typed display strings at 21 sites:
'Unknown','N/A','Filler','Recap','Currently Airing','Publishing','Not available','None','Synonyms'(e.g.AnimeParser.php:207,MangaParser.php:217,AnimeEpisodeParser.php:151).These strings are upstream data from MyAnimeList, not jikan's own copy. So the failure mode is precisely the one the audit guards: if MAL renames a display string (e.g.
Unknown→Not available), every hand-typed comparison silently stops matching and the API quietly starts returning null/derived values.The fix
src/Helper/Constants.php: newDISPLAY_*constants, documented as upstream display strings compared by value — an upstream rename becomes a one-line change in one file.AnimeCardParseremission of'Unknown', now references the constant so comparison and emission cannot diverge. MissingJikan\Helper\Constantsimports added.DECISIONS.md: first authored entry (still-marked stub) recording the decision, the alternatives considered (enum — rejected, reasons stated), and the impact.Verified
audit_api_consistencyphpunitDecisions log first entry also starts closing the documentation debt (5 stubs).