Repository navigation
fix(api): name the reason a title allowance is refused - #5885
Conversation
The v2 allowance routes answered every refusal as a bare 422 validation_failed, dropping the service's no_maturity_limits, no_library_access, not_a_title and collection_not_live codes the operation descriptions promised. They now carry one field error with that code at the path parameter it is about, so clients can tell the refusals apart and show translated text for each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: N/A
Validation tasks: none
Other clients: Apple N/A (no client branches on these codes; the 422 status and English detail are unchanged); Android N/A (same); Roku N/A (no title allowance screens); Web N/A (updated here: the four new field-error strings ship with the translation re-pin)
When the household's primary profile tries to allow a limited profile a title or collection and the server refuses,
/api/v2answered a bare422 validation_failed. The operation descriptions anddocs/catalog-api.mdpromisedno_maturity_limits,no_library_accessandcollection_not_live, but the server never sent them. The allowance service returns each refusal with its code, and the v2 layer dropped it. A client could tell the refusals apart only by parsing the English detail, and a translated interface could only show a generic "didn't pass validation" message.The v2 allowance routes now keep
422 validation_failedand add one field error that names the reason, at the path parameter it is about:no_maturity_limitspath.idno_library_accesspath.item_idnot_a_titlepath.item_id, orpath.idonlistTitleAllowanceProfilescollection_not_livepath.collection_idApproach
The contract adds a domain problem type only when a client needs distinct corrective behavior, so these use field-error codes, as
reordered_seriesalready does. A smallallowanceProblemmapper next to the allowance routes turns the service's coded 422s into that shape and passes everything else toserviceProblemunchanged. The location depends on the route, so the mapper sits with the routes andserviceProblemstays as it is for every other handler.The operation descriptions and
docs/catalog-api.mdnow describe what the server sends. The fourerror.field.*strings went into the catalog in Silo-Server/silo-translations#229 (merged, with translations), and the web app is re-pinned to its release.The admin allowance routes in #5873 still call
serviceProblem. Once both merge, they can callallowanceProblem, which needs a profile location ofpath.profile_idthere.Validation
no_library_accessrefusal. It fails on main (errors = []) and passes here.go test ./internal/apiv2/...and./internal/api/handlers/pass.make lint-changedreports 0 issues.Nothing visual changes: English clients show the same detail text as before.
Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-5885/
Risks
A client that matched the old bare 422 still gets a 422 with the same English detail; the body only gains
errors[]. None identified beyond that.Checklist
Council review
Ran as a follow-up of the review of #5873: one plan reviewer and one background reviewer, both at medium effort.
Rounds: 1, last reviewed 2040d26
Fixed: the collection allowance docs now say only
PUTrefuses, andDELETEremoves an allowance even after the profile's limits are cleared (docs only, so no further round).Plan check (Opus, claude-opus-5-5, medium): the premises held. Its one cut, a single item-location argument in place of a per-route location struct, was adopted.
AI Disclosure
errors.AsTypeidiom and the existinglocationPathIDconstant). The simplify pass changed nothing. See Council review.🤖 Generated with Claude Code
Note
Add validation field codes to refused title allowances in API v2
allowanceProblemin title_allowances.go to map qualifying 422 errors from the title-allowance services into validation problems with a field code and request location, e.g.path.item_idforno_library_accessandnot_a_title.no_maturity_limits,no_library_access,not_a_title, andcollection_not_live.422 validation_failedwith a field code and location instead of a generic service problem; checkallowanceProblemand its callers ininternal/apiv2for the exact mappings.Macroscope summarized 635b782.