Repository navigation
feat: harden backend-suite gates and fix live-network test fallback - #604
Merged
irfan-dahir merged 1 commit intoOct 11, 2026
Merged
Conversation
- test/unit/HttpFilesystemCacheClientCallback.php: remove the live HttpClient::create() fallback. A missing fixture is now a named RuntimeException telling the developer to run 'composer link-fixtures'. audit_test_network_coupling (which measured this shape-2 coupling on jikan) now reports clean; the full suite still passes 394/394 with fixtures present. - .backend-suite/hooks.map.json: gate commits on audit_error_handling and audit_test_network_coupling (preCommit: true; fast + invariant). - .backend-suite/arch-rules.json: add apiConsistency (loadBearingCopy and hardBakedCopy live; authoredSemantics and vocabulary off with reasons) and toolchainGates (manifestGlob/runnerGlob/requiredScripts: [test]). - composer.json: add a 'test' composer script (the suite measured that jikan declared no test command despite phpunit.xml existing). - .backend-suite/hooks.map.json / arch-rules _readme: document why errorShape and versioning stay refused (client library, no HTTP error envelope, no versioned routes). audit posture: error_handling clean, test_network_coupling clean, api_consistency 20 load-bearing-copy findings (compared sentinels like 'Unknown'/'N/A'/'Filler'), toolchain_gates clean after the script addition.
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 #603 (the onboarding PR). Four files, total hardening of jikan's backend-suite setup.
1. Fix the live-network test fallback (the finding #603 surfaced)
test/unit/HttpFilesystemCacheClientCallback.phpused to fall back to a liveHttpClient::create()whenever a fixture file was missing — a suite that looks offline while hitting the real site. It is now a pure cache reader: a missing recording raises a namedRuntimeExceptiontelling the developer to runcomposer link-fixtures.composer test(new script below) passes 394/394 — proving every fixture is already present and no test depended on live fetching.audit_test_network_coupling(which measured this exact coupling on jikan) now reports clean.2. Gate commits on error_handling + test_network_coupling
hooks.map.jsonnow marks both entriespreCommit: true:wholeRepo, catches the fallback pattern returning.Both are fast (<0.5s) and invariant, so they qualify as commit gates. Verified live: the commit for this PR ran both gates and the existing grumphp flow. Per-machine wiring is a hand-merged
.git/hooks/pre-commit(suite gate → grumphp), since grumphp already owns the hook; grumphp's original is backed up atpre-commit.grumphp.backup.3. More audit sections live
apiConsistency—loadBearingCopy/hardBakedCopyon;authoredSemantics+vocabularyoff with written reasons. Finds 20 real findings (see below).toolchainGates— with a new"test": "phpunit"composer script; the suite measured jikan declared no test command despite phpunit.xml existing. Now clean.errorShape/versioningstay refused (exit 2, honestly) — jikan is a client library: it authors no HTTP error envelope and has no versioned route files. Documented in_readme.Final posture (
repo-health)testscript)The 20 findings worth a decision
api_consistencyload-bearing-copy: parsers compare scraped text against hard-coded sentinels that also appear on the wire —'Unknown','N/A','Filler','Recap','Currently Airing','Not available','Publishing','Synonyms','None'(e.g.AnimeParser.php:207,MangaParser.php:217,AnimeEpisodeParser.php:151). A client that localizes or re-brands that copy silently breaks the semantics. Report-only per the suite's contract — deciding whether to extract enums/constants is a human call, not this PR's.