Skip to content

[AMI-135] Standardize API contracts, errors, and cancellation - #10

Merged
hifeamin merged 3 commits into
mainfrom
hifeamin/ami-135-6-standardize-api-contracts-validation
Nov 22, 2026
Merged

hifeamin merged 3 commits into
mainfrom
hifeamin/ami-135-6-standardize-api-contracts-validation

Conversation

@hifeamin

Copy link
Copy Markdown
Collaborator

Summary

Implements AMI-135 by standardizing public API request contracts, response/error handling, endpoint metadata, and cancellation propagation.

  • Replaces primitive request bodies with named request DTOs for account, role, user-role, and claim operations.
  • Adds consistent public ProblemDetails responses and sanitized error mappings.
  • Keeps authentication and registration responses generic where account-state disclosure is a concern.
  • Returns generic 401 Unauthorized ProblemDetails for external authentication failures while preserving 400 for malformed requests.
  • Keeps registration verification rate-limit responses indistinguishable from the generic accepted registration response.
  • Standardizes two-factor continuation as an accepted, non-final authentication response without issuing a session token.
  • Propagates cancellation through supported service, verification, and store operations, while documenting framework APIs that do not expose cancellation overloads.
  • Adds OpenAPI response metadata, request-contract tests, endpoint metadata tests, and regression tests for sanitized error behavior.
  • Updates README documentation for the external-login trusted-email policy.

Security notes

  • Public errors avoid exposing raw Identity/provider/store error details.
  • Registration and external-login flows avoid revealing whether an account exists.
  • Trusted-email auto-linking remains governed by the configured trust policy; untrusted or unverified provider email claims are rejected before account lookup.

Verification

The changes include regression and contract tests. No GitHub Actions run or commit status result was available during review, so CI verification is not claimed.

@hifeamin
hifeamin merged commit 0eda233 into main Nov 22, 2026
3 checks passed
@hifeamin
hifeamin deleted the hifeamin/ami-135-6-standardize-api-contracts-validation branch November 22, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant