## Summary
Implements Spec 145 for tenant action taxonomy and lifecycle-safe visibility.
This PR:
- adds a central tenant action policy surface and supporting value objects
- aligns tenant list, detail, edit, onboarding, and widget surfaces around lifecycle-safe actions
- standardizes operator-facing lifecycle wording around View, Resume onboarding, Archive, Restore, and Complete onboarding
- tightens onboarding and tenant lifecycle authorization semantics, including honest 404 vs 403 behavior
- updates related regression coverage and spec artifacts for Spec 145
- fixes follow-on full-suite regressions uncovered during validation, including onboarding browser flows, provider consent fixtures, workspace redirect DI expectations, and critical table/action/UI expectation drift
## Validation
Executed and passed:
- vendor/bin/sail bin pint --dirty --format agent
- vendor/bin/sail artisan test --compact
Result:
- 2581 passed
- 8 skipped
- 13534 assertions
## Notes
- Base branch: dev
- Feature branch commit: a33a41b
- Filament v5 / Livewire v4 compliance preserved
- No panel provider registration changes; Laravel 12 provider registration remains in bootstrap/providers.php
- No new globally searchable resource behavior added in this slice
- Destructive lifecycle actions remain confirmation-gated and authorization-protected
Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #174
4.3 KiB
Quickstart: Implementing Spec 145
Preconditions
- Start Sail if it is not already running.
vendor/bin/sail up -d
- Confirm you are on the feature branch.
git branch --show-current
Expected branch: 145-tenant-action-taxonomy-lifecycle-safe-visibility
Implementation Sequence
-
Add the central tenant-action policy surface. Target areas:
app/Services/Tenants/app/Support/Tenants/
-
Refactor tenant-management surfaces to consume the central action policy. Target areas:
app/Filament/Resources/TenantResource.phpapp/Filament/Resources/TenantResource/Pages/ViewTenant.phpapp/Filament/Resources/TenantResource/Pages/EditTenant.phpapp/Filament/Resources/TenantResource/Pages/ListTenants.php
-
Keep onboarding workflow actions distinct and reuse onboarding lifecycle rules instead of duplicating tenant-surface logic. Target area:
app/Filament/Pages/Workspaces/ManagedTenantOnboardingWizard.php
-
Reuse existing centralized semantics instead of adding local mappings. Relevant existing files:
app/Services/Tenants/TenantOperabilityService.phpapp/Support/Tenants/TenantLifecycle.phpapp/Support/Badges/Domains/TenantStatusBadge.phpapp/Support/Audit/AuditActionId.phpapp/Support/Rbac/UiEnforcement.php
-
Keep User Story 3 implementation boundaries explicit.
T023owns runtime reuse of the resolved action catalog across list, detail, and onboarding surfaces.T024owns only action-surface declaration cleanup and overflow-contract alignment.- Do not move catalog-resolution logic into action-surface declarations.
-
Preserve Filament v5 and Livewire v4 compliance.
- No v3/v4 Filament APIs.
- No provider registration changes are needed; Laravel 12 panel providers remain in
bootstrap/providers.php. - Destructive actions remain confirmation-gated.
Focused Test Pass
Run the minimum targeted suite first:
vendor/bin/sail artisan test --compact tests/Unit/Tenants/TenantOperabilityServiceTest.php
vendor/bin/sail artisan test --compact tests/Unit/Tenants/TenantActionPolicySurfaceTest.php
vendor/bin/sail artisan test --compact tests/Feature/Rbac/TenantResourceAuthorizationTest.php
vendor/bin/sail artisan test --compact tests/Feature/Rbac/TenantLifecycleActionVisibilityTest.php
vendor/bin/sail artisan test --compact tests/Feature/Rbac/TenantLifecycleActionNamingTest.php
vendor/bin/sail artisan test --compact tests/Feature/Rbac/TenantActionSurfaceConsistencyTest.php
vendor/bin/sail artisan test --compact tests/Feature/Rbac/EditTenantArchiveUiEnforcementTest.php
vendor/bin/sail artisan test --compact tests/Feature/Onboarding/OnboardingDraftLifecycleTest.php
vendor/bin/sail artisan test --compact tests/Feature/TenantRBAC/TenantSwitcherScopeTest.php
vendor/bin/sail artisan test --compact tests/Feature/TenantRBAC/ArchivedTenantRouteAccessTest.php
These focused tests are part of the required regression baseline for this spec slice. Extend them as needed, but do not treat the central action-policy, confirmation-regression, or cross-surface consistency coverage as optional.
Formatting
Run Pint after edits:
vendor/bin/sail bin pint --dirty --format agent
Manual Verification Checklist
drafttenant on/admin/tenants: showsViewand onboarding-oriented action, notArchive.onboardingtenant on/admin/tenants/{tenant}: showsResume onboardingand readiness/support actions, not active-only lifecycle actions.activetenant on index and detail: showsArchive, not onboarding-only lifecycle actions.archivedtenant on index and detail: showsRestore, notArchiveorResume onboarding.- Onboarding wizard route: onboarding completion remains workflow-contextual and does not become a generic tenant action.
- Non-member access still resolves as 404; in-scope member without capability is denied as 403 or disabled-in-UI per existing helper semantics.
Done Criteria
The implementation is ready for completion review when:
- lifecycle-action assembly is centralized,
- index/detail/onboarding surfaces no longer drift semantically,
- audit and badge semantics remain centralized,
- targeted Pest coverage passes,
- and the Action Surface Contract still validates for touched Filament surfaces.