Skip to content

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Dec 3, 2025

Summary

  • Return an error when a custom registry is configured but unreachable, instead of silently falling back to the default registry
  • Add validation at creation time for RemoteRegistryProvider to ensure the registry is reachable
  • Update tests to verify the new error behavior

Fixes #2764

Test plan

  • Unit tests pass (task test)
  • Linting passes (task lint)
  • Manual testing: Set unreachable custom registry with thv config set-registry https://non-existent.example.com/registry.json and verify thv registry list and thv run <server> return errors

🤖 Generated with Claude Code

Previously, when a custom registry was configured via `thv config
set-registry` and was unreachable, ToolHive would silently fall back
to the default embedded registry. This could lead to unexpected
behavior where users would get results from the default registry
instead of their configured custom registry.

This change updates `NewRegistryProvider` to return an error when a
custom registry cannot be reached, ensuring users are notified of
the issue rather than getting unexpected results.

Fixes #2764

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Dec 3, 2025
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.58%. Comparing base (15f0beb) to head (d40aa33).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
pkg/registry/factory.go 70.00% 3 Missing ⚠️
pkg/registry/provider_remote.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2879      +/-   ##
==========================================
- Coverage   56.59%   56.58%   -0.02%     
==========================================
  Files         322      322              
  Lines       31439    31444       +5     
==========================================
- Hits        17794    17793       -1     
- Misses      12110    12121      +11     
+ Partials     1535     1530       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JAORMX JAORMX merged commit 8df77f6 into main Dec 4, 2025
33 checks passed
@JAORMX JAORMX deleted the fix-registry-fallback-error branch December 4, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't run server if registry is not reachable

3 participants