## Summary - extract baseline compare orchestration behind an explicit strategy contract and registry - preserve the current Intune compare path through a dedicated `IntuneCompareStrategy` - harden compare launch and review surfaces for mixed, unsupported, incomplete, and strategy-failure truth - add Spec 203 artifacts, focused regression coverage, and future-domain strategy proof tests ## Testing - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Baselines/CompareStrategyRegistryTest.php tests/Unit/Baselines/CompareSubjectResultContractTest.php tests/Feature/Baselines/BaselineCompareStrategySelectionTest.php tests/Feature/Baselines/BaselineComparePreconditionsTest.php tests/Feature/Baselines/BaselineCompareExecutionGuardTest.php tests/Feature/Baselines/BaselineCompareMatrixCompareAllActionTest.php tests/Feature/Filament/BaselineProfileCompareStartSurfaceTest.php tests/Feature/Filament/BaselineCompareLandingStartSurfaceTest.php tests/Feature/Filament/BaselineCompareLandingWhyNoFindingsTest.php tests/Feature/Filament/BaselineCompareMatrixPageTest.php tests/Feature/Filament/OperationRunBaselineTruthSurfaceTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` ## Notes - no new Filament panel/provider registration changes - no global-search resource changes - no new asset registration or deployment step changes Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #233
97 lines
4.1 KiB
PHP
97 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Baselines;
|
|
|
|
use App\Support\Ui\OperatorExplanation\ExplanationFamily;
|
|
use App\Support\Ui\OperatorExplanation\TrustworthinessLevel;
|
|
|
|
enum BaselineCompareReasonCode: string
|
|
{
|
|
case NoSubjectsInScope = 'no_subjects_in_scope';
|
|
case CoverageUnproven = 'coverage_unproven';
|
|
case EvidenceCaptureIncomplete = 'evidence_capture_incomplete';
|
|
case UnsupportedSubjects = 'unsupported_subjects';
|
|
case AmbiguousSubjects = 'ambiguous_subjects';
|
|
case StrategyFailed = 'strategy_failed';
|
|
case RolloutDisabled = 'rollout_disabled';
|
|
case NoDriftDetected = 'no_drift_detected';
|
|
case OverdueFindingsRemain = 'overdue_findings_remain';
|
|
case GovernanceExpiring = 'governance_expiring';
|
|
case GovernanceLapsed = 'governance_lapsed';
|
|
|
|
public function message(): string
|
|
{
|
|
return match ($this) {
|
|
self::NoSubjectsInScope => 'No subjects were in scope for this comparison.',
|
|
self::CoverageUnproven => 'Coverage proof was missing or incomplete, so some findings were suppressed for safety.',
|
|
self::EvidenceCaptureIncomplete => 'Evidence capture was incomplete, so some drift evaluation may have been suppressed.',
|
|
self::UnsupportedSubjects => 'One or more in-scope subjects could not be compared by the selected strategy.',
|
|
self::AmbiguousSubjects => 'One or more in-scope subjects could not be compared because identity matching stayed ambiguous.',
|
|
self::StrategyFailed => 'One or more in-scope subjects failed during strategy processing, so the compare result is incomplete.',
|
|
self::RolloutDisabled => 'Full-content baseline compare is currently disabled by rollout configuration.',
|
|
self::NoDriftDetected => 'No drift was detected for in-scope subjects.',
|
|
self::OverdueFindingsRemain => 'Overdue findings still need action even though the latest compare did not produce new drift.',
|
|
self::GovernanceExpiring => 'Accepted-risk governance is nearing expiry and needs review.',
|
|
self::GovernanceLapsed => 'Accepted-risk governance has lapsed and needs follow-up.',
|
|
};
|
|
}
|
|
|
|
public function explanationFamily(): ExplanationFamily
|
|
{
|
|
return match ($this) {
|
|
self::NoDriftDetected => ExplanationFamily::NoIssuesDetected,
|
|
self::CoverageUnproven,
|
|
self::EvidenceCaptureIncomplete,
|
|
self::UnsupportedSubjects,
|
|
self::AmbiguousSubjects,
|
|
self::RolloutDisabled,
|
|
self::OverdueFindingsRemain,
|
|
self::GovernanceExpiring,
|
|
self::GovernanceLapsed => ExplanationFamily::CompletedButLimited,
|
|
self::StrategyFailed => ExplanationFamily::BlockedPrerequisite,
|
|
self::NoSubjectsInScope => ExplanationFamily::MissingInput,
|
|
};
|
|
}
|
|
|
|
public function trustworthinessLevel(): TrustworthinessLevel
|
|
{
|
|
return match ($this) {
|
|
self::NoDriftDetected => TrustworthinessLevel::Trustworthy,
|
|
self::CoverageUnproven,
|
|
self::EvidenceCaptureIncomplete,
|
|
self::UnsupportedSubjects,
|
|
self::AmbiguousSubjects,
|
|
self::OverdueFindingsRemain,
|
|
self::GovernanceExpiring,
|
|
self::GovernanceLapsed => TrustworthinessLevel::LimitedConfidence,
|
|
self::StrategyFailed,
|
|
self::RolloutDisabled,
|
|
self::NoSubjectsInScope => TrustworthinessLevel::Unusable,
|
|
};
|
|
}
|
|
|
|
public function absencePattern(): ?string
|
|
{
|
|
return match ($this) {
|
|
self::NoDriftDetected => 'true_no_result',
|
|
self::CoverageUnproven,
|
|
self::EvidenceCaptureIncomplete,
|
|
self::UnsupportedSubjects,
|
|
self::AmbiguousSubjects,
|
|
self::OverdueFindingsRemain,
|
|
self::GovernanceExpiring,
|
|
self::GovernanceLapsed => 'suppressed_output',
|
|
self::StrategyFailed,
|
|
self::RolloutDisabled => 'blocked_prerequisite',
|
|
self::NoSubjectsInScope => 'missing_input',
|
|
};
|
|
}
|
|
|
|
public function supportsPositiveClaim(): bool
|
|
{
|
|
return $this === self::NoDriftDetected;
|
|
}
|
|
}
|