fix(api): declare 404 and 503 for the public README badge routes - #9748
Conversation
JSONbored#8377 gave GET /v1/public/repos/:owner/:repo/badge.svg and .../badge.json a deliberate three-outcome split -- 404 (no public badge for this repo), 503 (the badge data could not be loaded, short-cached), 200 otherwise -- so a monitor can tell a repo with no badge apart from a transient backend failure. But the spec entries added in JSONbored#9531 declared only 200, so the published contract these README-embedded routes are read against was missing exactly the two statuses the handler comment says a monitor must distinguish. Add 404 and 503 to both getRepoBadgeSvg and getRepoBadgeJson (their descriptions matching the handler's own distinction) and regenerate openapi.json. No handler behaviour, status, or cache header changes. Adds tests pinning which branch produces which status: the no-badge 404 and the loader-failure 503 each carry Cache-Control: public, max-age=300 and render the exact renderUnavailableBadgeSvg() body (svg) / unavailable shields payload (json), plus a buildOpenApiSpec() assertion that both operations declare 200/404/503. Closes JSONbored#9710
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-29 05:58:51 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9748 +/- ##
=======================================
Coverage 76.58% 76.59%
=======================================
Files 282 283 +1
Lines 59419 59441 +22
Branches 6553 6553
=======================================
+ Hits 45508 45530 +22
Misses 13629 13629
Partials 282 282
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Held for manual review: the gate and required CI are green, but GitHub reports this pull request's mergeable state as |


What & why
Closes #9710.
#8377 gave
GET /v1/public/repos/:owner/:repo/badge.svgand.../badge.jsona deliberatethree-outcome split —
404(this repo has no public badge),503(the badge data could not beloaded, short-cached),
200otherwise — so a monitor can tell "no badge" apart from a transientbackend failure. But the spec entries added in #9531 declared only
200, so the published contractthese README-embedded routes are read against was missing exactly the two statuses the handler comment
says a monitor must distinguish.
Change
Add
404and503to bothgetRepoBadgeSvgandgetRepoBadgeJsonininternal-and-public-route-specs.ts(descriptions matching the handler's own distinction), andregenerate
openapi.json. No handler behaviour, status, or cache header changes.Validation
404and the loader-failure503eachcarry
Cache-Control: public, max-age=300and render the exactrenderUnavailableBadgeSvg()body(svg) /
unavailableshields payload (json).buildOpenApiSpec()assertion that both operations declare200/404/503.ui:openapi:checkdrift-check clean.