Implements the 074 verification checklist framework. Highlights: - Versioned verification report contract stored in operation_runs.context.verification_report (DB-only viewer). - Strict sanitizer/redaction (evidence pointers only; no tokens/headers/payloads) + schema validation. - Centralized BADGE-001 semantics for check status, severity, and overall report outcome. - Deterministic start (dedupe while active) via shared StartVerification service; capability-first authorization (non-member 404, member missing capability 403). - Completion audit event (verification.completed) with redacted metadata. - Integrations: OperationRun detail viewer, onboarding wizard verification step, provider connection start surfaces. Tests: - vendor/bin/sail artisan test --compact tests/Feature/Verification tests/Unit/Badges/VerificationBadgesTest.php - vendor/bin/sail bin pint --dirty Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box> Reviewed-on: #89
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Support;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Support\Verification\VerificationReportSanitizer;
|
|
use App\Support\Verification\VerificationReportSchema;
|
|
|
|
final class VerificationReportViewer
|
|
{
|
|
/**
|
|
* @return array<string, mixed>|null
|
|
*/
|
|
public static function report(OperationRun $run): ?array
|
|
{
|
|
$context = is_array($run->context) ? $run->context : [];
|
|
$report = $context['verification_report'] ?? null;
|
|
|
|
if (! is_array($report)) {
|
|
return null;
|
|
}
|
|
|
|
$report = VerificationReportSanitizer::sanitizeReport($report);
|
|
|
|
if (! VerificationReportSchema::isValidReport($report)) {
|
|
return null;
|
|
}
|
|
|
|
return $report;
|
|
}
|
|
|
|
public static function shouldRenderForRun(OperationRun $run): bool
|
|
{
|
|
$context = is_array($run->context) ? $run->context : [];
|
|
|
|
if (array_key_exists('verification_report', $context)) {
|
|
return true;
|
|
}
|
|
|
|
return in_array((string) $run->type, ['provider.connection.check'], true);
|
|
}
|
|
}
|