Add registry validation and structured errors#3479
Merged
Conversation
This change introduces comprehensive validation for registry configurations and structured error types for better error handling and classification. Changes: - Add 5-second timeout support to HTTP client builder - Add registry validation in provider_remote.go (isValidRegistryJSON, registryHasServers) - Add comprehensive validation tests in provider_test.go - Introduce structured error types (RegistryError, ErrRegistryTimeout, etc.) - Add error classification logic (classifyNetworkError) - Update registry.go to return RegistryError types with proper context - Update tests to reflect new error handling This lays the foundation for improved error handling in the registry API and CLI, enabling proper HTTP status codes (502, 504) based on error type. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Jan 28, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3479 +/- ##
=======================================
Coverage 65.17% 65.18%
=======================================
Files 397 398 +1
Lines 38626 38706 +80
=======================================
+ Hits 25173 25229 +56
- Misses 11499 11521 +22
- Partials 1954 1956 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
approved these changes
Jan 28, 2026
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.
Summary
This PR introduces comprehensive validation for registry configurations and structured error types for better error handling and classification.
This is part 1 of 3 PRs that improve registry API error handling:
Changes
Validation Infrastructure
pkg/networking/http_client.go)pkg/registry/provider_remote.go:isValidRegistryJSON(): Validates registry JSON structureregistryHasServers(): Ensures registry contains at least one serverpkg/registry/provider_test.goStructured Error Types
pkg/config/errors.go:RegistryError: Wraps registry errors with context (type, URL)ErrRegistryTimeout: Sentinel error for timeout scenariosErrRegistryUnreachable: Sentinel error for connectivity issuesErrRegistryValidationFailed: Sentinel error for validation failurespkg/config/errors_test.goError Classification
classifyNetworkError()inpkg/config/registry.goto classify network errorssetRegistryURL(),setRegistryFile(),setRegistryAPI()to returnRegistryErrortypesBenefits
errors.Is()anderrors.As()for error inspectionTesting
🤖 Generated with Claude Code