Implements Spec 118 baseline drift engine improvements: - Resumable, budget-aware evidence capture for baseline capture/compare runs (resume token + UI action) - “Why no findings?” reason-code driven explanations and richer run context panels - Baseline Snapshot resource (list/detail) with fidelity visibility - Retention command + schedule for pruning baseline-purpose PolicyVersions - i18n strings for Baseline Compare landing Verification: - `vendor/bin/sail bin pint --dirty --format agent` - `vendor/bin/sail artisan test --compact --filter=Baseline` (159 passed) Note: - `docs/audits/redaction-audit-2026-03-04.md` left untracked (not part of PR). Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #143
36 lines
829 B
PHP
36 lines
829 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Baselines;
|
|
|
|
final class BaselineSubjectKey
|
|
{
|
|
public static function fromDisplayName(?string $displayName): ?string
|
|
{
|
|
if (! is_string($displayName)) {
|
|
return null;
|
|
}
|
|
|
|
$trimmed = trim($displayName);
|
|
|
|
if ($trimmed === '') {
|
|
return null;
|
|
}
|
|
|
|
$collapsed = preg_replace('/\\s+/u', ' ', $trimmed);
|
|
$collapsed = is_string($collapsed) ? $collapsed : $trimmed;
|
|
|
|
$normalized = mb_strtolower($collapsed);
|
|
$normalized = trim($normalized);
|
|
|
|
return $normalized !== '' ? $normalized : null;
|
|
}
|
|
|
|
public static function workspaceSafeSubjectExternalId(string $policyType, string $subjectKey): string
|
|
{
|
|
return hash('sha256', $policyType.'|'.$subjectKey);
|
|
}
|
|
}
|
|
|