# AEG-V16-022 — Optimistic command hook

## Scope

- **WBS / Requirement / UI / Test:** AEG-V16-022 / REQ-V16-FEC-06 / UI-V16-FEC-06 / T-V16-FEC-06
- **Classification:** shared command-boundary correctness fix; no API, DB, policy, or provider change.

## Source / Assumption / Unknown / Decision Required

- **Source:** `AGENTS.md` idempotency rule, `frontend/src/shared/commands/idempotency.*`, and `useOptimisticCommand.*`.
- **Assumption:** the caller creates one request per user intent and reuses that request for retry. Server idempotency remains the authoritative side-effect protection.
- **Unknown:** no CRUD screen currently consumes this hook; integration evidence remains a later screen-slice responsibility.
- **Decision Required:** predecessor AEG-V16-021 has no concrete consumer yet; this implementation does not claim its acceptance evidence.

## Execution evidence

- `createRequest()` freezes a request with an idempotency key once; `run()` forwards that exact key on every retry.
- `If-Match`, 409/412 conflict state, correlation capture, and pending reset are preserved.
- `frontend: pnpm test -- --run src/shared/crud/tests/useOptimisticCommand.spec.ts`: 1 file / 2 tests passed.
- `frontend: pnpm typecheck`: passed before JS companion synchronization; the later JS-only synchronization is covered by the passing runtime test.
