TenantAtlas/specs/369-baseline-profile-decision-view/tasks.md
ahmido 54eb8ca065 feat(ui): implement baseline profile decision view (#440)
Added a decision-first section to the Baseline Profile detail page. Includes request caching for summary metrics and corresponding browser/feature tests.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #440
2026-06-10 12:11:55 +00:00

9.6 KiB

Tasks: Spec 369 - Baseline Profile Decision View

Input: specs/369-baseline-profile-decision-view/spec.md, specs/369-baseline-profile-decision-view/plan.md Prerequisites: Do not implement until this preparation package has been reviewed. Related completed specs (116, 159, 336, 368) are context only and must not be rewritten.

Phase 1: Setup And Repo Truth

Purpose: Confirm current implementation truth and protect the existing action safety baseline.

  • T001 Re-read specs/369-baseline-profile-decision-view/spec.md, plan.md, and tasks.md together with .specify/memory/constitution.md, docs/ai-coding-rules.md, docs/architecture-guidelines.md, docs/filament-guidelines.md, and docs/testing-guidelines.md.
  • T002 [P] Inspect current Baseline Profile detail implementation in apps/platform/app/Filament/Resources/BaselineProfileResource.php and apps/platform/app/Filament/Resources/BaselineProfileResource/Pages/ViewBaselineProfile.php.
  • T003 [P] Inspect existing Baseline Profile action and RBAC tests in apps/platform/tests/Feature/Filament/BaselineProfileCaptureStartSurfaceTest.php, apps/platform/tests/Feature/Filament/BaselineProfileCompareStartSurfaceTest.php, and apps/platform/tests/Feature/Baselines/BaselineProfileAuthorizationTest.php.
  • T004 [P] Inspect Spec 368 before-state evidence in specs/368-platform-ui-signal-to-noise-browser-audit/findings.md, audit.md, page-scorecard.csv, and screenshot specs/368-platform-ui-signal-to-noise-browser-audit/artifacts/screenshots/admin/008-decision-surface-view-baseline-profile.png.
  • T005 Confirm BaselineProfileResource::$isGloballySearchable stays disabled and provider registration remains unchanged in apps/platform/bootstrap/providers.php.

Phase 2: User Story 1 - Decide Baseline Readiness Quickly (P1)

Goal: The Baseline Profile detail page answers readiness, reason, impact, snapshot basis, assignment/usefulness, and one next action before technical detail.

Independent Test: Render profiles in ready, blocked/no-snapshot, and invalid-scope states and assert the decision section appears before normalization lineage or metadata.

  • T006 [P] [US1] Add failing Feature/Livewire coverage for a ready profile decision summary in apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php.
  • T007 [P] [US1] Add failing Feature/Livewire coverage for a no-consumable-snapshot profile showing blocked compare reason and capture-oriented next action in apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php.
  • T008 [P] [US1] Add failing Feature/Livewire coverage for invalid or unsupported governed-subject scope showing review/edit guidance without raw scope JSON in apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php.
  • T009 [US1] Recompose BaselineProfileResource::infolist() in apps/platform/app/Filament/Resources/BaselineProfileResource.php so the first section is a decision summary with readiness, reason, impact, snapshot basis, assignment signal, and one next action.
  • T010 [US1] Reuse existing helper truth in apps/platform/app/Filament/Resources/BaselineProfileResource.php for current snapshot, latest attempt, compare readiness, and profile next step before adding any new helper.
  • T011 [US1] If repeated inline closures become hard to review, add one derived page-local helper in apps/platform/app/Filament/Resources/BaselineProfileResource.php for the decision summary; keep it non-persisted and resource-local.
  • T012 [US1] Ensure the decision summary does not render scope_jsonb, subject_type_keys, canonical_scope, raw IDs, or normalization lineage as default primary decision content.

Phase 3: User Story 2 - Preserve High-Impact Action Safety (P1)

Goal: Capture/compare/archive behavior remains confirmed, authorized, audited, and OperationRun-linked while the page hierarchy changes.

Independent Test: Existing capture/compare tests plus new Spec 369 assertions prove actions keep current visibility/disabled/execution semantics.

  • T013 [P] [US2] Extend apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php or existing BaselineProfile action tests to assert readonly users see non-mutating decision copy and cannot execute capture/compare.
  • T014 [P] [US2] Extend action hierarchy assertions in apps/platform/tests/Feature/Filament/BaselineProfileCaptureStartSurfaceTest.php and apps/platform/tests/Feature/Filament/BaselineProfileCompareStartSurfaceTest.php only if header action order or placement changes.
  • T015 [US2] Keep capture, compareNow, and compareAssignedTenants in apps/platform/app/Filament/Resources/BaselineProfileResource/Pages/ViewBaselineProfile.php on existing ->action(...), ->requiresConfirmation(), capability enforcement, notification, and OperationRunLinks paths.
  • T016 [US2] Keep archive behavior in apps/platform/app/Filament/Resources/BaselineProfileResource.php confirmed and authorization-gated; do not make destructive actions more visually prominent.
  • T017 [US2] Verify queued/already-queued capture and compare feedback still uses OperationUxPresenter, OperationRunLinks, and OpsUxBrowserEvents in apps/platform/app/Filament/Resources/BaselineProfileResource/Pages/ViewBaselineProfile.php.

Phase 4: User Story 3 - Keep Technical Proof Accessible But Secondary (P2)

Goal: Technical proof remains reachable after the primary decision, without competing in the first viewport.

Independent Test: Render the page and assert related context, normalization lineage, and metadata remain accessible but are not first-decision content.

  • T018 [P] [US3] Add assertions in apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php that related context links still include current snapshot and compare matrix when available.
  • T019 [P] [US3] Add assertions in apps/platform/tests/Feature/Filament/Spec369BaselineProfileDecisionViewTest.php that normalization lineage and metadata remain visible in secondary placement.
  • T020 [US3] Adjust section ordering or disclosure treatment in apps/platform/app/Filament/Resources/BaselineProfileResource.php so Profile/Scope/Metadata no longer precede the decision summary.
  • T021 [US3] Keep BaselineProfileResource::detailRelatedContextEntries() links capability-safe and pointed at existing snapshot / compare matrix routes.

Phase 5: UI Audit, Browser Smoke, And Validation

Purpose: Prove the productization change and close the active UI guardrail loop.

  • T022 [P] Add bounded browser smoke in apps/platform/tests/Browser/Spec369BaselineProfileDecisionViewSmokeTest.php that visits a Baseline Profile detail with a snapshot and assignment, asserts no JavaScript errors, and verifies the decision summary appears before technical metadata.
  • T023 [P] Save after screenshot evidence under specs/369-baseline-profile-decision-view/artifacts/screenshots/ during browser smoke or manual verification.
  • T024 Update docs/ui-ux-enterprise-audit/page-reports/ui-010-baseline-profiles.md with the Baseline Profile detail decision-view change and the Spec 369 screenshot/reference.
  • T025 Update docs/ui-ux-enterprise-audit/design-coverage-matrix.md or record an explicit no-count-change rationale in specs/369-baseline-profile-decision-view/plan.md if route/design coverage counts do not change.
  • T026 Confirm the implementation does not add Graph/provider client calls to the Baseline Profile detail render path.
  • T027 Run cd apps/platform && ./vendor/bin/sail artisan test --compact --filter=Spec369.
  • T028 Run cd apps/platform && ./vendor/bin/sail artisan test --compact --filter=BaselineProfile.
  • T029 Run cd apps/platform && ./vendor/bin/sail php vendor/bin/pest tests/Browser/Spec369BaselineProfileDecisionViewSmokeTest.php --compact if the browser smoke test is added.
  • T030 Run cd apps/platform && ./vendor/bin/sail pint --dirty.
  • T031 Run git diff --check.
  • T032 Record the final Livewire v4 compliance, provider registration impact, global-search posture, destructive/high-impact action confirmation/authorization/audit status, asset strategy, tests, deployment impact, and Guardrail / Smoke Coverage result in the implementation close-out response.

Dependencies

  • Phase 1 before all implementation tasks.
  • US1 before US3 section-order finalization.
  • US2 can run in parallel with US1 after action baseline is understood.
  • Phase 5 after runtime changes.

Parallel Execution Examples

  • T002, T003, and T004 can run in parallel.
  • T006, T007, and T008 can be authored in parallel in the same test file only if coordinated carefully; otherwise sequence them to avoid conflicts.
  • T013 and T018/T019 can be authored after the primary test fixture shape exists.

Test Governance Checklist

  • Lane assignment is named and is the narrowest sufficient proof for the changed behavior.
  • New or changed tests stay in the smallest honest family, and browser coverage is explicit.
  • Shared helpers, factories, seeds, fixtures, and context defaults stay cheap by default.
  • Planned validation commands cover the change without pulling in unrelated lane cost.
  • The declared surface test profile (shared-detail-family / strategic surface) is explicit.
  • Any material budget, baseline, trend, or escalation note is recorded in the active spec or PR.

Explicit Non-Goals

  • No migrations, models, services, jobs, policies, routes, Graph contracts, provider adapters, global UI framework, customer portal, backup/restore productization, or OperationRun lifecycle changes unless the spec is updated first.