TenantAtlas/specs/130-structured-snapshot-rendering/quickstart.md
ahmido 3c445709af feat: add structured baseline snapshot rendering (#158)
## Summary
- replace the baseline snapshot detail page with a structured summary-first rendering flow
- add a presenter plus renderer registry with RBAC, compliance, and fallback renderers
- add grouped policy-type browsing, fidelity and gap badges, and workspace authorization coverage
- add Feature 130 spec, plan, contract, research, quickstart, and completed task artifacts

## Testing
- focused Pest coverage was added for structured rendering, fallback behavior, degraded states, authorization, presenter logic, renderer resolution, and badge mapping
- I did not rerun the full validation suite in this final PR step

## Notes
- base branch: `dev`
- feature branch: `130-structured-snapshot-rendering`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #158
2026-03-10 08:28:06 +00:00

63 lines
3.8 KiB
Markdown

# Quickstart: Structured Snapshot Rendering & Type-Agnostic Item Browser
**Feature**: 130-structured-snapshot-rendering | **Date**: 2026-03-09
## Scope
This feature upgrades the workspace-scoped baseline snapshot detail view by:
- replacing raw JSON as the primary snapshot detail UX,
- introducing a normalized summary-first presentation model,
- rendering all captured policy types through a grouped item browser,
- keeping groups collapsed by default,
- preserving richer RBAC detail as an enrichment layer,
- adding initial structured rendering for `deviceCompliancePolicy`,
- keeping raw technical payload secondary and collapsed.
## Implementation order
1. Create the normalized snapshot rendering primitives under `app/Services/Baselines/SnapshotRendering`.
2. Implement the page-level presenter and type-renderer registry with fallback resolution.
3. Extract current `intuneRoleDefinition` mapping into a dedicated renderer.
4. Add initial `deviceCompliancePolicy` structured rendering.
5. Introduce centralized fidelity and gap badge semantics.
6. Rebuild the `BaselineSnapshotResource` detail infolist around metadata, summary, groups, and technical disclosure.
7. Update existing snapshot visibility tests to the new layout and add focused presenter and fallback coverage.
8. Run focused Sail-based tests.
9. Run Pint on dirty files.
## Reference files
- [app/Filament/Resources/BaselineSnapshotResource.php](../../../app/Filament/Resources/BaselineSnapshotResource.php)
- [app/Filament/Resources/BaselineSnapshotResource/Pages/ViewBaselineSnapshot.php](../../../app/Filament/Resources/BaselineSnapshotResource/Pages/ViewBaselineSnapshot.php)
- [app/Models/BaselineSnapshot.php](../../../app/Models/BaselineSnapshot.php)
- [app/Models/BaselineSnapshotItem.php](../../../app/Models/BaselineSnapshotItem.php)
- [app/Support/Badges/BadgeCatalog.php](../../../app/Support/Badges/BadgeCatalog.php)
- [app/Support/Badges/BadgeRenderer.php](../../../app/Support/Badges/BadgeRenderer.php)
- [resources/views/filament/infolists/entries/snapshot-json.blade.php](../../../resources/views/filament/infolists/entries/snapshot-json.blade.php)
- [resources/views/filament/infolists/entries/settings-catalog-grouped.blade.php](../../../resources/views/filament/infolists/entries/settings-catalog-grouped.blade.php)
- [resources/views/filament/infolists/entries/restore-results.blade.php](../../../resources/views/filament/infolists/entries/restore-results.blade.php)
- [tests/Feature/Filament/BaselineSnapshotFidelityVisibilityTest.php](../../../tests/Feature/Filament/BaselineSnapshotFidelityVisibilityTest.php)
- [tests/Feature/Guards/FilamentTableStandardsGuardTest.php](../../../tests/Feature/Guards/FilamentTableStandardsGuardTest.php)
## Suggested validation commands
```bash
vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineSnapshotFidelityVisibilityTest.php
vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineSnapshotStructuredRenderingTest.php
vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineSnapshotFallbackRenderingTest.php
vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineSnapshotAuthorizationTest.php
vendor/bin/sail artisan test --compact tests/Feature/Filament/BaselineSnapshotDegradedStateTest.php
vendor/bin/sail artisan test --compact tests/Unit/Baselines/SnapshotRendering
vendor/bin/sail bin pint --dirty --format agent
```
## Expected outcome
- Snapshot detail opens with a structured summary instead of raw JSON.
- Every captured policy type is visible in both the summary and grouped browser.
- Unsupported or newly added types render through the fallback contract instead of disappearing.
- `intuneRoleDefinition` remains rich but is no longer the only first-class inspectable type.
- `deviceCompliancePolicy` appears as a first-class structured group.
- Fidelity and gap states are explicit and centralized.