```yaml
id: UJ-018
title: Clear translation cache
actors: [administrator]
surface: admin-spa
goal: Administrator clears plugin and WordPress caches and verifies empty statistics.
trigger: Confirm Clear Cache at /wp-admin/admin.php?page=international-press-zone#/settings.
fixtures: [authenticated-admin, populated-translation-cache]
success_state:
  visible: Cache cleared successfully
  durable: Plugin and WordPress cache entries are absent.
  persistence: Fresh cache statistics report zero size and hits.
source_specs: [admin/src/pages/settings.js, includes/API/SettingsController.php]
readiness: draft
canonical: false
blockers: []
```

## Path

| Hop | Evidence |
|---|---|
| UI trigger | `admin/src/pages/settings.js:759` |
| Request construction | `admin/src/pages/settings.js:777` |
| Endpoint auth and parse | `includes/API/SettingsController.php:111` |
| Authoritative write | `includes/API/SettingsController.php:457` |
| Response | `includes/API/SettingsController.php:464` |
| Terminal render | `admin/src/pages/settings.js:781` |

## Happy path

### H1
- Setup: Administrator authenticated; cache contains one named translation entry and nonzero statistics.
- Action: Activate `Clear Cache`, then confirm `Clear Cache`.
- Request: `POST /wp-json/international-press-zone/v1/settings/clear-cache`.
- Response: `200` with `{success:true,data:null,message:"All caches cleared successfully"}`.
- Visible: `Cache cleared successfully` renders and cache statistics show zero.
- Durable: Named translation cache entry is absent and cache statistics are reset.
- Fresh read: `GET /wp-json/international-press-zone/v1/settings/cache-stats` returns `200` with zero size and hits.
- Forbidden: Settings, languages, translations, licenses, and accounts remain unchanged.
- Evidence:
  - Setup: `includes/API/SettingsController.php:546`
  - Action: `admin/src/pages/settings.js:759`
  - Request: `admin/src/pages/settings.js:777`
  - Response: `includes/API/SettingsController.php:464`
  - Visible: `admin/src/pages/settings.js:780`
  - Durable: `includes/API/SettingsController.php:457`
  - Fresh read: `includes/API/SettingsController.php:546`
  - Forbidden: `includes/API/SettingsController.php:457`

## Alternate and failure paths

### A1
- Setup: Administrator authenticated; confirmation modal is open over populated cache.
- Action: Activate `Cancel`.
- Request: N/A — cancel closes confirmation without issuing HTTP.
- Response: N/A — no HTTP response exists because no request is issued.
- Visible: `Clear Cache?` closes without success toast.
- Durable: Named cache entry and statistics remain unchanged.
- Fresh read: Cache statistics GET returns original nonzero values.
- Forbidden: No cache flush or settings mutation occurs.
- Evidence:
  - Setup: `admin/src/pages/settings.js:743`
  - Action: `admin/src/pages/settings.js:754`
  - Request: `admin/src/pages/settings.js:756`
  - Response: `admin/src/pages/settings.js:756`
  - Visible: `admin/src/pages/settings.js:744`
  - Durable: `admin/src/pages/settings.js:756`
  - Fresh read: `includes/API/SettingsController.php:546`
  - Forbidden: `admin/src/pages/settings.js:756`

## Permissions and boundaries

### P1
- Setup: Actor lacks `manage_options`; cache contains named entry.
- Action: Submit cache-clear request.
- Request: `POST /wp-json/international-press-zone/v1/settings/clear-cache`.
- Response: `403` with `{code:"rest_forbidden",message:"Sorry, you are not allowed to access this endpoint.",data:{status:403}}`.
- Visible: REST denial exposes no cache statistics.
- Durable: Named cache entry remains present.
- Fresh read: Protected cache-statistics request returns same `403` denial.
- Forbidden: No plugin or WordPress cache flush occurs.
- Evidence:
  - Setup: `includes/API/SettingsController.php:714`
  - Action: `includes/API/SettingsController.php:117`
  - Request: `includes/API/SettingsController.php:111`
  - Response: `includes/API/SettingsController.php:714`
  - Visible: `includes/API/SettingsController.php:714`
  - Durable: `includes/API/SettingsController.php:714`
  - Fresh read: `includes/API/SettingsController.php:546`
  - Forbidden: `includes/API/SettingsController.php:714`

## Source specs

- `admin/src/pages/settings.js`
- `includes/API/SettingsController.php`
