Repository navigation
feat(api): Every error is a Problem Details response (#364) - #376
Merged
Merged
Conversation
The remaining { error } bodies become Problem Details with a stable
`code` extension and today's text in `detail`: admin user creation,
cannot-modify-self, storage config path rejections, the flashback date
and the must-change-password check. Field failures are ValidationProblems
keyed by the request field, as for registration.
Following the decision recorded on #364, the identifier a client branches
on is `code`, not `type`. AuthProblems and AuthErrorCodes become
ApiProblems and ErrorCodes, since they now serve non-auth endpoints.
The OpenAPI document is unchanged: these endpoints return untyped
IResult, and describing their responses is #365.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #364.
What changed
The remaining
{ error }bodies are now Problem Details (application/problem+json). Each one keeps today's text indetailand adds a stablecodeextension:codeerrorsfieldinvalid_username,invalid_email,username_taken,email_takenusername/emailcannot_modify_selfpath_invalid,path_already_assigned,path_overlapsrootPathGET /flashbacks/on-this-daybad dateinvalid_datedatepassword_change_requiredField failures are ValidationProblems whose
errorshold the code under the request field. Registration has worked this way since #357.AuthProblemsandAuthErrorCodesare renamed toApiProblemsandErrorCodes, because non-auth endpoints use them now.Against the acceptance criteria
code, nottype. The cases a client branches on carrycode, andtypeis left at its default. That follows the decision in the owner's comment on feat(api): Every error is a Problem Details response #364, which says to reusecoderather than add a second identifier intype. The tests therefore assertcode.scripts/derive-openapi.sh --checkpasses). These endpoints return untypedIResult, so their error responses aren't described yet. Describing them is feat(api): The OpenAPI document describes every response #365.Retry-Afteron a locked account, and the 429rate_limitedresponse, are still asserted inAuthErrorContractTests.scripts/mutation-changed.shscores 100.00% (70 killed, 0 survived).invalid_usernametext. Admin create user'sdetailstaysAuthMessages.InvalidUsername, while registration's comes from the username policy. That difference already existed and is carried over unchanged.Tests
AdminErrorContractTestscover every admin site. They assert status,application/problem+json,code,status,detailand theerrorsfield against literal values.ProblemAssertionshelper.Not in this PR
The existing ValidationProblems in
WorkItemEndpointsandProxySweepEndpointscarry nocode. They were never{ error }bodies, so they're noted on #365 instead.🤖 Generated with Claude Code