## Summary
- implement Spec 179 to make tenant lifecycle, provider consent, and provider verification the primary truth axes on the targeted Filament surfaces
- demote legacy tenant app status and legacy provider status and health to diagnostic-only roles, add centralized badge mappings for provider consent and verification, and keep provider connections excluded from global search
- add the full Spec 179 artifact set under `specs/179-provider-truth-cleanup/` plus focused Pest coverage for tenant truth cleanup, provider truth cleanup, RBAC, discovery safety, and badge semantics
- fix the numeric out-of-scope tenant route regression so inaccessible `/admin/tenants/{id}` paths return `404 Not Found` instead of `500`
## Testing
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantLifecycleStatusDomainSeparationTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantTruthCleanupSpec179Test.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/ProviderConnectionsDbOnlyTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections/ProviderConnectionTruthCleanupSpec179Test.php`
- `vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections/RequiredFiltersTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Tenants/TenantProviderConnectionsCtaTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Rbac/TenantResourceAuthorizationTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections/ProviderConnectionListAuthorizationTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/ProviderConnections/ProviderConnectionAuthorizationTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Rbac/AdminGlobalSearchContextSafetyTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantGlobalSearchLifecycleScopeTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Filament/TenantScopingTest.php`
- `vendor/bin/sail artisan test --compact tests/Unit/Badges/TenantBadgesTest.php`
- `vendor/bin/sail artisan test --compact tests/Unit/Badges/ProviderConnectionBadgesTest.php`
## Manual validation
- integrated-browser smoke on `/admin/tenants`, tenant detail, `/admin/provider-connections`, provider detail, and provider edit
- verified out-of-scope tenant and provider URLs return `404 Not Found` with the current session
## Notes
- branch: `179-provider-truth-cleanup`
- commit: `e54c6632`
- target: `dev`
Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #207
67 lines
2.7 KiB
PHP
67 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeDomain;
|
|
|
|
it('maps tenant status values to canonical badge semantics', function (): void {
|
|
$active = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'active');
|
|
expect($active->label)->toBe('Active');
|
|
expect($active->color)->toBe('success');
|
|
|
|
$archived = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'archived');
|
|
expect($archived->label)->toBe('Archived');
|
|
expect($archived->color)->toBe('gray');
|
|
|
|
$unknown = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'suspended');
|
|
expect($unknown->label)->toBe('Invalid lifecycle');
|
|
expect($unknown->color)->toBe('danger');
|
|
|
|
$error = BadgeCatalog::spec(BadgeDomain::TenantStatus, 'error');
|
|
expect($error->label)->toBe('Invalid lifecycle');
|
|
expect($error->color)->toBe('danger');
|
|
});
|
|
|
|
it('maps tenant app status values to legacy diagnostic badge semantics', function (): void {
|
|
$ok = BadgeCatalog::spec(BadgeDomain::TenantAppStatus, 'ok');
|
|
expect($ok->label)->toBe('OK');
|
|
expect($ok->color)->toBe('success');
|
|
|
|
$consentRequired = BadgeCatalog::spec(BadgeDomain::TenantAppStatus, 'consent_required');
|
|
expect($consentRequired->label)->toBe('Consent required');
|
|
expect($consentRequired->color)->toBe('warning');
|
|
|
|
$error = BadgeCatalog::spec(BadgeDomain::TenantAppStatus, 'error');
|
|
expect($error->label)->toBe('Error');
|
|
expect($error->color)->toBe('danger');
|
|
});
|
|
|
|
it('maps tenant RBAC status values to canonical badge semantics', function (): void {
|
|
$configured = BadgeCatalog::spec(BadgeDomain::TenantRbacStatus, 'configured');
|
|
expect($configured->label)->toBe('Configured');
|
|
expect($configured->color)->toBe('success');
|
|
|
|
$manual = BadgeCatalog::spec(BadgeDomain::TenantRbacStatus, 'manual_assignment_required');
|
|
expect($manual->label)->toBe('Manual assignment required');
|
|
expect($manual->color)->toBe('warning');
|
|
|
|
$notConfigured = BadgeCatalog::spec(BadgeDomain::TenantRbacStatus, 'not_configured');
|
|
expect($notConfigured->label)->toBe('Not configured');
|
|
expect($notConfigured->color)->toBe('gray');
|
|
});
|
|
|
|
it('maps tenant permission status values to canonical badge semantics', function (): void {
|
|
$granted = BadgeCatalog::spec(BadgeDomain::TenantPermissionStatus, 'granted');
|
|
expect($granted->label)->toBe('Granted');
|
|
expect($granted->color)->toBe('success');
|
|
|
|
$missing = BadgeCatalog::spec(BadgeDomain::TenantPermissionStatus, 'missing');
|
|
expect($missing->label)->toBe('Missing');
|
|
expect($missing->color)->toBe('warning');
|
|
|
|
$error = BadgeCatalog::spec(BadgeDomain::TenantPermissionStatus, 'error');
|
|
expect($error->label)->toBe('Error');
|
|
expect($error->color)->toBe('danger');
|
|
});
|