Summary Dieses PR führt Spec 048: Backup/Restore UI Graph-Safety ein. Ziel: Backup/Restore-Screens in Filament sollen stabil und skalierbar bleiben, indem keine Microsoft Graph Calls beim UI-Rendern (mount/render/options/typeahead/labels) stattfinden. Stattdessen: DB-only Render + klare Fallbacks + Guard-Tests, die jede versehentliche UI-Graph-Nutzung sofort brechen. ⸻ Motivation / Problem Im aktuellen Stand rutschen Graph Calls gerne in: • Restore Wizard Group-Typeahead / getOptionLabelUsing (Graph /groups) • “Preview/Dry-Run” oder Label-Resolution im UI-Request Das führt zu: • langsamen/fragilen Pages (429/Timeout/Permissions) • schwerer Debugbarkeit im MSP-Scale • unerwarteten Abhängigkeiten vom Graph in reinen UI-Views ⸻ Scope (Phase 1, MVP) In scope • UI Render DB-only: Keine Graph Calls in Filament Render-Pfaden (Backup + Restore) • Fallback Labels für unresolved IDs: • Format: Unresolved (…<last8>) • Group Mapping UX (DB-only): • manuelle GUID Eingabe • GUID Validation • Helper-Text, wo Admins die Object ID finden • kein Graph-Search/typeahead • Fail-hard Guard Tests als Pest Feature Tests (HTTP GET): • Render Backup Sets Index • Render Restore Wizard • Tests assert: 200 OK + stable marker string Out of scope • Job-Orchestration Refactor (Actions wie “Capture snapshot”, “Rerun restore”, “dry-run execution”) → separater Spec/Feature • Entra Group Name Resolution (Group Inventory / Cache) → separater Modul-Scope ⸻ Deliverables • spec.md, plan.md, tasks.md • checklists/requirements.md (constitution gate) • Klar definierte Marker-Regeln für Guard-Tests (statische Headings, keine dynamischen Row-Werte) ⸻ Success Criteria • Guard-Tests schlagen zuverlässig fehl, sobald ein UI-Render Pfad Graph aufruft. • Restore Wizard bleibt bedienbar ohne Graph-Typeahead (GUID manual entry + Validation). • Keine DB-Migrations in dieser Phase. ⸻ Next Step Nach Review/Merge dieses Specs: 1. Implementation gemäß tasks.md (Remove UI Graph calls + Guard Tests) 2. Targeted Tests + Pint 3. Erst danach optional: eigener Spec für “job-based orchestration” (queued preview/execution) Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #54
60 lines
2.0 KiB
Markdown
60 lines
2.0 KiB
Markdown
# Data Model: Backup/Restore UI Graph-Safety (048)
|
|
|
|
This phase introduces **no schema changes**. It hardens UI render boundaries and adds guard tests.
|
|
|
|
## Existing Entities (used by this feature)
|
|
|
|
### Tenant
|
|
- Purpose: Tenancy boundary for all reads/writes.
|
|
- Notes:
|
|
- Filament panel is tenant-scoped via `external_id` slug.
|
|
|
|
### User
|
|
- Purpose: Authenticated actor; has tenant memberships/roles.
|
|
|
|
### BackupSet (`backup_sets`)
|
|
- Fields (selected):
|
|
- `id`, `tenant_id`
|
|
- `name`, `created_by`, `status`, `item_count`, `completed_at`
|
|
- `metadata` (JSON)
|
|
- `deleted_at` (soft deletes, via housekeeping migration)
|
|
- Indexes: `tenant_id,status`, `completed_at`
|
|
- Used in UI:
|
|
- Backup Sets index (table rendering must be DB-only)
|
|
|
|
### BackupItem (`backup_items`)
|
|
- Fields (selected):
|
|
- `id`, `tenant_id`, `backup_set_id`
|
|
- `policy_id` (nullable), `policy_version_id` (nullable)
|
|
- `policy_identifier`, `policy_type`, `platform`
|
|
- `captured_at`
|
|
- `payload` (JSON), `metadata` (JSON), `assignments` (JSON)
|
|
- `deleted_at` (soft deletes)
|
|
- Constraints:
|
|
- Unique: `(backup_set_id, policy_identifier, policy_type)`
|
|
- Used in UI:
|
|
- Restore wizard item selection + metadata display (must not resolve external names via Graph)
|
|
|
|
### RestoreRun (`restore_runs`)
|
|
- Fields (selected):
|
|
- `id`, `tenant_id`, `backup_set_id`
|
|
- `requested_by`, `is_dry_run`, `status`
|
|
- `requested_items` (JSON), `preview` (JSON), `results` (JSON)
|
|
- `group_mapping` (JSON)
|
|
- `failure_reason`, `started_at`, `completed_at`, `metadata` (JSON)
|
|
- `deleted_at` (soft deletes)
|
|
- Used in UI:
|
|
- Restore wizard render (Create page) including group mapping controls
|
|
|
|
## Relationships (high-level)
|
|
|
|
- `Tenant` has many `BackupSet`, `BackupItem`, `RestoreRun`.
|
|
- `BackupSet` has many `BackupItem`.
|
|
- `RestoreRun` belongs to `BackupSet`.
|
|
|
|
## Validation & State Transitions (relevant to this phase)
|
|
|
|
- No new state transitions introduced.
|
|
- The key invariant enforced by tests:
|
|
- Rendering Backup/Restore UI pages must not invoke `GraphClientInterface`.
|