TenantAtlas/specs/383-baseline-result-semantics/implementation-close-out.md
ahmido ea77c8c718 feat(baselines): implement baseline compare result semantics (#454)
Implemented deterministic Baseline Result Semantics (Spec 383), introducing CompareSubjectResult and CompareEvidenceResult. Replaced generic arrays with strict Data Transfer Objects for Baseline engine output.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #454
2026-06-16 20:20:27 +00:00

5.9 KiB

Implementation Close-Out: Spec 383 - Baseline Compare Result Semantics and Gap Classification v1

Scope Delivered

  • Added provider-neutral compare result semantics under apps/platform/app/Support/Baselines/CompareSemantics/.
  • Replaced authoritative baseline compare gap/result reasons with V1 values such as missing_local_evidence, missing_provider_resource, unresolved_duplicate_candidates, foundation_inventory_only, compare_not_supported, and compare_failed.
  • Added structured baseline_compare.result_semantics payloads with run outcome, operation outcome, counts by reason/category/actionability/readiness impact, and bounded subject outcomes.
  • Extended baseline_compare.evidence_gaps with structured category/actionability/readiness counts while keeping existing summary_counts keys compatible.
  • Updated existing Filament/Livewire compare surfaces to render provider-neutral labels from persisted context.
  • Updated compare, matching, coverage, matrix, monitoring, and presentation regression tests.

Explicit Boundaries

  • No new database tables, migrations, indexes, persisted entities, env vars, queues, scheduler entries, routes, navigation entries, Filament panel providers, actions, modals, drawers, wizards, assets, or storage paths were added.
  • No Spec 384 operator resolution UI, manual bind/exclude/accept-limitation workflow, or operator decision screen was implemented.
  • No Spec 385 final Evidence Snapshot readiness mapping, Review Pack publication blocker mapping, or customer-facing report/review wording was implemented.
  • Existing missing_policy finding change_type semantics remain unchanged because they are drift-finding evidence, not baseline compare result truth.
  • Remaining legacy strings are limited to capture flows, historical/capture enum cases, portfolio preview matching, or negative guard tests that prove old values are not authoritative in the new semantics model.

Filament Contract

  • Livewire v4 compliance: project package state is Livewire v4.x and no Livewire v3 APIs were introduced.
  • Provider registration: no Filament panel provider changes were made; Laravel provider registration remains in apps/platform/bootstrap/providers.php.
  • Global search: no globally searchable Filament resources were added or changed.
  • Destructive/high-impact actions: no actions were added or changed; therefore no new confirmation or authorization path was introduced.
  • Asset strategy: no Filament or frontend assets were registered; no filament:assets deployment step is newly required by this spec.

Validation

  • cd apps/platform && ./vendor/bin/sail artisan test tests/Unit/Support/Baselines/CompareSemantics
  • cd apps/platform && ./vendor/bin/sail artisan test tests/Unit/Support/Baselines/Matching tests/Unit/Baselines/CompareStrategyRegistryTest.php
  • cd apps/platform && ./vendor/bin/sail artisan test tests/Unit/Support/Baselines/CompareSemantics/BaselineCompareOutcomeClassifierTest.php tests/Unit/Support/Baselines/Matching/MatchingOutcomeTest.php tests/Unit/Support/Baselines/Matching/SubjectMatchingPipelineTest.php tests/Unit/Services/Baselines/Matching/FoundationCoverageResolverTest.php tests/Unit/Support/Baselines/SubjectResolverTest.php tests/Unit/Baselines/CompareSubjectResultContractTest.php tests/Feature/Baselines/BaselineCompareGapClassificationTest.php tests/Feature/Baselines/BaselineCompareAmbiguousMatchGapTest.php tests/Feature/Baselines/BaselineCompareExecutionGuardTest.php tests/Feature/Baselines/BaselineCompareResumeTokenTest.php tests/Feature/Baselines/BaselineCompareProviderResourceBindingCanonicalIdentityTest.php tests/Feature/BaselineDriftEngine/CompareFidelityMismatchTest.php tests/Feature/Filament/BaselineCompareEvidenceGapTableTest.php tests/Feature/Filament/BaselineGapSurfacesDbOnlyRenderTest.php tests/Feature/Filament/OperationRunEnterpriseDetailPageTest.php tests/Feature/Filament/BaselineCompareLandingAdminTenantParityTest.php tests/Feature/Filament/BaselineCompareLandingWhyNoFindingsTest.php tests/Feature/Filament/NeedsAttentionWidgetTest.php tests/Feature/Filament/OperationRunBaselineTruthSurfaceTest.php
  • cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Baselines/BaselineCompareCoverageGuardTest.php tests/Feature/Baselines/BaselineCompareWhyNoFindingsReasonCodeTest.php tests/Feature/Baselines/BaselineCompareMatrixBuilderTest.php tests/Feature/Monitoring/GovernanceOperationRunSummariesTest.php tests/Feature/Baselines/BaselineGapContractCleanupTest.php
  • cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Evidence/BaselineDriftPostureSourceTest.php tests/Feature/ReviewPack/Spec347ReviewPackReadinessSemanticsTest.php tests/Feature/ReviewPack/Spec349ReviewPackResolutionGuidanceTest.php
  • cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Filament/BaselineCompareExplanationSurfaceTest.php tests/Feature/Filament/BaselineCompareLandingWhyNoFindingsTest.php tests/Feature/Filament/BaselineCompareSummaryConsistencyTest.php tests/Feature/Filament/BaselineCompareEvidenceGapTableTest.php
  • cd apps/platform && ./vendor/bin/sail pint ...changed files...
  • cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent
  • git diff --check

Browser Decision

Browser smoke was not run. The implementation changed persisted compare semantics, labels, and Livewire/Filament context rendering only; it did not change layout structure, navigation, actions, JavaScript behavior, routes, or assets. Existing Livewire/Filament feature tests cover the affected rendered surfaces.

Deployment Impact

  • Staging/production require code deploy only.
  • No migrations or data backfill are required.
  • Existing historical OperationRun payloads are not rewritten.
  • Queue workers should be restarted as part of the normal Laravel deploy so queued compare jobs use the new semantics code.
  • No new environment variables, storage volumes, cron/scheduler entries, or Dokploy-specific configuration changes are required.