Skip to content

Hardening/contract stabilization#41

Merged
MarkADom merged 5 commits intodevelopfrom
hardening/contract-stabilization
Mar 3, 2026
Merged

Hardening/contract stabilization#41
MarkADom merged 5 commits intodevelopfrom
hardening/contract-stabilization

Conversation

@MarkADom
Copy link
Copy Markdown
Owner

@MarkADom MarkADom commented Mar 3, 2026

Summary

Standardized API error semantics to stabilize backend contract behavior and remove accidental 500 responses.
Introduced explicit domain exceptions for clearer intent and predictable status mapping:

  • ResourceNotFoundException404 Not Found
  • AccessDeniedException403 Forbidden
  • DomainConflictException409 Conflict
  • InvalidInputException400 Bad Request
    Updated global exception handling to consistently map validation/auth/domain failures (MethodArgumentNotValidException, ConstraintViolationException, JWT/auth errors) to expected HTTP responses.
    Replaced service-layer throws of framework/generic exceptions (ResponseStatusException, IllegalArgumentException, NoSuchElementException) in hardened paths with domain-level exceptions.
    Removed accidental 500 propagation hotspots caused by unsafe Optional access and require(...) failures in touched flows.
  • Updated Bruno integration checks where validation/authorization/not-found paths previously expected incorrect 500 statuses.

Type of change

  • feat
  • fix
  • refactor
  • docs
  • test
  • ci

Validation

  • I ran local checks
  • I included commands/results below

Commands run:

./gradlew test --tests 

Docs impact

  • No docs change needed
  • Updated README/docs
  • Updated API tests (Bruno)

Security impact

  • No security impact
  • Security-relevant change explained below

This change improves contract hardening for authentication/authorization/validation responses by preventing ambiguous or accidental 500 leaks and enforcing deterministic HTTP semantics (401/403/404/400/409) across touched backend flows.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 3, 2026

@MarkADom MarkADom merged commit 9b13f62 into develop Mar 3, 2026
3 checks passed
@MarkADom MarkADom deleted the hardening/contract-stabilization branch March 3, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant