## 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
177 lines
13 KiB
Markdown
177 lines
13 KiB
Markdown
---
|
||
description: "Task list for feature implementation"
|
||
---
|
||
|
||
# Tasks: Unified Badge System (Single Source of Truth) v1
|
||
|
||
**Input**: Design documents from `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/`
|
||
|
||
**Tests**: Required (Pest) — this feature changes runtime UI semantics and adds regression guardrails.
|
||
|
||
---
|
||
|
||
## Phase 1: Setup (Shared Infrastructure)
|
||
|
||
- [X] T001 Confirm feature inputs exist: `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/spec.md`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/plan.md`
|
||
- [X] T002 Confirm Phase 0/1 artifacts exist: `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/research.md`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/data-model.md`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/contracts/badge-semantics.md`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/contracts/guardrails.md`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/quickstart.md`
|
||
|
||
---
|
||
|
||
## Phase 2: Foundational (Blocking Prerequisites)
|
||
|
||
**Purpose**: Establish the centralized badge semantics layer that all user stories depend on.
|
||
|
||
- [X] T003 Create badge value object in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/BadgeSpec.php`
|
||
- [X] T004 Create badge domain + mapper contracts in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/BadgeDomain.php` and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/BadgeMapper.php`
|
||
- [X] T005 Create central resolver/registry in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/BadgeCatalog.php` (safe unknown fallback; no side effects)
|
||
- [X] T006 Create Filament + Blade helper closures in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/BadgeRenderer.php` (table/infolist helpers for status-like badges)
|
||
- [X] T007 Add foundational unit coverage for unknown fallback + allowed color set in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/BadgeCatalogTest.php`
|
||
|
||
**Checkpoint**: Central badge semantics infrastructure exists and is covered.
|
||
|
||
---
|
||
|
||
## Phase 3: User Story 1 — Trustworthy status/health + severity/risk badges everywhere (Priority: P1) 🎯 MVP
|
||
|
||
**Goal**: Status-like values (status/health and severity/risk) render consistently across the suite, using central semantics.
|
||
|
||
**Independent Test**: Run badge mapper tests and verify key pages (Operations + Drift findings + Restore runs) show consistent meanings, including “success is never warning”.
|
||
|
||
### Tests (US1)
|
||
|
||
- [X] T008 [P] [US1] Add OperationRun badge mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/OperationRunBadgesTest.php`
|
||
- [X] T009 [P] [US1] Add Finding status + severity mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/FindingBadgesTest.php`
|
||
- [X] T010 [P] [US1] Add RestoreRun status mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RestoreRunBadgesTest.php`
|
||
- [X] T011 [P] [US1] Add InventorySyncRun + BackupScheduleRun mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RunStatusBadgesTest.php`
|
||
|
||
### Implementation (US1)
|
||
|
||
- [X] T012 [US1] Implement OperationRun status/outcome badge domains in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/OperationRunStatusBadge.php` and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/OperationRunOutcomeBadge.php`
|
||
- [X] T013 [US1] Implement drift finding severity badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/FindingSeverityBadge.php` (low=neutral, medium=warning, high=danger)
|
||
- [X] T014 [US1] Implement finding status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/FindingStatusBadge.php`
|
||
- [X] T015 [US1] Implement RestoreRun status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/RestoreRunStatusBadge.php`
|
||
- [X] T016 [US1] Implement InventorySyncRun status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/InventorySyncRunStatusBadge.php`
|
||
- [X] T017 [US1] Implement BackupScheduleRun status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/BackupScheduleRunStatusBadge.php`
|
||
- [X] T018 [US1] Implement EntraGroupSyncRun status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/EntraGroupSyncRunStatusBadge.php`
|
||
- [X] T019 [US1] Implement status-like boolean badge domains in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/BooleanEnabledBadge.php` and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/BooleanHasErrorsBadge.php`
|
||
|
||
### Migration (US1)
|
||
|
||
- [X] T020 [P] [US1] Migrate Operations resource badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/OperationRunResource.php` (remove ad-hoc `statusColor()` / `outcomeColor()` logic)
|
||
- [X] T021 [P] [US1] Migrate Monitoring Operations table badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Pages/Monitoring/Operations.php` (remove `->colors([...])`)
|
||
- [X] T022 [P] [US1] Migrate dashboard “Recent Operations” badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Widgets/Dashboard/RecentOperations.php`
|
||
- [X] T023 [P] [US1] Migrate dashboard “Recent Drift Findings” severity/status badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Widgets/Dashboard/RecentDriftFindings.php`
|
||
- [X] T024 [P] [US1] Migrate Finding resource status/severity badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/FindingResource.php`
|
||
- [X] T025 [P] [US1] Migrate Inventory sync run status + had_errors badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/InventorySyncRunResource.php`
|
||
- [X] T026 [P] [US1] Migrate backup schedule “last run status” and runs relation manager badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/BackupScheduleResource.php` and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/BackupScheduleResource/RelationManagers/BackupScheduleRunsRelationManager.php` (leave tag-like frequency badge unchanged in v1)
|
||
- [X] T027 [P] [US1] Migrate Entra group sync run status badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/EntraGroupSyncRunResource.php`
|
||
- [X] T028 [P] [US1] Migrate Restore run status badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/RestoreRunResource.php`
|
||
- [X] T029 [P] [US1] Migrate restore run check severity badges to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/forms/components/restore-run-checks.blade.php`
|
||
- [X] T030 [US1] Sweep + migrate remaining status-like badge semantics in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Livewire/`, and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/` (status/health + severity/risk only; tag/category chips explicitly out of scope for v1)
|
||
|
||
**Checkpoint**: US1 is shippable as an MVP (status-like badges consistent across key surfaces).
|
||
|
||
---
|
||
|
||
## Phase 4: User Story 2 — Readable status badges in dark mode (Priority: P2)
|
||
|
||
**Goal**: Status-like badges remain readable in dark mode, without custom Tailwind chip overrides.
|
||
|
||
**Independent Test**: Open restore preview/results and other badge-heavy views in dark mode and confirm badges remain readable and consistent.
|
||
|
||
### Tests (US2)
|
||
|
||
- [X] T031 [P] [US2] Add restore preview/results decision/status mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RestoreUiBadgesTest.php`
|
||
|
||
### Implementation (US2)
|
||
|
||
- [X] T032 [US2] Introduce restore preview decision badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/RestorePreviewDecisionBadge.php`
|
||
- [X] T033 [US2] Introduce restore results status badge domain in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Support/Badges/Domains/RestoreResultStatusBadge.php`
|
||
- [X] T034 [US2] Replace custom Tailwind decision chips with Filament badges in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/infolists/entries/restore-preview.blade.php` (status-like chips only; keep policy type/platform tags as-is)
|
||
- [X] T035 [US2] Replace custom Tailwind result/status chips with Filament badges in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/infolists/entries/restore-results.blade.php` (status-like chips only)
|
||
|
||
**Checkpoint**: Dark mode readability is preserved on badge-heavy restore views.
|
||
|
||
---
|
||
|
||
## Phase 5: User Story 3 — Consistency stays enforced over time (Priority: P3)
|
||
|
||
**Goal**: Ad-hoc status-like badge semantics cannot be reintroduced without failing automated checks.
|
||
|
||
**Independent Test**: Introduce an ad-hoc status/severity mapping in a Filament surface and confirm the guard test fails.
|
||
|
||
### Tests + Guard (US3)
|
||
|
||
- [X] T036 [US3] Add “no ad-hoc status-like badge semantics” guard test in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Feature/Guards/NoAdHocStatusBadgesTest.php` (pattern-based; allowlist tag/category chips)
|
||
|
||
**Checkpoint**: Guardrails prevent drift from reappearing.
|
||
|
||
---
|
||
|
||
## Phase 6: Polish & Cross-Cutting Concerns
|
||
|
||
- [X] T037 [P] Run formatting on changed files via `vendor/bin/sail php /Users/ahmeddarrazi/Documents/projects/TenantAtlas/vendor/bin/pint --dirty`
|
||
- [X] T038 Run targeted tests via `vendor/bin/sail artisan test /Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/ /Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Feature/Guards/NoAdHocStatusBadgesTest.php`
|
||
- [X] T039 Run quickstart verification steps from `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/specs/059-unified-badges/quickstart.md`
|
||
- [X] T040 [P] Add BackupSet status mapping tests in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/BackupSetBadgesTest.php` (completed must be success)
|
||
- [X] T041 Migrate BackupSet status badge to central mapping in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/app/Filament/Resources/BackupSetResource.php` (completed must be green)
|
||
- [X] T042 Sweep for any remaining `completed` status-like badges rendered as warning and migrate to BadgeCatalog
|
||
- [X] T043 Fix Blade compilation for restore views (replace inline `@php(...)`) in `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/infolists/entries/restore-results.blade.php`, `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/infolists/entries/restore-preview.blade.php`, and `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/resources/views/filament/forms/components/restore-run-checks.blade.php`
|
||
|
||
---
|
||
|
||
## Dependencies & Execution Order
|
||
|
||
### Dependency Graph (high-level)
|
||
|
||
```text
|
||
Phase 1 (Setup)
|
||
↓
|
||
Phase 2 (Foundational badge system)
|
||
↓
|
||
US1 (status/health + severity/risk migration) ──┬─→ US2 (dark mode restore views)
|
||
└─→ US3 (guard test)
|
||
↓
|
||
Phase 6 (Polish)
|
||
```
|
||
|
||
### User Story Dependencies
|
||
|
||
- US1 (P1) depends on Foundational (Phase 2) and can ship as the MVP.
|
||
- US2 (P2) depends on Foundational (Phase 2); easiest after US1 establishes the core domains.
|
||
- US3 (P3) depends on Foundational (Phase 2) and should run after the first migrations to tune allowlists and reduce false positives.
|
||
|
||
Suggested MVP-first order: Phase 1 → Phase 2 → US1 → Phase 6 (minimum) → US2 → US3 → Phase 6 (final pass).
|
||
|
||
---
|
||
|
||
## Parallel Execution Examples (per user story)
|
||
|
||
### US1
|
||
- T008 [P] [US1] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/OperationRunBadgesTest.php`
|
||
- T009 [P] [US1] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/FindingBadgesTest.php`
|
||
- T010 [P] [US1] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RestoreRunBadgesTest.php`
|
||
- T011 [P] [US1] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RunStatusBadgesTest.php`
|
||
- T020–T029 [P] [US1] (migration tasks; different files)
|
||
|
||
### US2
|
||
- T031 [P] [US2] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/RestoreUiBadgesTest.php`
|
||
|
||
### US3
|
||
- T036 [US3] `/Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Feature/Guards/NoAdHocStatusBadgesTest.php`
|
||
|
||
---
|
||
|
||
## Implementation Strategy
|
||
|
||
### MVP First (US1 only)
|
||
|
||
1. Complete Phase 1 + Phase 2
|
||
2. Implement US1 migrations for Operations + Drift findings + Restore runs first (T020–T029)
|
||
3. Run: `vendor/bin/sail artisan test /Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/OperationRunBadgesTest.php`
|
||
4. Run: `vendor/bin/sail artisan test /Users/ahmeddarrazi/Documents/projects/TenantAtlas/tests/Unit/Badges/FindingBadgesTest.php`
|
||
|
||
### Incremental Delivery
|
||
|
||
- Finish US1 sweep (T030), then address restore Blade dark-mode hotspots in US2, then lock in regression prevention in US3.
|