## Summary - centralize all status-like badge semantics via `BadgeCatalog`/`BadgeRenderer` and new per-domain mappings plus coverage for every affected entity - replace ad-hoc badge colors in Filament tables/views with the shared catalog and add a guard test that blocks new inline semantics - stabilize restore views by avoiding `@php(...)` shorthand so Blade compiles cleanly, and document BADGE-001 in the constitution/templates ## Testing - `vendor/bin/sail php vendor/bin/pint --dirty` - `vendor/bin/sail artisan test tests/Unit/Badges tests/Feature/Guards/NoAdHocStatusBadgesTest.php` - `vendor/bin/sail artisan test tests/Feature/Monitoring/OperationsDbOnlyTest.php tests/Feature/Monitoring/OperationsTenantScopeTest.php` - `vendor/bin/sail artisan test tests/Feature/RestoreRunWizardMetadataTest.php tests/Feature/Filament/SettingsCatalogRestoreApplySettingsPatchTest.php` Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.local> Reviewed-on: #71
67 lines
2.3 KiB
Markdown
67 lines
2.3 KiB
Markdown
# Data Model — Unified Badge System (Single Source of Truth) v1
|
||
|
||
This feature is UI-only. It introduces no database schema changes.
|
||
|
||
## Entities (existing)
|
||
|
||
### Tenant
|
||
- **Role**: scope boundary for all queries and UI rendering.
|
||
- **Status-like fields used**:
|
||
- `status` (for example, `active`, `archived`)
|
||
- `is_current` (boolean)
|
||
|
||
### OperationRun
|
||
- **Role**: canonical operations/run observability.
|
||
- **Status-like fields used**:
|
||
- `status` (`queued|running|completed`)
|
||
- `outcome` (for example, `pending|succeeded|partial|failed|cancelled|...`)
|
||
|
||
### InventorySyncRun
|
||
- **Role**: inventory synchronization history and last-sync indicators.
|
||
- **Status-like fields used**:
|
||
- `status` (`pending|running|success|partial|failed|skipped`)
|
||
|
||
### BackupScheduleRun
|
||
- **Role**: scheduled backup history and status indicators.
|
||
- **Status-like fields used**:
|
||
- `status` (`running|success|partial|failed|canceled|skipped`)
|
||
|
||
### EntraGroupSyncRun
|
||
- **Role**: Entra group cache synchronization history.
|
||
- **Status-like fields used**:
|
||
- `status` (`pending|running|succeeded|partial|failed`)
|
||
- `safety_stop_triggered` (boolean)
|
||
|
||
### RestoreRun
|
||
- **Role**: restore orchestration progress and outcomes.
|
||
- **Status-like fields used**:
|
||
- `status` (enum-like string; see `RestoreRunStatus`)
|
||
|
||
### Finding
|
||
- **Role**: drift/risk indicators and triage workflow.
|
||
- **Status-like fields used**:
|
||
- `status` (`new|acknowledged`)
|
||
- `severity` (`low|medium|high`)
|
||
|
||
## Entities (code-only)
|
||
|
||
### Badge Domain
|
||
- **Role**: a named namespace for status-like values that must render consistently (for example, “inventory sync run status”, “drift finding severity”).
|
||
- **Uniqueness**: domain name is unique within the application.
|
||
|
||
### Badge Definition
|
||
- **Role**: the central mapping for a domain’s values → badge meaning.
|
||
- **Behavior**:
|
||
- Must be pure (no DB queries, no HTTP, no side effects).
|
||
- Must provide a safe default for unknown values.
|
||
|
||
## State transitions (existing)
|
||
|
||
### RestoreRunStatus (selected)
|
||
The restore run lifecycle is defined in code and must not be changed by this feature:
|
||
- Pre-flight states: draft → scoped → checked → previewed
|
||
- Execution: pending/queued → running → completed/partial/failed/cancelled
|
||
|
||
This feature standardizes how these values render; it does not change transitions.
|
||
|