# Tasks: Restore Run Wizard (011) **Branch**: `feat/011-restore-run-wizard` | **Date**: 2025-12-30 **Input**: `specs/011-restore-run-wizard/spec.md`, `specs/011-restore-run-wizard/plan.md` ## Phase 0 — Specs (this PR) - [x] T001 Create `spec.md`, `plan.md`, `tasks.md` for Feature 011. ## Phase 1 — Data Model + Status Semantics - [x] T002 Define RestoreRun lifecycle statuses and transitions (draft→scoped→checked→previewed→queued→running→completed|partial|failed). - [x] T003 Add minimal persistence for wizard state (prefer JSON in `restore_runs.metadata` unless columns are required). - [x] T004 Freeze `environment` + `highlander_label` at run creation for audit. ## Phase 2 — Filament Wizard (Create Restore Run) - [x] T005 Replace current single-form create with a 5-step wizard (Step 1–5 as in spec). - [x] T006 Ensure changing `backup_set_id` resets downstream wizard state. - [x] T007 Enforce “dry-run default ON” and keep execute disabled until all gates satisfied. ## Phase 3 — Restore Scope UX - [ ] T008 Implement scoped selection UI grouped by policy type + platform with search and bulk toggle. - [ ] T009 Mark preview-only types clearly and ensure they never execute. - [ ] T010 Ensure foundations are discoverable (assignment filters, scope tags, notification templates). ## Phase 4 — Safety & Conflict Checks - [ ] T011 Implement `RestoreRiskChecker` (server-side) and persist `check_summary` + `check_results`. - [ ] T012 Render check results with severity (blocking/warning/safe) and block execute when blockers exist. ## Phase 5 — Preview (Diff) - [ ] T013 Implement `RestoreDiffGenerator` using `PolicyNormalizer` + `VersionDiff`. - [ ] T014 Persist preview summary (and per-item diffs with safe limits) and require preview completion before execute. ## Phase 6 — Confirm & Execute - [ ] T015 Implement Step 5 confirmations (ack checkbox + tenant hard-confirm). - [ ] T016 Execute restore via a queued Job (preferred) and update statuses + timestamps. - [ ] T017 Persist execution outcomes and ensure audit logging entries exist for execution start/finish. ## Phase 7 — Tests + Formatting - [ ] T018 Add Pest tests for wizard gating rules and status transitions. - [ ] T019 Add Pest tests for safety checks persistence and blocking behavior. - [ ] T020 Add Pest tests for preview summary generation. - [ ] T021 Run `./vendor/bin/pint --dirty`. - [ ] T022 Run targeted tests (e.g. `./vendor/bin/sail artisan test --filter=RestoreRunWizard` once tests exist). ## Phase 8 — Policy Version Entry Point (later) - [ ] T023 Add a “Restore via Wizard” action on `PolicyVersion` that creates a 1-item Backup Set (source = policy_version) and opens the Restore Run wizard prefilled/scoped to that item.