prometeu-studio/docs/packer/pull-requests/PR-31-pack-wizard-validation-snapshot-gate.md
2026-03-24 13:42:55 +00:00

92 lines
4.0 KiB
Markdown

# PR-31 Pack Wizard Validation Snapshot Gate
Domain Owner: `docs/packer`
Cross-Domain Impact: `docs/studio`
## Briefing
The `Pack Wizard` validation phase is not a generic workspace scan.
It is a pack-set-specific gate over the current `registered + included in build` snapshot state.
The accepted decision closes the first-wave semantics:
- validation is read-only and snapshot-backed;
- validation looks only at the active pack set;
- only `blocking` diagnostics fail validation;
- the primary payload is the per-asset blocking-diagnostics list.
This PR implements that gate in `prometeu-packer-v1`.
Reference decision:
- [`../decisions/Pack Wizard Summary and Validation Contracts Decision.md`](../decisions/Pack%20Wizard%20Summary%20and%20Validation%20Contracts%20Decision.md)
## Objective
Implement snapshot-backed pack validation that returns per-asset blocking diagnostics for the active pack set and decides whether packing may proceed.
## Dependencies
- [`./PR-29-pack-wizard-contract-adjustments-for-summary-and-validation.md`](./PR-29-pack-wizard-contract-adjustments-for-summary-and-validation.md)
- [`./PR-30-pack-wizard-summary-snapshot-query.md`](./PR-30-pack-wizard-summary-snapshot-query.md)
- [`./PR-15-snapshot-backed-asset-query-services.md`](./PR-15-snapshot-backed-asset-query-services.md)
- cross-domain reference:
[`../../studio/pull-requests/PR-11-pack-wizard-shell-and-packer-contract-consumption.md`](../../studio/pull-requests/PR-11-pack-wizard-shell-and-packer-contract-consumption.md)
## Scope
- implement `validatePackWorkspace(...)` in `prometeu-packer-v1`
- evaluate only the current `registered + included in build` set from the runtime snapshot
- collect only `blocking` diagnostics for the first-wave validation payload
- return per-asset validation entries with:
- asset id
- asset name
- asset path
- `lastModified`
- blocking diagnostics
- make validation green when no blocking diagnostics are returned
- make validation red when any blocking diagnostics are returned
- keep aggregate validation data secondary to the per-asset list
## Non-Goals
- no pack execution in this PR
- no non-blocking diagnostics in the first-wave validation payload
- no packer-owned ordering contract for the returned validation list
- no deep-sync orchestration in this PR beyond using the current snapshot boundary
## Execution Method
1. Resolve the current runtime snapshot for the requested project.
2. Filter it to the active pack set:
`registered + included in build`.
3. Gather diagnostics relevant to each asset in that set.
4. Keep only diagnostics marked `blocking` for the first-wave validation response.
5. Map each asset with blockers into the public per-asset validation DTO.
6. Allow `lastModified = 0` temporarily where the real value is not yet available.
7. Return validation as green when the per-asset blocker list is empty and red otherwise.
## Acceptance Criteria
- `validatePackWorkspace(...)` evaluates only the active pack set
- only blocking diagnostics appear in the first-wave validation payload
- validation succeeds when no blocking diagnostics are present
- validation fails when any blocking diagnostics are present
- per-asset validation entries expose the fields required by the accepted decision
- Studio can stop before `Packing` using packer-owned validation alone
## Validation
- packer unit tests for pack-set filtering during validation
- packer unit tests proving non-blocking diagnostics do not fail the first-wave validation
- packer unit tests proving blocking diagnostics do fail validation
- DTO-mapping tests for per-asset validation entries
- Studio smoke validation proving the wizard blocks on returned blockers
## Affected Artifacts
- `prometeu-packer/prometeu-packer-v1/src/main/java/p/packer/services/**`
- `prometeu-packer/prometeu-packer-v1/src/main/java/p/packer/models/**`
- `prometeu-packer/prometeu-packer-v1/src/test/java/p/packer/services/**`
- `prometeu-studio/**` validation consumer surfaces if compile adaptation is needed