# WP4 — Request lifecycle scenarios (R11/R12)

## Goal
One spec `e2e/specs/lis-request-lifecycle.spec.ts`, 2 scenarios covering edit + cancel, tagged `@lis @request @lifecycle`.

## 📖 DOCUMENTATION STANDARD (owner mandate — every test case is a GUIDE)
Each `test(...)` MUST have: (1) a 2nd-arg `{ annotation: { type: "description", description: "..." } }` clearly stating what the scenario proves; (2) rich human-readable `test.step("...")` for EVERY meaningful step (NOT "step 1"), named so a non-dev reads the drill-down and understands the flow; (3) a JSDoc header summarising the scenario in plain words (like lis-result-review-flow.spec.ts). These render in the System Tests drill-down = the living guide. Reuse e2e/helpers (auth/lisSetup/uiSearch + fillSearchUntilVisible for flake). Write-isolated company 8. Unique ids per run. API-setup + UI-assert where the value is.

## Scenarios
- **R11 — add + remove investigation**: create a request with one investigation; `POST /lis/requests/{id}/investigations` to ADD a second (env investigation id) → assert the request now has 2 + the total increased by the added price; then `DELETE /lis/requests/{id}/investigations/{invId}` to REMOVE it → assert back to 1 + total decreased. Drive the UI to VIEW the change where practical; assert totals via API source-of-truth. Step names state the before/after counts + totals.
- **R12 — cancel**: create a request; `POST /lis/requests/{id}/cancel` (with a reason if required) → assert status becomes `cancelled` AND it disappears from the active requests list (UI: search the requests list, expect not-visible or a cancelled badge). Assert via UI + API.

## Ids from WP0
Base + one extra investigation (e.g. `E2E_INV_GLU_ID`) for the add step. Env fallbacks.

## Acceptance
- [ ] 2 scenarios with description + named steps + JSDoc.
- [ ] R11 add→total up, remove→total down (asserted counts + totals). R12 cancel→cancelled + gone from active.
- [ ] `npx playwright test --grep "@lifecycle"` green. ng build unaffected.

## Out of scope
Client types (WP1), payment (WP2), tests (WP3). No BE changes.

## Flags
No [FIN] (asserting totals, not moving money). No migration.
