feat(i18n): localize servicedesk errors + guard against un-keyed throws (#16 Phase-2 close-out)#90
Merged
Conversation
Task 9 of the #16 Phase-2 sweep: 6x 500->404 (project/service-desk not-found), 2x ResponseStatusException->BadRequestException.keyed (invalid priority/severity, now localized 400). New keys serviceDesk.notEnabled/invalidPriority + incident.invalidSeverity (en/de). Adds NoUnkeyedUserFacingThrowTest, a static gate that fails on any un-keyed user-facing throw (bare OR fully-qualified) — closing the FQ-prefix blind spot that hid the AttachmentController throw. Co-Authored-By: Claude Opus 4.8 <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.
Final session of the #16 backend-i18n Phase-2 API-error sweep (Task 9
servicedesk+ sweep close-out). Single commit, TDD-ordered. Branches off cleanmain— no stacking.What changed
Localizes the last remaining module + fixes latent 500s. Both servicedesk REST controllers threw
?: error(...)(unhandledIllegalStateException→ HTTP 500 for ordinary "unknown project / desk not enabled" conditions) and English-onlyResponseStatusException. Converted to the project's keyed domain exceptions:ServiceDeskController.kt/IncidentController.kt:?: error("Project not found…" / "Service desk not enabled…")→NotFoundException.keyed("project.notFound" | "serviceDesk.notEnabled", key)— 500 → localized 404ResponseStatusException(BAD_REQUEST, …)→BadRequestException.keyed("serviceDesk.invalidPriority" | "incident.invalidSeverity", …)— stays 400, now localized bodyResponseStatusExceptionimport; keptHttpStatus(still used by@ResponseStatus)messages.properties+ demessages_de.properties,\uXXXX-escaped;project.notFoundreused):serviceDesk.notEnabled,serviceDesk.invalidPriority,incident.invalidSeverity(the last doubled''{0}''per the MessageFormat rule).Durable regression guard —
NoUnkeyedUserFacingThrowTest. A static gate that fails CI on any un-keyed user-facing throw — bare OR fully-qualified (throw com.taskowolf…NotFoundException("…")) — plus free-textorElseThrow,?: error(,ResponseStatusException,AccessDeniedException. Allowlists exactly the 2 intentional internal invariants (SsoController clientSecret, OidcUserProvisioningService OIDC-no-email). Closes the FQ-prefix blind spot that let an un-keyedAttachmentControllerthrow slip through the earlier sweep. Has an anti-vacuous check (filesScanned > 0).Tests
ServiceDeskMessagesTest— en/de resolution for the 3 new keys (proves the''{0}''doubling).ServiceDeskErrorLocalizationTest(MockMvc) — unknown project → 404 localized de, desk-not-enabled → 404 localized de, invalid priority → 400 localized, invalid severity → 400 localized.MessagesParityTest,KeyedReferenceIntegrityTest,NoUnkeyedUserFacingThrowTest).Sweep close-out verification
The plan's widened FQ-blind-spot audit was run against the full
src/main/kotlintree and is clean everywhere except the 2 allowlisted invariants → the #16 Phase-2 API-error sweep is complete.Reviews
Task review: Approved (0 Critical/Important). Final whole-branch review (opus): Ready to merge: Yes (0 Critical/Important). 3 Minor findings all inherited/pre-existing patterns, correctly deferred.
Handoff (owed by Wolfgang, after merge — out of scope here)
Accept-Languagein the Network tab.GET …/service-desknow returns 404 (not 500) when the desk isn't enabled — treat that as the "not enabled" state. Both project-not-found and not-enabled share codeNOT_FOUND(distinguishable by message only).🤖 Generated with Claude Code