TenantAtlas/specs/403-evidence-anchor-currentness-runtime-closure/tasks.md
Ahmed Darrazi c737fd65a0
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m5s
feat: add evidence anchor runtime closure contract proofs
2026-06-23 17:11:38 +02:00

22 KiB

Tasks: Spec 403 - Evidence Anchor & Currentness Runtime Closure

Input: specs/403-evidence-anchor-currentness-runtime-closure/spec.md, plan.md, checklists/requirements.md, user-provided Spec 403 draft, Spec 400 context, Spec 402 implementation report, Product Surface Contract, and repo truth.

Tests: Required. This spec changes or verifies runtime evidence/currentness behavior and rendered product claims, so it must include focused Pest Unit/Feature/Filament tests plus focused browser proof for representative rendered paths.

Completion note: Tasks covering untouched downstream surfaces are closed by repo-truth inventory, the Evidence/Currentness Coverage Matrix, existing focused proof, and explicit P2 deferrals in implementation-report.md. Direct runtime edits were limited to Evidence Overview proof-state/currentness presentation, current-anchor missing/stale/empty-dimension guards, OperationRun default-link demotion, Customer Review Workspace canonical status and status-like decision-title presentation, canonical Evidence Inventory outcome mapping, and Evidence Snapshot artifact-truth classification for missing dimensions. Non-status action headings such as Draft review exists remain outside the canonical status-vocabulary claim.

Test Governance Checklist

  • Lane assignment is named and is the narrowest sufficient proof for changed evidence/currentness behavior.
  • New or changed tests stay in focused Unit, Feature/Filament, and Browser families; heavy-governance additions are explicit if any.
  • Shared helpers, factories, seeds, fixtures, and context defaults stay cheap by default; any widening is isolated or documented.
  • Planned validation commands cover evidence/currentness closure without pulling unrelated full-suite cost.
  • The declared surface test profile or standard-native-filament relief is explicit.
  • Browser proof covers representative rendered evidence/currentness behavior and does not claim full browser audit.
  • Human Product Sanity and Product Surface implementation-report close-out are completed.
  • Any material budget, baseline, trend, or escalation note is recorded in the implementation report.

Phase 1: Preparation And Dirty-State Baseline

Purpose: Establish safe starting conditions and read all governing context before runtime edits.

  • T001 Read specs/403-evidence-anchor-currentness-runtime-closure/spec.md, plan.md, tasks.md, and checklists/requirements.md.
  • T002 Record current branch, HEAD, dirty state, tracked changed files, untracked files, and git diff --check in specs/403-evidence-anchor-currentness-runtime-closure/implementation-report.md.
  • T003 Re-read AGENTS.md, .specify/memory/constitution.md, .specify/README.md, docs/ai-coding-rules.md, docs/security-guidelines.md, docs/testing-guidelines.md, docs/architecture-guidelines.md, docs/filament-guidelines.md, and docs/product/standards/product-surface-contract.md.
  • T004 Re-read specs/388-resolution-proof-currentness-contract-v1/, specs/393-evidence-anchor-reconciliation-v1/, specs/400-product-contract-spec-completeness-audit/, specs/401-high-risk-admin-action-proof-pack/implementation-report.md, and specs/402-resource-policy-authorization-proof-matrix/implementation-report.md as read-only context; preserve completed-spec history.
  • T005 Confirm Spec 402 has no unresolved P0/P1 authorization blocker before making Spec 403 runtime changes; record any residual authorization proof debt that affects evidence links.
  • T006 Confirm no new product vocabulary, routes, navigation, customer output category, report/PDF runtime, evidence provider, migration, package, env var, queue/scheduler/storage change, asset registration, or broad browser audit will be included.

Phase 2: Repo Truth Inventory

Purpose: Build the matrix from current code and tests before fixing labels or helpers.

  • T007 Inventory evidence anchor/currentness helpers in apps/platform/app/Services/Evidence/EvidenceAnchorResolver.php, EvidenceAnchorResult.php, EvidenceSnapshotResolver.php, EvidenceSnapshotService.php, apps/platform/app/Support/Evidence/EvidenceSnapshotStatus.php, and EvidenceCompletenessState.php.
  • T008 Inventory Evidence Overview behavior in apps/platform/app/Filament/Pages/Monitoring/EvidenceOverview.php, including current evidence link resolution, workspace-wide behavior, explicit environment filter behavior, empty states, and row URLs.
  • T009 Inventory Evidence Snapshot resource behavior in apps/platform/app/Filament/Resources/EvidenceSnapshotResource.php and nested pages, including stale/partial/failed/missing/expired display and authorization.
  • T010 Inventory Customer Review Workspace behavior in apps/platform/app/Filament/Pages/Reviews/CustomerReviewWorkspace.php, especially customer-safe evidence summaries, package/download state, internal proof suppression, and environment filters.
  • T011 Inventory Environment Review and Review Publication Resolution behavior in apps/platform/app/Filament/Resources/EnvironmentReviewResource.php, nested pages, and resolve-review-publication.blade.php, including Spec 388 proof-currentness fields.
  • T012 Inventory Review Pack and Stored Report behavior in apps/platform/app/Filament/Resources/ReviewPackResource.php and StoredReportResource.php, including generated/released evidence basis, report receipt/output links, and OperationRun proof links.
  • T013 Inventory OperationRun proof links and access checks in OperationRunLinks, OperationRunPolicy, Monitoring/Operations pages, and any proof links emitted by review/report/restore/baseline/finding surfaces.
  • T014 Inventory restore readiness/proof behavior in apps/platform/app/Filament/Resources/RestoreRunResource.php, restore presenters, and restore proof Blade views.
  • T015 Inventory baseline compare/evidence behavior in BaselineCompareMatrix, baseline resources, baseline evidence providers, and related tests.
  • T016 Inventory finding/governance evidence references in finding resources, finding exception evidence references, governance inbox/register surfaces, and related tests.
  • T017 Inventory existing tests under apps/platform/tests/ for evidence overview/resource, Spec 388, Spec 393, customer review workspace, review packs, stored reports, OperationRun access, restore readiness, baseline evidence, finding evidence, and browser proof.
  • T018 Inventory repo-real provider freshness or permission-limited state contracts that already affect evidence quality/currentness, and record whether each contract is provider-owned diagnostic detail or platform-core evidence semantics.

Phase 3: Evidence/Currentness Coverage Matrix

Purpose: Create the proof matrix before runtime fixes.

  • T019 Create specs/403-evidence-anchor-currentness-runtime-closure/implementation-report.md with sections A through M from spec.md.
  • T020 Add the Evidence/Currentness Coverage Matrix with columns: Surface, Evidence Source, Currentness Source, Released Snapshot Source, Customer-safe Boundary, Internal-only Data Risk, Workspace/Environment Scope, Authorization Mechanism, Test Proof, Browser Proof, Status, Risk, Follow-up.
  • T021 Classify Evidence Overview rows and links for current, stale, missing, failed, partial, expired, superseded, wrong-workspace, wrong-environment, unauthorized, and workspace-wide no-environment states.
  • T022 Classify Evidence Snapshot detail/list surfaces for stale, failed, partial, missing, expired, source/detail disclosure, and technical proof demotion.
  • T023 Classify Review Pack, Environment Review, Customer Review Workspace, and Stored Report surfaces for current runtime evidence versus released/generated evidence.
  • T024 Classify customer-safe boundaries for review workspace, review pack output, report output, and any customer-facing labels or downloads.
  • T025 Classify OperationRun proof links for authorization, workspace/environment scope, failed/running/cancelled/blocked/succeeded distinction, and customer-safe visibility.
  • T026 Classify findings/governance references for current, released/historical, missing, failed, blocked, or needs-attention evidence.
  • T027 Classify baseline compare and restore readiness/proof surfaces for stale/missing/failed/partial/expired currentness claims.
  • T028 Mark each matrix row as PASS, PASS WITH EXCEPTION, MISSING PROOF, DEFECT FOUND, PRODUCT DECISION REQUIRED, or DEFERRED, with P0/P1/P2/P3/None risk.
  • T029 Add matrix rows for any provider freshness or permission-limited evidence-currentness contracts discovered in T018, including source, customer-safe boundary, authorization mechanism, and test proof or deferral.

Phase 4: Gap Classification

Purpose: Decide whether each matrix issue needs a test, a runtime fix, a product decision, or a deferral.

  • T030 Classify P0 defects where customer-safe output leaks internal proof, false currentness is shown, released output claims live/current state, or unauthorized evidence/OperationRun proof is accessible.
  • T031 Classify P1 missing proof where behavior may be safe but lacks direct tests for critical current/released/customer-safe/OperationRun/scoping paths.
  • T032 Classify P2/P3 productization or cleanup debt separately from safety blockers.
  • T033 Classify missing product decisions using the categories from the spec draft: blocks customer-output claim, blocks currentness claim, blocks internal proof claim, blocks review-pack/release claim, or can defer.
  • T034 Confirm no matrix gap is solved by inventing a new product vocabulary, new status family, new route, or new evidence taxonomy.
  • T035 Stop and update spec/plan before implementing if a fix requires new persistence, migrations, a broad proof framework, new evidence provider, report/PDF runtime, provider integration, or lifecycle semantics.

Phase 5: Tests First - Current Evidence And Anchors

Purpose: Prove current evidence behavior before changing runtime code.

  • T036 Add or update focused tests for EvidenceAnchorResolver proving current evidence is selected only when active, complete, with usable captured dimensions, without missing/stale dimensions, non-expired, scoped to workspace/environment, and authorized.
  • T037 Add or update tests proving stale, expired, failed, partial, queued, generating, superseded, wrong-workspace, wrong-environment, and missing evidence cannot produce a current evidence link.
  • T038 Add or update Feature/Filament tests for EvidenceOverview proving workspace-wide views do not choose arbitrary current evidence and environment-filtered views link only authorized scoped current evidence.
  • T039 Add or update Evidence Snapshot resource tests proving stale/partial/failed/missing/expired evidence labels do not imply current/complete/verified proof.
  • T040 Add or update cross-workspace and cross-environment denial tests for evidence anchor direct URLs and proof links.

Phase 6: Tests First - Released And Customer-Safe Proof

Purpose: Prove released/customer-safe behavior before runtime changes.

  • T041 Add or update tests proving released review-pack evidence stays bound to the released review/pack and does not query arbitrary latest current evidence.
  • T042 Add or update tests proving report receipts/output identify generated/released evidence and do not claim live/current runtime state unless an existing contract explicitly says so.
  • T043 Add or update Customer Review Workspace tests proving customer-safe output hides EvidenceSnapshot routes, evidence IDs, source keys, detectors, fingerprints, raw provider payloads, OperationRun URLs, internal reason families, and raw diagnostics by default.
  • T044 Add or update tests proving missing, failed, stale, expired, or partial released evidence is represented as Not configured, Needs attention, Failed, Blocked, or Expired rather than customer-safe ready.
  • T045 Add or update tests proving newer runtime evidence does not silently rewrite released review/report proof and does not invalidate released evidence without clear existing-contract labeling.

Phase 7: Tests First - OperationRun, Restore, Baseline, Finding, And Report Proof

Purpose: Prove proof-link and downstream readiness claims are scoped and truthful.

  • T046 Add or update OperationRun proof tests proving failed, cancelled, blocked, running, stale, wrong-workspace, and wrong-environment runs cannot render as successful current proof.
  • T047 Add or update tests proving OperationRun proof links are demoted from the Evidence Overview default proof path and remain hidden or denied when OperationRunPolicy or environment entitlement does not allow access.
  • T048 Add or update restore readiness/proof tests proving stale/missing/failed/partial/expired preview/check/proof state is not presented as current executable readiness.
  • T049 Add or update baseline compare/evidence tests proving stale/missing/failed/partial baseline proof is not presented as current compare proof.
  • T050 Add or update finding/governance reference tests proving evidence references distinguish current, released/historical, missing, failed, blocked, or needs-attention proof where applicable.
  • T051 Add or update stored report/report output tests proving failed/missing/incomplete reports do not support customer-safe ready proof.
  • T052 Add or update tests proving provider freshness or permission-limited state affects evidence/currentness claims only where an existing repo contract connects that provider state to evidence quality, and is otherwise classified as product-decision or follow-up debt.

Phase 8: Minimal Runtime Closure

Purpose: Fix only confirmed defects using existing architecture.

  • T053 Update existing evidence/currentness helpers or call sites only where tests prove a false, unsafe, or unscoped claim.
  • T054 Correct misleading labels that show stale, failed, partial, missing, expired, or released proof as current, complete, ready, verified, or live.
  • T055 Remove or replace arbitrary-latest evidence fallback selectors from product-facing current-evidence surfaces.
  • T056 Ensure customer-safe surfaces consume customer-safe summaries and never emit raw evidence/OperationRun technical links by default.
  • T057 Ensure released review/report surfaces use release-bound/generated evidence basis and label it separately from current runtime evidence.
  • T058 Ensure OperationRun proof is treated as execution/history proof, with default Evidence Overview links demoted and remaining technical OperationRun routes still using existing scoped URL helpers and policies.
  • T059 Ensure restore/baseline/finding/report proof labels consume existing readiness/evidence truth rather than inferring success from stale or partial data.
  • T060 Keep all Graph/provider calls out of render-time code paths.
  • T061 Do not add compatibility aliases, old labels, fallback readers, duplicate UI, or legacy fixtures that preserve wrong evidence/currentness behavior.

Phase 9: Product Surface And Human Sanity

Purpose: Keep rendered behavior calm, customer-safe, and contract-compliant.

  • T062 Review and update docs/ui-ux-enterprise-audit/route-inventory.md and docs/ui-ux-enterprise-audit/design-coverage-matrix.md for touched existing surfaces if runtime UI files or reachable evidence/status semantics change; otherwise record that existing registry entries were reviewed and remain current.
  • T063 Confirm Product Surface Contract fields in implementation-report.md: no-legacy, UI impact, page archetype, surface budgets, Technical Annex demotion, canonical status vocabulary for proof/readiness and Evidence Inventory outcomes, Product Surface exceptions, visible complexity outcome, browser proof, Human Product Sanity, and UI coverage registry result.
  • T064 Confirm no Product Surface exception is required; if one is required, document page, violated rule/budget, reason, and follow-up.
  • T065 Run Human Product Sanity on touched customer-safe/readiness/evidence surfaces and record result.
  • T066 Confirm visible complexity is neutral or decreased; document any approved increase.
  • T067 Confirm no completed historical spec was rewritten, normalized, unchecked, or stripped of close-out/validation/browser history.

Phase 10: Focused Browser Proof

Purpose: Verify representative rendered evidence/currentness behavior without claiming a full browser audit.

  • T068 Add or update focused browser smoke apps/platform/tests/Browser/Spec403EvidenceCurrentnessRuntimeClosureSmokeTest.php if browser support is available.
  • T069 Browser-proof admin Evidence Overview or Evidence Snapshot current/stale/missing/failed/partial behavior.
  • T070 Browser-proof Customer Review Workspace or review/report output customer-safe released proof behavior.
  • T071 Browser-proof released review/report evidence is not claimed as live current runtime state.
  • T072 Browser-proof stale/missing/failed evidence state path.
  • T073 Browser-proof unauthorized or cross-workspace/cross-environment evidence-anchor denial.
  • T074 Browser-proof OperationRun proof state and default-link demotion.
  • T075 Record route/surface, actor, workspace/environment, evidence state, expected result, observed result, console/runtime errors, and screenshot path if screenshots are captured.
  • T076 If browser tests are unavailable, record the exact blocker and do not claim browser proof.

Phase 11: Implementation Report And Validation

Purpose: Close the proof loop with explicit result, residual severity, and next-step recommendation.

  • T077 Complete implementation report section A with Candidate Gate Result: PASS, PASS WITH CONDITIONS, or FAIL.
  • T078 Complete section B with included and explicitly not included scope.
  • T079 Complete section C with dirty state before/after, tracked files changed, and untracked files.
  • T080 Complete section D with the Evidence/Currentness Coverage Matrix.
  • T081 Complete section E with runtime changes made, why needed, and scope risk.
  • T082 Complete section F with tests added/updated, positive/negative classification, and result.
  • T083 Complete section G with focused browser proof or exact no-browser limitation.
  • T084 Complete section H with current vs released proof summary.
  • T085 Complete section I with customer-safe boundary proof summary.
  • T086 Complete section J with remaining findings by P0/P1/P2/P3.
  • T087 Complete section K with deferred items: management PDF staging validation, governance lifecycle/retention, JSONB migration, full browser audit, provider readiness productization, and other items.
  • T088 Complete the Filament v5 output contract close-out in implementation-report.md: Livewire v4 compliance, panel provider registration location, global-search posture for each touched resource, destructive/high-impact action confirmation and authorization posture, asset strategy, tests/browser result, and deployment impact.
  • T089 Complete section L with validation commands and exact results.
  • T090 Complete section M with recommended next action: Spec 404 only if Spec 403 passes or conditions are resolved.
  • T091 Run targeted Spec 403 tests and record result.
  • T092 Run targeted existing regressions for Evidence, Customer Review Workspace, Environment Review, Review Pack, Stored Report, OperationRun access, Restore, Baseline, and Finding surfaces changed by implementation.
  • T093 Run focused browser validation command if available and record result.
  • T094 Run formatter for changed PHP files and record result.
  • T095 Run git diff --check and record result.
  • T096 Verify changed reports, tests, logs, fixtures, screenshots, and implementation notes do not include secrets, tokens, raw credential payloads, or sensitive raw provider payloads.
  • T097 Run final dirty-state commands and confirm no unrelated dirty files were reset, deleted, or cleaned.

Non-Goals Checklist

  • NT001 Do not add new product vocabulary, status family, evidence taxonomy, proof taxonomy, or currentness framework.
  • NT002 Do not add new admin, system, customer, navigation, report, PDF, evidence provider, restore, baseline, finding, or lifecycle surfaces.
  • NT003 Do not add migrations, JSON-to-JSONB changes, new persisted truth, packages, env vars, queues, scheduler changes, storage changes, or assets.
  • NT004 Do not perform broad service/model/Filament refactors.
  • NT005 Do not rewrite completed specs or remove historical close-out, validation, smoke, browser, or task history.
  • NT006 Do not claim full browser/UX/runtime audit completion.
  • NT007 Do not claim browser proof unless browser proof was actually run.
  • NT008 Do not proceed to Spec 404 recommendation if P0 remains or unresolved P1 evidence/currentness blockers are unsafe.

Dependencies And Execution Order

  • Phase 1 must complete before runtime edits.
  • Phase 2 inventory must complete before Phase 3 matrix decisions.
  • T018 must complete before T029 and before runtime fixes that rely on provider freshness or permission-limited evidence state.
  • Phase 3 matrix must exist before Phase 4 gap classification.
  • T029 must complete before provider-related P0/P1 gap classification is closed.
  • Phase 4 must classify gaps before tests or runtime fixes.
  • Phases 5-7 tests should precede Phase 8 fixes wherever feasible.
  • T052 must precede any provider-freshness runtime correction.
  • Phase 8 fixes must stay bounded to confirmed evidence/currentness gaps.
  • T062 must complete before Product Surface close-out when runtime UI files or reachable evidence/status semantics change.
  • Phase 10 browser proof follows focused hardening and tests.
  • Phase 11 closes with report, validation, Filament v5 output contract close-out, dirty state, and next-step recommendation.

Treat implementation as a runtime truth-closure loop, not a framework pass. Build the matrix, add failing proof tests for confirmed P0/P1 risks, fix only the smallest currentness/evidence defects, and record exact proof. Preserve current repo helpers unless they demonstrably cannot express the required behavior.