TenantAtlas/specs/048-backup-restore-ui-graph-safety/plan.md
ahmido b35e3a6518 spec: refine 048 guardrails (#54)
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
2026-01-10 23:37:22 +00:00

83 lines
3.3 KiB
Markdown

# Implementation Plan: Backup/Restore UI Graph-Safety (Phase 1)
**Branch**: `feat/048-backup-restore-ui-graph-safety` | **Date**: 2026-01-11 | **Spec**: specs/048-backup-restore-ui-graph-safety/spec.md
**Input**: Feature specification from `specs/048-backup-restore-ui-graph-safety/spec.md`
## Summary
Ensure Backup/Restore Filament UI is Graph-safe by construction:
- No Microsoft Graph calls during render/mount/options/typeahead.
- Restore wizard group mapping UI shows DB-only fallback labels (`…<last8>`) instead of resolving names via Graph.
- Add fail-hard Pest feature tests that bind `GraphClientInterface` to throw and still allow:
- Backup Sets index to render (HTTP 200 + stable marker)
- Restore wizard to render (HTTP 200 + stable marker)
## Technical Context
**Language/Version**: PHP 8.2+ (repo guidance targets PHP 8.4.x)
**Primary Dependencies**: Laravel 12, Filament 4, Livewire 3
**Storage**: PostgreSQL (JSON columns used for snapshots/preview/results/mappings)
**Testing**: Pest 4 (via `php artisan test`), PHPUnit 12 under the hood
**Target Platform**: Sail-first local dev (Docker), Dokploy-first staging/prod (containers)
**Project Type**: Laravel monolith (Filament admin UI + jobs/services)
**Performance Goals**: N/A (UI correctness + safety)
**Constraints**:
- UI render must be DB-only (no Graph in request lifecycle)
- No new tables/migrations in Phase 1
- Keep surface area minimal and low-risk
**Scale/Scope**: Multi-tenant admin app; tests must enforce tenant scoping and guardrails
## Constitution Check
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
- Inventory-first: PASS (this phase only hardens UI render boundaries; no changes to SoT semantics)
- Read/write separation: PASS (no restore execution changes; tests cover render only)
- Single contract path to Graph: PASS (goal is “no Graph in UI render”; Graph stays behind `GraphClientInterface`)
- Deterministic capabilities: PASS (no capability derivation changes)
- Tenant isolation: PASS (tests use tenant-scoped URLs and seeded tenant data)
- Automation idempotent/observable: PASS (no job/scheduler changes in Phase 1)
- Data minimization & safe logging: PASS (no new stored data or logs)
## Project Structure
### Documentation (this feature)
```text
specs/048-backup-restore-ui-graph-safety/
├── plan.md # This file (/speckit.plan output)
├── research.md # Phase 0 output
├── data-model.md # Phase 1 output
├── quickstart.md # Phase 1 output
├── contracts/ # Phase 1 output
└── tasks.md # Task breakdown (already present)
```
### Source Code (repository root)
```text
app/
├── Filament/
│ ├── Resources/
│ │ ├── BackupSetResource.php
│ │ └── RestoreRunResource.php
│ └── Resources/*/Pages/
├── Providers/
│ ├── AppServiceProvider.php # GraphClientInterface binding
│ └── Filament/AdminPanelProvider.php # panel path + tenant routing
├── Services/
│ └── Graph/
│ ├── GraphClientInterface.php
│ └── NullGraphClient.php
database/migrations/
tests/Feature/
```
**Structure Decision**: Laravel monolith (Filament admin UI + services). No new top-level folders.
## Complexity Tracking
None.