Fold ValidateEntryType into WithEntryType#737
Merged
Conversation
Drop the standalone `service.ValidateEntryType` helper and inline the switch directly into `UpdateEntryClaimsOptions.setEntryType`, so `WithEntryType` is the single validation site for entry type strings. The handler no longer pre-validates; instead, invalid types surface from the option setter wrapped in the new `ErrInvalidEntryType` sentinel, which the handler maps to HTTP 400. `mapEntryType` in the database service drops its redundant pre-check and relies on the switch default, which also returns the same sentinel. Fixes #736
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #737 +/- ##
==========================================
- Coverage 60.64% 60.63% -0.01%
==========================================
Files 109 108 -1
Lines 10486 10480 -6
==========================================
- Hits 6359 6355 -4
+ Misses 3573 3572 -1
+ Partials 554 553 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
blkt
approved these changes
Apr 20, 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
service.ValidateEntryTypehelper and inline the switch directly intosetEntryType, soWithEntryTypeis the single validation site for entry type strings (addresses @blkt's review nit on Implement PUT/v1/entries/{type}/{name}/claimsendpoint #720).ErrInvalidEntryTypesentinel so the handler can still map invalid input to HTTP 400 after validation moves inside the service layer.mapEntryType— drop the redundant pre-check and let the switch default return the same sentinel.Fixes #736
Test plan
task buildtask lint-fix— 0 issuestask test— all unit and integration tests pass, including updatedTestWithEntryType(assertsErrorIs(err, ErrInvalidEntryType)) and the handler'sunsupported entry typecase (now exercises the service error path with a mock returningErrInvalidEntryType).🤖 Generated with Claude Code