• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 25731188325
66%

Build:
DEFAULT BRANCH: main
Ran 12 May 2026 11:28AM UTC
Jobs 1
Files 726
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 May 2026 11:21AM UTC coverage: 65.014% (-0.02%) from 65.032%
25731188325

push

github

web-flow
fix(registry): surface legacy registry format as a structured API error (#5260)

* Surface legacy registry format as a structured API error

Before this change, when a configured custom registry URL served data in
the legacy ToolHive format, NewRemoteRegistryProvider returned a plain
fmt.Errorf that the API handler did not recognise. The API responded with
a generic HTTP 500 "Failed to get registry provider", and the actionable
migration hint was visible only in main.log. Desktop clients had no way
to distinguish this case from an internal error.

Add a typed *LegacyFormatError (sister of *UnavailableError) carrying the
offending source URL. Wire it through the four registry GET handlers and
the v0.1 router so the response is now HTTP 503 with a structured
"registry_legacy_format" code and the migration hint in the message body.

The upstream_parser sentinel errLegacyFormat is now an instance of
*LegacyFormatError; its Is() method preserves errors.Is(err, errLegacyFormat)
for existing callers while enabling errors.As extraction of the URL.

Fixes #5259

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Switch registry_legacy_format status code to 502 Bad Gateway

503 was inconsistent with the existing PUT registry handler that already
returns 502 for the same legacy-format detection via ErrRegistryValidationFailed
(pkg/api/v1/registry.go updateRegistry handler). 502 is also the correct
RFC 9110 §15.6.3 code: thv serve acts as a gateway to the upstream registry
and the upstream returned a response we cannot process.

503 is reserved for "temporary overload or scheduled maintenance" which does
not match a misconfigured registry source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix stale 503 references in doc comments

Two doc comments missed the 502 update from the previous commit. The code
itself already returns 502 Bad Gateway via writeRegistryLegacyFormatError;
only the comments were inconsistent.
... (continued)

25 of 49 new or added lines in 4 files covered. (51.02%)

12 existing lines in 3 files now uncovered.

64039 of 98500 relevant lines covered (65.01%)

62.81 hits per line

Uncovered Changes

Lines Coverage ∆ File
18
47.28
-0.12% pkg/api/v1/registry.go
6
73.61
-6.69% pkg/api/v1/registry_v01.go

Coverage Regressions

Lines Coverage ∆ File
6
20.11
-3.45% pkg/client/manager.go
3
70.0
-3.33% pkg/state/local.go
3
79.38
-0.77% pkg/transport/proxy/httpsse/http_proxy.go
Jobs
ID Job ID Ran Files Coverage
1 25731188325.1 12 May 2026 11:28AM UTC 726
65.01
GitHub Action Run
Source Files on build 25731188325
  • Tree
  • List 726
  • Changed 9
  • Source Changed 5
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #25731188325
  • 6ec592d5 on github
  • Prev Build on main (#25721462260)
  • Next Build on main (#25732412599)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc