## 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
67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Filament\Resources\BaselineSnapshotResource;
|
|
use App\Models\BaselineProfile;
|
|
use App\Models\BaselineSnapshot;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('shows snapshot fidelity counts and gap state on list and view pages', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'readonly');
|
|
|
|
$profile = BaselineProfile::factory()->active()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
]);
|
|
|
|
$complete = BaselineSnapshot::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'captured_at' => now()->subHour(),
|
|
'summary_jsonb' => [
|
|
'total_items' => 5,
|
|
'fidelity_counts' => ['content' => 5, 'meta' => 0],
|
|
'gaps' => ['count' => 0, 'by_reason' => []],
|
|
],
|
|
]);
|
|
|
|
$withGaps = BaselineSnapshot::factory()->create([
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'baseline_profile_id' => (int) $profile->getKey(),
|
|
'captured_at' => now()->subMinutes(10),
|
|
'summary_jsonb' => [
|
|
'total_items' => 5,
|
|
'fidelity_counts' => ['content' => 3, 'meta' => 2],
|
|
'gaps' => ['count' => 2, 'by_reason' => ['meta_fallback' => 2]],
|
|
],
|
|
]);
|
|
|
|
$this->actingAs($user)
|
|
->get(BaselineSnapshotResource::getUrl(panel: 'admin'))
|
|
->assertOk()
|
|
->assertSee('Complete')
|
|
->assertSee('Captured with gaps')
|
|
->assertSee('Content 5, Meta 0')
|
|
->assertSee('Content 3, Meta 2');
|
|
|
|
$this->actingAs($user)
|
|
->get(BaselineSnapshotResource::getUrl('view', ['record' => $withGaps], panel: 'admin'))
|
|
->assertOk()
|
|
->assertSee('Coverage summary')
|
|
->assertSee('Captured with gaps')
|
|
->assertSee('Content 3, Meta 2')
|
|
->assertSee('Evidence gaps')
|
|
->assertSee('2');
|
|
|
|
$this->actingAs($user)
|
|
->get(BaselineSnapshotResource::getUrl('view', ['record' => $complete], panel: 'admin'))
|
|
->assertOk()
|
|
->assertSee('Coverage summary')
|
|
->assertSee('Complete')
|
|
->assertSee('Content 5, Meta 0')
|
|
->assertSee('Evidence gaps')
|
|
->assertSee('0');
|
|
});
|