Two small improvements to the public error envelope (uniform {error, detail} shape):
_validation_handler puts the full str(RequestValidationError) into detail, which is verbose and structural. Prefer a shaped form (reduced exc.errors()) or a fixed message.
IdempotencyKeyReuse is raised with the raw key, so the 409 detail is a bare key token rather than a sentence. Consider e.g. f"idempotency key {key!r} reused with a different command".
- (Optional)
ErrorResponse.detail is typed str; widen to str | None only if a null-detail path is introduced.
Files:
src/quartermaster/api/errors.py — _validation_handler
src/quartermaster/application/envelope.py — IdempotencyKeyReuse raise site
src/quartermaster/api/schemas.py — ErrorResponse
Deferred follow-up from the review of feat/api-http-layer.
Two small improvements to the public error envelope (uniform
{error, detail}shape):_validation_handlerputs the fullstr(RequestValidationError)intodetail, which is verbose and structural. Prefer a shaped form (reducedexc.errors()) or a fixed message.IdempotencyKeyReuseis raised with the raw key, so the 409detailis a bare key token rather than a sentence. Consider e.g.f"idempotency key {key!r} reused with a different command".ErrorResponse.detailis typedstr; widen tostr | Noneonly if a null-detail path is introduced.Files:
src/quartermaster/api/errors.py—_validation_handlersrc/quartermaster/application/envelope.py—IdempotencyKeyReuseraise sitesrc/quartermaster/api/schemas.py—ErrorResponseDeferred follow-up from the review of
feat/api-http-layer.