Implemented the output contract and readiness semantics for review packs. Also added spec 348. Includes changes to ChooseEnvironment, CustomerReviewWorkspace, GenerateReviewPackJob and related blade views. Added comprehensive tests. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #419
18 KiB
18 KiB
Implementation Plan: Spec 347 - Review Pack Output Contract & Readiness Semantics
Branch: 347-review-pack-output-contract-readiness-semantics | Date: 2026-06-02 | Spec: specs/347-review-pack-output-contract-readiness-semantics/spec.md
Input: User-provided Spec 347 draft + repo truth from current review-derived Review Pack generation and Customer Review Workspace readiness behavior.
Summary
Harden the current review-derived Review Pack output without rewriting the export pipeline.
This slice should:
- document the current file contract
- reconcile review/evidence/section/export/customer-safe semantics
- tighten ZIP payload consistency where fields are missing or ambiguous
- add explicit limitations/disclosure output
- replace unqualified workspace sharing language when repo truth says the package is limited
This slice must not:
- rebuild Review Pack generation
- add persistence
- add a portal
- change signed-download safety
- create a new workflow engine
Technical Context
- Language/Version: PHP 8.4.15, Laravel 12.52.x
- Primary Dependencies: Filament 5.2.x, Livewire 4.1.x, Pest 4, Tailwind CSS 4
- Storage: PostgreSQL; no schema change expected
- Testing: Pest Feature/Livewire tests plus one bounded Pest Browser smoke file
- Validation Lanes: confidence + browser
- Target Platform:
apps/platformLaravel monolith; Sail-first locally; Dokploy posture unchanged - Project Type: web application with generated ZIP artifacts
- Performance Goals: no new remote calls during render, no new queue family, deterministic ZIP contract and deterministic derived readiness mapping
- Constraints: no false customer-safe/export-ready/certification claims; no weakened signed-download controls; no revived legacy file layout or query aliases; keep diagnostics secondary
- Scale/Scope: one existing ZIP contract, one existing strategic workspace page, targeted Feature coverage, one Browser smoke, and spec-local contract docs
UI / Surface Guardrail Plan
- Guardrail scope: material change to an existing strategic customer-safe review surface plus existing output artifact semantics
- Affected routes/pages/actions/states/navigation/panel/provider surfaces:
/admin/reviews/workspaceapps/platform/app/Filament/Pages/Reviews/CustomerReviewWorkspace.phpapps/platform/resources/views/filament/pages/reviews/customer-review-workspace.blade.php- review-derived ZIP output generated by
apps/platform/app/Jobs/GenerateReviewPackJob.php - workspace download wording and signed download affordance only; Review Pack Resource detail/header copy stays out of scope unless repo truth reveals a direct contradiction that cannot be fixed on the workspace surface
- No-impact class, if applicable: N/A
- Native vs custom classification summary: native Filament page plus existing Blade composition; existing export ZIP contract; no new route or panel/provider
- Shared-family relevance: evidence/review/export readiness labels, disclosure language, download affordances, proof links
- State layers in scope: page payload, artifact payload, signed-download label/copy on the workspace surface only
- Audience modes in scope: operator-MSP, customer-safe review consumer, support where authorized
- Decision/diagnostic/raw hierarchy plan: readiness and limitations first, proof second, diagnostics third
- Raw/support gating plan: diagnostics collapsed/secondary; raw/support details remain hidden on customer-safe default paths
- One-primary-action / duplicate-truth control: one dominant next action on the workspace decision card; lower sections add proof rather than restating the verdict
- Handling modes by drift class or surface: review-mandatory
- Repository-signal treatment: review-mandatory because this is a strategic output boundary and trust surface
- Special surface test profiles:
global-context-shell+ customer-safe strategic review surface + artifact contract - Required tests or manual smoke: functional-core + browser smoke
- Exception path and spread control: one bounded readiness mapper is allowed; no generic review-output framework
- Active feature PR close-out entry: Guardrail / Smoke Coverage
- UI/Productization coverage decision: update
docs/ui-ux-enterprise-audit/page-reports/ui-006-customer-review-workspace.md; do not create a new page-report identity unless implementation proves necessary - Coverage artifacts to update: existing workspace page report only, unless route/archetype truth changes
- Navigation / Filament provider-panel handling: N/A; no panel/provider change expected
- Screenshot or page-report need: yes, one page-report update plus bounded screenshots because this is a strategic customer-safe surface
Shared Pattern & System Fit
- Cross-cutting feature marker: yes
- Systems touched:
EnvironmentReviewComposerGenerateReviewPackJobReviewPackServiceCustomerReviewWorkspace- existing Review Pack download and artifact proof surfaces
- Shared abstractions reused:
- current
delivery_bundlemetadata and summary payloads - current
governance_packagereview summary - current
ArtifactTruthPresenter - current download/audit flow
- current
- New abstraction introduced? why?: maybe one narrow readiness mapper or presenter if current page-local heuristics and ZIP payload logic need a single source for derived output-readiness labels
- Why the existing abstraction was sufficient or insufficient: existing structures already carry most facts, but they do not yet define one coherent output-readiness vocabulary or one authoritative contract between ZIP and workspace UI
- Bounded deviation / spread control: keep any new mapper local to review-pack output semantics; do not create a broad governance-output layer
OperationRun UX Impact
- Touches OperationRun start/completion/link UX?: existing proof linkage and audit/download context only
- Central contract reused: existing operation proof links and current generation lifecycle
- Delegated UX behaviors: unchanged
- Surface-owned behavior kept local: limitations copy and qualified next-action selection
- Queued DB-notification policy: unchanged
- Terminal notification path: unchanged
- Exception path: none
Provider Boundary & Portability Fit
- Shared provider/platform boundary touched?: no new provider seam
- Provider-owned seams: N/A
- Platform-core seams: review output contract, customer-safe sharing boundary, export readiness semantics
- Neutral platform terms / contracts preserved: review pack, evidence basis, limitations, customer-safe, internal package, output contract
- Retained provider-specific semantics and why: only in existing stored report or review content where already repo-backed
- Bounded extraction or follow-up path: none
Current Repo Truth Summary
EnvironmentReviewComposeralready derives:summary.evidence_basissummary.section_state_countssummary.publish_blockerssummary.has_ready_export(initiallyfalse)summary.governance_package
GenerateReviewPackJobalready writes review-derived ZIP files:metadata.jsonsummary.jsonsections.jsonexecutive-summary.md- one file per section under
sections/
GenerateReviewPackJobalready updates:ReviewPack.summary.review_statusReviewPack.summary.review_completeness_stateReviewPack.summary.delivery_bundleReviewPack.summary.evidence_resolutionEnvironmentReview.summary.has_ready_export = trueafter successful generation
CustomerReviewWorkspacecurrently derives share-readiness from:- accepted-risk follow-up
- open findings
- package availability
- evidence availability
- mapped review data
- not from a dedicated output-readiness contract
- Current gaps:
- section-detail files do not currently repeat
section_key,required, orsort_order - executive summary does not have a dedicated limitations block
- workspace UI does not surface
include_piior redaction state - workspace UI does not consume
has_ready_exportas a first-class output-readiness input - current ready/share labels are stronger than the current explicit bundle contract
- existing executive-pack and localization regressions were not yet listed in the original Spec 347 validation matrix even though this slice is expected to change those surfaces
- section-detail files do not currently repeat
Implementation Approach
Phase 0 - Repo Truth Gate
- Re-read this spec, plan, tasks, repo-truth map, and contract docs before runtime changes.
- Re-check current generator and workspace files before editing:
apps/platform/app/Jobs/GenerateReviewPackJob.phpapps/platform/app/Services/EnvironmentReviews/EnvironmentReviewComposer.phpapps/platform/app/Services/ReviewPackService.phpapps/platform/app/Filament/Pages/Reviews/CustomerReviewWorkspace.phpapps/platform/resources/views/filament/pages/reviews/customer-review-workspace.blade.phpapps/platform/app/Http/Controllers/ReviewPackDownloadController.php
- Keep
specs/347-review-pack-output-contract-readiness-semantics/repo-truth-map.mdcurrent if runtime edits reveal additional truth or limitations. - Preserve repo-truth deviations from the user draft explicitly:
- section-detail files live under
sections/ - current page report identity is
ui-006-customer-review-workspace.md
- section-detail files live under
Phase 1 - Contract Docs First
- Finalize spec-local contract docs before runtime edits:
contracts/review-pack-output-contract.mdcontracts/readiness-semantics.mdcontracts/customer-safe-output-boundary.md
- Make the contracts explicit about:
- file layout
- required fields
- meaning of
missing - evidence vs export vs customer-safe vs internal-only states
- PII/redaction visibility
- Treat those docs as the runtime review checklist, not as parallel product logic.
Phase 2 - Tests First
- Add focused contract tests:
apps/platform/tests/Feature/ReviewPack/Spec347ReviewPackOutputContractTest.phpapps/platform/tests/Feature/ReviewPack/Spec347ReviewPackReadinessSemanticsTest.phpapps/platform/tests/Feature/Filament/Spec347CustomerReviewWorkspaceOutputReadinessTest.phpapps/platform/tests/Browser/Spec347ReviewPackOutputReadinessSmokeTest.php
- Reuse existing helpers and extend current review-pack/customer-review tests only where proportional.
- Re-run existing regressions that already pin the executive entrypoint, workspace wording, browser readiness path, and localization:
apps/platform/tests/Feature/EnvironmentReview/EnvironmentReviewExecutivePackTest.phpapps/platform/tests/Feature/Localization/CustomerReviewSurfaceLocalizationTest.phpapps/platform/tests/Feature/Filament/Spec342CustomerReviewWorkspaceConsumptionTest.phpapps/platform/tests/Browser/Spec342CustomerReviewWorkspaceConsumptionSmokeTest.php
- Lock the following before runtime refactor:
- required root files
- required metadata/summary fields
- section/file consistency
- limitations/disclosure
- no false share-ready labels
- PII visibility
- preserved signed-download safety
Phase 3 - Derived Output-Readiness Mapper
- Choose the narrowest home for derived output readiness:
- page-local helper if truly local
- small support-layer mapper only if both ZIP contract and workspace rendering must share it
- Derive, do not persist:
- readiness label
- primary reason
- primary action
- evidence basis state
- section completeness summary
- customer-safe/internal-only/limitations state
- PII/redaction visibility
- Prefer reuse of current review summary and pack summary fields over new fields.
- Only add new payload keys where current structures genuinely cannot express the needed contract.
Phase 4 - ZIP Contract Hardening
- Keep the current required root files and current
sections/detail-file placement unless runtime proof forces a narrower change. - Tighten
metadata.jsonso required bundle/review/evidence/options/redaction fields are always present. - Tighten
summary.jsonso readiness-related fields are explicit and stable. - Decide the canonical section contract:
- either add
section_key,required, andsort_orderto each section-detail file - or keep
sections.jsonas the canonical section index and document the detail files as thinner subordinate payloads
- either add
- Preserve the existing delivery contract constant unless a repo-justified contract-version bump is necessary.
Phase 5 - Executive Summary Hardening
- Add an explicit
## Limitationsblock whenever output readiness is limited by:- evidence completeness
- required section completeness
- export readiness
- PII/internal-only boundary
- Keep the existing non-certification disclosure visible.
- Avoid raw/internal-only detail in the markdown entrypoint.
- Ensure the executive summary explains that a section file may exist even when the section is marked
missing.
Phase 6 - Customer Review Workspace Remap
- Replace unqualified share-ready language with contract-backed labels when the output contract is incomplete.
- Surface:
- evidence basis state
- section completeness summary
- PII/redaction visibility
- qualified customer-safe/internal-only/limitations state
- Keep one dominant next action:
- review limitations
- open review
- qualified download
- Keep diagnostics collapsed and secondary.
- Do not redesign the page beyond bounded readiness/disclosure hardening.
Phase 7 - Copy, Audit, And Browser Proof
- Update
apps/platform/lang/en/localization.phpandapps/platform/lang/de/localization.phponly for the new qualified readiness vocabulary needed by repo truth. - Update
docs/ui-ux-enterprise-audit/page-reports/ui-006-customer-review-workspace.mdwith:- output contract summary
- readiness label mapping
- limitations and PII visibility expectations
- deferred follow-ups Review Pack Resource detail/header coverage is not part of this slice unless a minimal contradiction fix becomes unavoidable.
- Capture screenshots under
specs/347-review-pack-output-contract-readiness-semantics/artifacts/screenshots/. - Use one bounded browser smoke proving:
- limitations-bearing package
- qualified download label
- no unqualified share-ready claim
- PII warning where repo-backed
Phase 8 - Validation And Close-Out
- Run the narrowest focused Feature and Browser commands.
- Re-run overlapping regressions for
ReviewPackandCustomerReviewWorkspace. - Run
pint --dirtyandgit diff --check. - Record unrelated failures honestly if broader regressions are not green.
- Do not widen scope into portal, lifecycle-governance, or localization-wide cleanup.
Deployment / Ops Impact
- Env vars: none expected
- Migrations: none expected
- Queues/scheduler: no new queue family or scheduler change expected
- Storage/volumes: existing exports disk only; no storage topology change expected
- Filament assets: none expected; if any registered Filament assets unexpectedly appear, deployment must include
cd apps/platform && php artisan filament:assets
Filament / Laravel Guardrails
- Livewire v4 compliance: required; no Livewire v3 APIs
- Panel provider registration: remains
apps/platform/bootstrap/providers.php - Global search: no resource global-search change is expected
- Destructive/high-impact actions: no new destructive action is planned. Existing regenerate/expire actions remain governed by current confirmation, authorization, and audit rules if touched at all.
- Asset strategy: no new panel asset strategy expected
Test Governance Check
- Test purpose / classification by changed surface: Feature for ZIP contract and workspace state mapping; Browser for first-screen readiness wording and qualified download proof
- Affected validation lanes: confidence + browser
- Why this lane mix is the narrowest sufficient proof: file contracts and workspace rendering are deterministic and can be proven with focused tests; one browser path covers the strategic customer-safe trust surface
- Narrowest proving command(s):
cd apps/platform
./vendor/bin/sail artisan test tests/Feature/ReviewPack/Spec347ReviewPackOutputContractTest.php tests/Feature/ReviewPack/Spec347ReviewPackReadinessSemanticsTest.php tests/Feature/Filament/Spec347CustomerReviewWorkspaceOutputReadinessTest.php --compact
./vendor/bin/sail artisan test tests/Feature/EnvironmentReview/EnvironmentReviewExecutivePackTest.php tests/Feature/Localization/CustomerReviewSurfaceLocalizationTest.php tests/Feature/Filament/Spec342CustomerReviewWorkspaceConsumptionTest.php --compact
./vendor/bin/sail php vendor/bin/pest tests/Browser/Spec347ReviewPackOutputReadinessSmokeTest.php tests/Browser/Spec342CustomerReviewWorkspaceConsumptionSmokeTest.php --compact
./vendor/bin/sail artisan test --compact --filter=ReviewPack
./vendor/bin/sail artisan test --compact --filter=CustomerReviewWorkspace
./vendor/bin/sail pint --dirty
git diff --check
- Fixture / helper / factory / seed / context cost risks: reuse existing review/evidence/review-pack helpers; do not add a heavy default browser or feature fixture layer
- Expensive defaults or shared helper growth introduced?: none expected
- Heavy-family additions, promotions, or visibility changes: one explicit browser smoke only
- Surface-class relief / special coverage rule: no relief; this is a strategic customer-safe trust surface
- Closing validation and reviewer handoff: confirm no false-ready claims, explicit limitations, explicit PII/redaction visibility, preserved signed-download safety, and no new persistence/framework
- Budget / baseline / trend follow-up: none expected beyond one explicit browser smoke
- Review-stop questions:
- Did the implementation introduce a new persisted readiness truth?
- Did it invent a second output-readiness dialect instead of aligning ZIP and workspace?
- Did it weaken download safety?
- Did it overclaim customer-safe or certification semantics?
- Escalation path:
document-in-featurefor unreachable states;follow-up-speconly for broader artifact lifecycle issues