Implement PUT /v1/entries/{type}/{name}/claims endpoint#720
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 59.80% 60.47% +0.67%
==========================================
Files 106 109 +3
Lines 10306 10467 +161
==========================================
+ Hits 6163 6330 +167
+ Misses 3600 3583 -17
- Partials 543 554 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replace the 501 stub with a full implementation that allows updating claims on a published entry (MCP server or skill) within the managed source. The caller's JWT claims must cover both the entry's existing claims and the new claims being set; super-admins bypass these checks. Adds the `UpdateRegistryEntryClaims` SQL query, `UpdateEntryClaims` service method with serializable transaction, and the `WithEntryType` option. Includes 9 handler unit tests and 9 service-layer integration tests covering authorization, not-found, clear-claims, super-admin bypass, and skill-type scenarios. Fixes #638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three places previously carried their own `server`/`skill` switch: the `updateEntryClaims` handler, `UpdateEntryClaimsOptions.setEntryType`, and `mapEntryType`. Introduce `service.ValidateEntryType` and the `EntryTypeServer` / `EntryTypeSkill` constants as the single source of truth, and rewrite all three call sites to use them. `WithEntryType` drops its redundant empty-string check and defers entirely to the setter, which now fully validates the input. Map `service.ErrNoManagedSource` to `503 Service Unavailable` with a targeted message instead of `500 Internal Server Error`. The managed source not being configured is a precondition failure, not an internal error; 503 signals the same to clients without misrepresenting the cause. The publish and delete handlers still return 500 for the same error — normalizing those is out of scope for this PR and should be handled as a follow-up to stay consistent. Add unit tests for `options_entries.go` covering `WithEntryType` (valid, empty, unknown, wrong case, wrong option type), `WithName`, `WithClaims`, `WithJWTClaims`, and multi-setter composition, plus direct tests for `ValidateEntryType`. Codecov previously reported 0% coverage on `options_entries.go`. Regenerate Swagger docs to reflect the new 503 response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e48552a to
05fc5b5
Compare
Update test fixtures to use the current upstream registry schema format which requires `meta`, `data` wrapper fields, and at least one server entry. The old format was rejected after the ToolHive format drop in 127c8c8. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
blkt
reviewed
Apr 20, 2026
Contributor
blkt
left a comment
There was a problem hiding this comment.
This could have been split into at least 3 PRs.
This was referenced Apr 20, 2026
rdimitrov
added a commit
that referenced
this pull request
Apr 20, 2026
## Summary - Drop the standalone `service.ValidateEntryType` helper and inline the switch directly into `setEntryType`, so `WithEntryType` is the single validation site for entry type strings (addresses @blkt's review nit on #720). - Add an `ErrInvalidEntryType` sentinel so the handler can still map invalid input to HTTP 400 after validation moves inside the service layer. - Simplify `mapEntryType` — drop the redundant pre-check and let the switch default return the same sentinel. Fixes #736 ## Test plan - [x] `task build` - [x] `task lint-fix` — 0 issues - [x] `task test` — all unit and integration tests pass, including updated `TestWithEntryType` (asserts `ErrorIs(err, ErrInvalidEntryType)`) and the handler's `unsupported entry type` case (now exercises the service error path with a mock returning `ErrInvalidEntryType`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
/v1/entries/{type}/{name}/claimsendpoint that was previously returning 501Changes
UpdateRegistryEntryClaimsquery with nullable claims and:execrowsfor not-found detectionUpdateEntryClaimsmethod andWithEntryTypeoptionimpl_entries.gowith serializable transaction, managed source lookup, and dual claims validationTestV1StubEndpoints(only tested the 501 stub)Test plan
task build— compiles cleanlytask lint-fix— 0 issuestask test— all unit and integration tests pass (including 18 new tests)Fixes #638
🤖 Generated with Claude Code