prometeu-studio/docs/packer/pull-requests/PR-03-asset-declaration-parsing-validation-and-details-contract.md
2026-03-24 13:42:41 +00:00

66 lines
2.3 KiB
Markdown

# PR-03 Asset Declaration Parsing, Validation, and Details Contract
Domain Owner: `docs/packer`
## Briefing
Implement strict `asset.json` parsing and the packer-side details contract used by both tooling and Studio.
This PR converts the declaration spec into typed packer models and structured diagnostics.
## Objective
Deliver strict parse, schema/version checks, common field validation, and a `get_asset_details` response model that Studio can consume through an adapter.
## Dependencies
- [`./PR-02-workspace-init-registry-and-identity-foundation.md`](./PR-02-workspace-init-registry-and-identity-foundation.md)
- [`../specs/3. Asset Declaration and Virtual Asset Contract Specification.md`](../specs/3.%20Asset%20Declaration%20and%20Virtual%20Asset%20Contract%20Specification.md)
- [`../specs/6. Versioning, Migration, and Trust Model Specification.md`](../specs/6.%20Versioning,%20Migration,%20and%20Trust%20Model%20Specification.md)
## Scope
- parse and validate the common `asset.json` contract
- validate required baseline fields:
- `schema_version`
- `name`
- `type`
- `inputs`
- `output`
- `preload`
- emit structured diagnostics for parse, structural, and version errors
- define the packer `get_asset_details` response model
- preserve distinction between valid-orphan declarations and invalid declarations
## Non-Goals
- no full format-family payload encoding rules
- no workspace scan aggregation yet
- no mutation apply behavior yet
## Execution Method
1. Implement typed declaration models and strict decoding.
2. Add common semantic validation and diagnostic mapping.
3. Define details-response DTOs that preserve both declaration and diagnostic evidence.
4. Back the contract with representative valid and invalid fixtures.
## Acceptance Criteria
- invalid declarations fail with actionable structured diagnostics
- valid declarations produce stable typed models
- `get_asset_details` can expose declaration, inputs, output, preload, and diagnostics cleanly
- unsupported or malformed schema versions surface as explicit failures
## Validation
- fixture-driven parser tests
- semantic validation tests for required fields
- details-response tests for valid, orphan, and invalid declarations
## Affected Artifacts
- `prometeu-packer/**`
- packer declaration fixtures
- cross-domain reference: Studio asset details adapter inputs