AZ-003 — API errors and mobile feedback

Status

Done

Context

Read README. Backend app.ts has centralized handled errors and safe error strings; unknown-route 404s are an exception. Frontend api-client.ts distinguishes API/network failures but always parses successful JSON, so 204 is not supported and malformed success JSON is not normalized. Existing components/async-states.tsx and Home tests already cover loading/errors. AZ-002 supplies MUI/theme/localization. Extend these mechanisms instead of adding a second client.

Goal

Establish compatible error contracts and usable mobile loading/validation/notification behavior for the forthcoming forms and account operations.

Requirements

Non-goals

No auth endpoints, global automatic retries for mutations, domain validation engine, logging platform, server internationalization, or redesign of the existing message contract.

Implementation guidance

Extend backend error handling and OpenAPI shared components with API tests. Reuse existing frontend error types/async states and providers, and retain TanStack Query ownership. Test new error/empty/boundary presentations through controlled collaborators rather than adding fake production pages just to demonstrate notifications. Rate-limit retry metadata is a safe header, not a request to automatically retry non-idempotent mutations. No arbitrary percentage target: the existing 100% source coverage remains mandatory.

Acceptance criteria

Items 1–3 and 5 have component/API/integration evidence recorded in current state. Item 4's keyboard/screen-reader semantics, first-invalid-field focus, and non-duplication of inline versus snackbar feedback are covered by component tests; its 320/360px viewport review is still outstanding.

Verification

pnpm quality
pnpm test
pnpm test:coverage
pnpm build

Aggregate coverage needs local/test PostgreSQL per the existing testing guide. Add backend injection cases and frontend transport/RTL tests for all changed categories. Manually check long translated errors and snackbar dismissal at 360×800, 320px and desktop, keyboard focus and reduced motion. Normal CI supplies full Docker/integration evidence; add local browser verification if a changed scrolling/focus behavior cannot be reliably checked with RTL.

Documentation

Update OpenAPI, architecture error/API conventions, development form/feedback guidance, testing, current-state/handover. Keep required error compatibility and optional field semantics explicit.

Dependencies

AZ-002 (which includes AZ-001); existing central backend/frontend error boundaries.