TenantAtlas/specs/142-rbac-role-definition-diff-ux-upgrade/quickstart.md
2026-03-14 21:08:32 +01:00

50 lines
2.4 KiB
Markdown

# Quickstart: RBAC Role Definition Diff UX Upgrade
## Goal
Upgrade the existing RBAC role definition diff region on the finding detail page so it becomes the first concrete consumer of the shared diff presentation foundation from Spec 141.
## Implementation Steps
1. Add a small RBAC-specific builder that reads `Finding.evidence_jsonb.rbac_role_definition` and produces `DiffPresentation` using the shared `DiffPresenter`.
2. Move RBAC-specific field-label mapping, field-order rules, and list-field designation into that builder rather than the Blade view.
3. Refactor `resources/views/filament/infolists/entries/rbac-role-definition-diff.blade.php` so it renders:
- the shared summary badge partial
- the shared row partial for each row
- the existing RBAC explanatory copy about assignments exclusion and restore support
4. Keep unchanged rows visible but visually quieter by relying on the shared unchanged-row partial.
5. Render Allowed Actions and any other approved simple list fields through the shared inline list partial.
6. Do not add a local “show only changes” toggle unless the implementation remains clearly low-risk and unnecessary complexity does not appear.
## Verification Targets
Update and run the smallest focused set first:
```bash
vendor/bin/sail artisan test --compact tests/Feature/Filament/FindingViewRbacEvidenceTest.php
vendor/bin/sail artisan test --compact tests/Unit/Support/Diff/DiffPresenterTest.php
vendor/bin/sail artisan test --compact tests/Feature/Support/Diff/SharedDiffRowPartialTest.php
vendor/bin/sail artisan test --compact tests/Feature/Support/Diff/SharedInlineListDiffPartialTest.php
```
Then format:
```bash
vendor/bin/sail bin pint --dirty --format agent
```
## Acceptance Checklist
- Changed rows are visually stronger than unchanged rows.
- Summary badges match the rendered row states.
- Allowed Actions shows added and removed actions as inline list chips.
- Baseline-only and current-only rows render as removed and added, not generic changed rows.
- No-change and sparse payloads render safely.
- No unrelated diff consumer is migrated.
## Notes
- Livewire compliance remains on v4 because the feature stays within the existing Filament v5 surface.
- Provider registration remains unchanged in `bootstrap/providers.php`; this feature introduces no new provider or panel.
- The Findings resource already has a View page, so there is no global-search eligibility issue introduced by this work.