prometeu-studio/docs/packer/pull-requests/PR-07-build-plan-determinism-and-cache-key-foundation.md
2026-03-24 13:42:41 +00:00

63 lines
2.3 KiB
Markdown

# PR-07 Build Plan, Determinism, and Cache-Key Foundation
Domain Owner: `docs/packer`
## Briefing
Implement the deterministic planning layer that normalizes validated assets into a stable build plan before artifact emission.
This PR is the boundary between workspace semantics and runtime-facing artifact production.
## Objective
Deliver a deterministic build planner, canonical header model, preload derivation, and cache-key foundation that later emission and incremental work can trust.
## Dependencies
- [`./PR-06-doctor-diagnostics-and-safe-fix-baseline.md`](./PR-06-doctor-diagnostics-and-safe-fix-baseline.md)
- [`../specs/4. Build Artifacts and Deterministic Packing Specification.md`](../specs/4.%20Build%20Artifacts%20and%20Deterministic%20Packing%20Specification.md)
- [`../specs/5. Diagnostics, Operations, and Studio Integration Specification.md`](../specs/5.%20Diagnostics,%20Operations,%20and%20Studio%20Integration%20Specification.md)
## Scope
- validate build-eligible managed assets
- derive deterministic asset ordering by increasing `asset_id`
- build canonical header-side models for:
- `asset_table`
- `preload`
- define payload planning slots and offset planning inputs
- compute cache keys from validated effective inputs
- emit deterministic in-memory build plans before writing files
## Non-Goals
- no final `assets.pa` file emission yet
- no watch mode yet
- no format-family semantic expansion beyond what current specs already define
## Execution Method
1. Normalize validated managed assets into a stable build plan representation.
2. Implement canonical JSON serialization rules for header mirrors and planner assertions.
3. Compute cache keys only from validated effective inputs.
4. Add deterministic tests proving equivalent workspaces produce equivalent plans.
## Acceptance Criteria
- equivalent inputs produce equivalent build plans
- asset ordering is independent from filesystem traversal order
- preload derivation matches declaration state deterministically
- cache-key inputs are explicit and reproducible
## Validation
- determinism tests with reordered filesystem fixtures
- canonical-header serialization tests
- cache-key stability tests
## Affected Artifacts
- `prometeu-packer/**`
- build planning fixtures
- future dependency for `build` service and event lane