TenantAtlas/specs/059-unified-badges/contracts/badge-semantics.md
ahmido 0b6600b926 059-unified-badges (#71)
## 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
2026-01-22 23:44:51 +00:00

1.5 KiB

Badge Semantics Contract — Unified Badge System (v1)

This feature does not introduce HTTP APIs. These contracts define stable UI semantics for status-like badges across the admin panel.

Scope (v1)

In scope (status-like)

  • Status/health signals (for example: queued/running/completed; enabled/disabled; available/missing; acknowledged/new).
  • Severity/risk signals (for example: drift finding severity).

Out of scope (v1)

  • Tag/category chips (for example: policy type, platform, environment labels).

Canonical color meanings (v1)

  • success: successful completion / safe / positive terminal meaning.
  • warning: queued / needs attention / partial / caution.
  • info: actively running / in progress.
  • danger: failed / blocking / high risk.
  • gray: neutral, unknown, or “not applicable”.

Invariants (v1)

  • Success/completed outcomes must never render as warning/attention.
  • Unknown values must render safely (neutral) and must not be misrepresented as success.
  • Badge rendering must be tenant-safe and must not trigger outbound HTTP, queued work, or DB lookups beyond already-loaded data.

Canonical mappings (v1)

Drift finding severity

  • low → neutral (gray)
  • medium → caution (warning)
  • high → high risk (danger)

Run-like states (minimum)

Run-like states must consistently convey:

  • queued → caution (warning)
  • running → in progress (info)
  • succeeded/completed → success (success)
  • partial → caution (warning)
  • failed → failure (danger)