# Tasks: Spec 336 - Baseline Compare Product Process Flow Alignment - Input: `specs/336-baseline-compare-product-process-flow-alignment/spec.md`, `specs/336-baseline-compare-product-process-flow-alignment/plan.md` - Prerequisites: `spec.md`, `plan.md`, `repo-truth-map.md`, `baseline-compare-state-contract.md` **Tests**: Required. This changes a strategic operator surface and must be validated with Feature tests plus a Browser smoke file. ## Test Governance Checklist - [x] Lane assignment is explicit and is the narrowest sufficient proof (Feature + Browser). - [x] Browser coverage stays single-file and scenario-scoped (no silent heavy-family expansion). - [x] No new default-heavy helpers/factories/seeds are introduced; reuse existing fixture helpers. - [x] Validation commands are minimal and directly prove the changed contract. - [x] Any deviation resolves as `document-in-feature`, `follow-up-spec`, or `reject-or-split`. ## Phase 1: Preparation And Repo Truth **Purpose**: Confirm repo truth and lock the state contract before runtime edits. - [x] T001 Re-read `spec.md`, `plan.md`, and this `tasks.md`. - [x] T002 Confirm working tree intent and record baseline commit (`git status`, `git log -1`). - [x] T003 Re-verify repo truth sources and step semantics: - `apps/platform/app/Filament/Pages/BaselineCompareLanding.php` - `apps/platform/resources/views/filament/pages/baseline-compare-landing.blade.php` - `apps/platform/app/Support/Baselines/BaselineCompareStats.php` - `apps/platform/app/Services/Baselines/BaselineSnapshotTruthResolver.php` - `apps/platform/app/Services/Baselines/BaselineCompareService.php` - `apps/platform/app/Jobs/CompareBaselineToTenantJob.php` - [x] T004 Finalize/update `repo-truth-map.md` and `baseline-compare-state-contract.md` if runtime sources differ from the prepared truth map. - [x] T005 Confirm Spec 332 Product Process Flow rendering conventions and decide the reuse strategy: - reuse existing shared flow render primitive if present - otherwise introduce the narrowest shared primitive only if justified by 2+ consumers (Restore + Baseline Compare) ## Phase 2: State Presenter / Flow Model **Purpose**: Centralize “what is complete/missing/blocked/available” mapping in one place to avoid Blade drift. - [x] T006 Implement a small Baseline Compare presenter/view-model (or expand an existing one) that computes: - decision card (`Status/Reason/Impact/Primary next action`) - readiness flow steps across repo-backed states - available inputs/proof items (repo-backed only) - drift summary and evidence/coverage state (separated from OperationRun proof) - diagnostics disclosure state (collapsed default) - [x] T007 Ensure presenter uses existing truth only (no new persistence, no new enum family, no new compare logic). - [x] T008 Ensure primary next action is exactly one per state and is capability-aware (hide/disable per existing conventions). ## Phase 3: UI Alignment (Baseline Compare Landing) **Purpose**: Render the shared Product Process Flow contract consistently on the page. - [x] T009 Replace the current page-local readiness pipeline (currently limited to `no_assignment`) with the shared Product Process Flow horizontal flow renderer. - [x] T010 Ensure the readiness flow is visible across the full repo-backed state family (`no_assignment`, `no_snapshot`, `invalid_scope`, `idle`, `comparing`, `failed`, `ready`). - [x] T011 Keep diagnostics collapsed by default; ensure raw diff/payload is not default-visible. - [x] T012 Remove any duplicated visible status/summary blocks introduced by state-specific sections. - [x] T013 Keep “Compare now” semantics unchanged: confirmation, capability gate, OperationRun start UX, queued toast + “Open operation” link. ## Phase 4: Drift / Evidence / Copy Hardening **Purpose**: Prevent false “all clear” outcomes and keep evidence claims truthful. - [x] T014 Ensure “no drift” copy is scoped and caveated when coverage/evidence gaps exist (no “healthy/compliant/customer-safe” claim). - [x] T015 Ensure evidence/coverage gap state is visible separately from OperationRun proof. - [x] T016 Ensure state-specific copy aligns to the state contract and does not leak raw reason codes into primary UI. ## Phase 5: Feature Tests (Pest) - [x] T017 Add `apps/platform/tests/Feature/Filament/Spec336BaselineCompareProductProcessFlowAlignmentTest.php` covering: - no baseline assignment (decision card + readiness flow + primary action + diagnostics collapsed) - baseline assigned but snapshot missing/blocked - compare run required (`idle`) with `Compare now` enabled only when authorized - compare in progress (`comparing`) - compare failed (`failed`) - compare ready with findings + compare ready with zero findings (with truthful caveats) - evidence/coverage gap messaging + proof separation - workspace/environment isolation and unauthorized action hiding - [x] T018 Update existing Baseline Compare tests (including Spec 330) only where necessary, keeping equivalent or stronger assertions. ## Phase 6: Browser Smoke + Screenshots - [x] T019 Add `apps/platform/tests/Browser/Spec336BaselineCompareProductProcessFlowAlignmentSmokeTest.php` covering the declared core states and disclosure guarantees. - [x] T020 Capture screenshots into `specs/336-baseline-compare-product-process-flow-alignment/artifacts/screenshots/`: - `01-no-baseline-assigned.png` - `02-baseline-snapshot-required.png` - `03-compare-run-required.png` - `04-compare-result-available.png` - `05-evidence-unavailable.png` - `06-diagnostics-collapsed.png` - `07-dark-mode.png` - [x] T021 If a state is unreachable, document the repo-truth reason in implementation close-out (do not fake screenshots). ## Phase 7: Validation - [x] T022 Run narrow tests first: - `cd apps/platform && ./vendor/bin/sail artisan test tests/Feature/Filament/Spec336BaselineCompareProductProcessFlowAlignmentTest.php --compact` - `cd apps/platform && ./vendor/bin/sail artisan test tests/Browser/Spec336BaselineCompareProductProcessFlowAlignmentSmokeTest.php --compact` - [x] T023 Run overlapping guard filters: - `cd apps/platform && ./vendor/bin/sail artisan test --filter='BaselineCompare|ProductProcessFlow|EnvironmentOwned|Spec332|Spec330' --compact` - [x] T024 Run `cd apps/platform && ./vendor/bin/sail pint --dirty` and `git diff --check`. - [x] T025 Report full-suite status honestly if not run.