prometeu-studio/discussion/lessons/DSC-0003-packer-docs-import/LSN-0014-pack-wizard-summary-validation-and-pack-execution-legacy.md

48 lines
2.0 KiB
Markdown

---
id: LSN-0014
ticket: packer-docs-import
title: Pack wizard summary validation and pack execution legacy lesson
created: 2026-03-26
tags:
- packer
- legacy-import
- pack-wizard
- validation
- execution
---
## Context
Legacy import from `docs/packer/learn/pack-wizard-summary-validation-and-pack-execution.md`.
This lesson preserves the packer-owned semantics behind the Studio-side pack wizard.
## Key Decisions
### Summary, validation, and pack execution are distinct packer-owned phases
**What:** `summary` is a fast snapshot-backed preflight view, `validation` is a blocking-diagnostics gate over the same active pack set, and `packWorkspace(...)` is the only artifact-emitting operation, rerunning the gate on a fresh frozen snapshot and promoting staged outputs only after coherent success.
**Why:** Studio-side shelling only works if packer provides one coherent operational story instead of a mix of stale UI assumptions and live filesystem rereads.
**Trade-offs:** This model is stricter and less forgiving than trusting previous UI state, but it prevents stale or torn assumptions from leaking into final build output.
## Patterns and Algorithms
- Define the active pack set as `registered + included in build`.
- Keep summary fast and snapshot-backed.
- Let only blocking diagnostics fail first-wave validation.
- Re-run the gate on a fresh execution snapshot before emission.
- Stage outputs before promoting them to final `build/`.
## Pitfalls
- Treating summary as emitted-artifact preview.
- Validating a broader set than the active pack set.
- Letting warnings fail the first-wave gate.
- Reading live filesystem bytes after frozen execution starts.
## Takeaways
- Green validation from a few seconds earlier is not enough; pack execution must revalidate on a fresh frozen snapshot.
- Packer-owned result semantics should be enough for Studio to render packing and result phases.
- Legacy source attribution: `docs/packer/learn/pack-wizard-summary-validation-and-pack-execution.md`.