# MVP-HIST-001 — Preserve order history

## Story

As the system owner, I want durable current state plus append-only significant facts so that service
can be audited and future operational features have trustworthy input.

## Scenarios

### MVP-HIST-001-S01 — Durable finalized snapshot

- **Given** a finalized order
- **When** catalog data changes or the process restarts
- **Then** internal ID, classification, fulfillment metadata, quantities, and product snapshots
  remain durable
- **Evidence:** database integration.

### MVP-HIST-001-S02 — Timestamped fulfillment transitions

- **Given** an active finalized order
- **When** fulfillment changes
- **Then** each transition and relevant timestamp is appended to its history
- **Evidence:** database integration.

### MVP-HIST-001-S03 — Backward transitions are preserved

- **Given** `Preparing → Ready → Preparing`
- **When** history is inspected
- **Then** all three state facts remain in order rather than the correction erasing prior facts
- **Evidence:** database integration.

### MVP-HIST-001-S04 — Note changes are timestamped

- **Given** a finalized order's note changes, including clear
- **When** history is inspected
- **Then** old/new values and timestamped change remain
- **Evidence:** database integration.

### MVP-HIST-001-S05 — Queue-number changes are timestamped

- **Given** a finalized order's queue number changes, including clear
- **When** history is inspected
- **Then** old/new formatted values and timestamped change remain
- **Evidence:** database integration.

### MVP-HIST-001-S06 — Checkout history remains associated

- **Given** checkout was initiated
- **When** its result/reference is recorded
- **Then** attempt, outcome, timestamps, and stable provider reference when available remain
  associated with the order/checkout identity
- **Evidence:** database integration.

### MVP-HIST-001-S07 — Delivery does not delete history

- **Given** an order becomes delivered
- **When** it leaves the active queue
- **Then** its finalized record and historical facts remain durable
- **Evidence:** database integration.

## Invariants and exclusions

Diagnostic logs are not order history. Full event sourcing and a history/search UI are excluded.

## Implementation tasks

[MVP-TASK-023](../tasks/MVP-TASK-023.md) and [MVP-TASK-024](../tasks/MVP-TASK-024.md).
