# Complete Journey Example

Audience: AI coding agents first.

Fixture-backed example. Validate with:

```text
node scripts/validate-journeys.mjs references/complete-journey-example.md --project-root <create-journeys-skill-dir>
```

Never copy routes, statuses, fields, fixtures, or evidence into another repository. Structure only.

```yaml
id: UJ-042
title: Remove owned favorite
actors: [customer]
surface: customer-portal
goal: Customer removes one owned favorite and fresh library state excludes it.
trigger: Activate Remove on /en/dashboard/favorites.
fixtures: [customer-a, favorite-track-7-owned-by-customer-a]
success_state:
  visible: "Removed from favorites" renders and Track 7 disappears.
  durable: favorites has no customer-a:track-7 entry.
  persistence: Fresh GET /api/dashboard/customer/favorites returns 200 without track-7.
source_specs: [references/example-project/src/FavoritesPanel.tsx, references/example-project/src/favorites-route.ts, references/example-project/src/schema.ts]
readiness: ready
canonical: true
blockers: []
```

## Path

| Hop | Evidence |
|---|---|
| UI trigger | `references/example-project/src/FavoritesPanel.tsx:7` |
| Request construction | `references/example-project/src/FavoritesPanel.tsx:13` |
| Endpoint auth and parse | `references/example-project/src/favorites-route.ts:10` |
| Authoritative write | `references/example-project/src/favorites-route.ts:17` |
| Response | `references/example-project/src/favorites-route.ts:18` |
| Terminal render | `references/example-project/src/FavoritesPanel.tsx:19` |

## Happy path

### H1
- Setup: `customer-a` authenticated; `favorites` holds `customer-a:track-7`.
- Action: Activate `Remove` on Track 7 at `/en/dashboard/favorites`.
- Request: `DELETE /api/dashboard/customer/favorites/track-7`.
- Response: `200` with `{success:true,trackId:"track-7"}`.
- Visible: `Removed from favorites` renders; Track 7 is absent from the list.
- Durable: `favorites` has no `customer-a:track-7` key.
- Fresh read: `GET /api/dashboard/customer/favorites` returns `200` with `{data:[]}`.
- Forbidden: No other user's favorite is deleted; no track record is deleted.
- Evidence:
  - Setup: `references/example-project/src/schema.ts:6`
  - Action: `references/example-project/src/FavoritesPanel.tsx:7`
  - Request: `references/example-project/src/FavoritesPanel.tsx:13`
  - Response: `references/example-project/src/favorites-route.ts:18`
  - Visible: `references/example-project/src/FavoritesPanel.tsx:19`
  - Durable: `references/example-project/src/favorites-route.ts:17`
  - Fresh read: `references/example-project/src/favorites-route.ts:23`
  - Forbidden: `references/example-project/src/schema.ts:9`

## Alternate and failure paths

### A1
- Setup: `customer-a` authenticated; `favorites` holds no `customer-a:track-7`.
- Action: Activate `Remove` on a favorite already removed in another tab.
- Request: `DELETE /api/dashboard/customer/favorites/track-7`.
- Response: `404` with `{error:"favorite_not_found"}`.
- Visible: `Favorite no longer exists` renders.
- Durable: `favorites` is unchanged.
- Fresh read: `GET /api/dashboard/customer/favorites` returns `200` without `track-7`.
- Forbidden: No delete is issued for any key.
- Evidence:
  - Setup: `references/example-project/src/schema.ts:8`
  - Action: `references/example-project/src/FavoritesPanel.tsx:7`
  - Request: `references/example-project/src/FavoritesPanel.tsx:13`
  - Response: `references/example-project/src/favorites-route.ts:14`
  - Visible: `references/example-project/src/FavoritesPanel.tsx:22`
  - Durable: `references/example-project/src/favorites-route.ts:13`
  - Fresh read: `references/example-project/src/favorites-route.ts:23`
  - Forbidden: `references/example-project/src/favorites-route.ts:14`

## Permissions and boundaries

### P1
- Setup: No authenticated session.
- Action: Activate `Remove` on Track 7.
- Request: `DELETE /api/dashboard/customer/favorites/track-7`.
- Response: `401` with `{error:"unauthorized"}`.
- Visible: `Sign in to view favorites` renders.
- Durable: `favorites` is unchanged.
- Fresh read: `GET /api/dashboard/customer/favorites` returns `401` with `{error:"unauthorized"}`.
- Forbidden: No favorite is deleted; no owner identity is disclosed.
- Evidence:
  - Setup: `references/example-project/src/favorites-route.ts:3`
  - Action: `references/example-project/src/FavoritesPanel.tsx:7`
  - Request: `references/example-project/src/FavoritesPanel.tsx:13`
  - Response: `references/example-project/src/favorites-route.ts:10`
  - Visible: `references/example-project/src/FavoritesPanel.tsx:25`
  - Durable: `references/example-project/src/favorites-route.ts:10`
  - Fresh read: `references/example-project/src/favorites-route.ts:22`
  - Forbidden: `references/example-project/src/favorites-route.ts:10`

## Source specs

- `references/example-project/src/FavoritesPanel.tsx`
- `references/example-project/src/favorites-route.ts`
- `references/example-project/src/schema.ts`
