Add type-safe artifact lane resolution
This commit is contained in:
@@ -17,6 +17,10 @@ validator registry. Package-family registrars compose those leaf registrations
|
||||
into the production catalog and own family-level policy such as default
|
||||
validator chains and prompt asset collection.
|
||||
|
||||
Production extract, merge, normalize, and validator packages currently use the
|
||||
explicit legacy raw registration APIs. Typed registration is framework-ready,
|
||||
but no production artifact kind or codec is registered yet.
|
||||
|
||||
Specs expose capability and execution metadata without constructing an
|
||||
implementation. Chunk, extract, merge, and normalize modules that accept
|
||||
auxiliary material declare identical reference slots from both
|
||||
|
||||
@@ -46,15 +46,19 @@ a sorted set of artifact lanes before the runner constructs any stage module.
|
||||
| `internal/framework/checkpoint` | Workspace-backed checkpoint loading, recording, and payload serialization. |
|
||||
| `internal/framework/debug` | Workspace-backed framework and LLM debug recording. |
|
||||
|
||||
Framework contracts carry raw stage results between implementations. The
|
||||
runner owns handoff provenance, validation sequencing, rejection handling,
|
||||
checkpoint and debug boundaries, and final manifest assembly.
|
||||
Framework contracts provide both the production raw stage interfaces and typed
|
||||
artifact, provenance-wrapper, chunk-validator, serialized-validator, and
|
||||
typed-validator interfaces. The runner owns handoff provenance, validation
|
||||
sequencing, rejection handling, checkpoint and debug boundaries, and final
|
||||
manifest assembly.
|
||||
|
||||
The artifact codec registry is an implemented foundation for heterogeneous
|
||||
typed artifacts. It validates codec metadata and schema identity and keeps
|
||||
exact Go-type checks behind framework-owned erased operations. Production
|
||||
module families do not register codecs yet, so pipeline resolution and
|
||||
execution continue to use the existing raw artifact contracts.
|
||||
Artifact registries support heterogeneous typed extraction entries and
|
||||
kind-specific merger, normalizer, and validator variants. Resolution derives a
|
||||
lane's kind from its extractor, requires the matching codec, verifies exact Go
|
||||
type equality across the lane, and records schema identity in the resolved lane
|
||||
and pipeline digest. Production module families do not register typed variants
|
||||
yet and continue through explicitly named legacy raw registrations. The current
|
||||
runner rejects a typed resolved lane instead of routing it through raw execution.
|
||||
|
||||
## Production Extensions
|
||||
|
||||
|
||||
@@ -20,9 +20,12 @@ calls `pipeline.ResolvePipeline`.
|
||||
1. selects and sorts artifact lanes;
|
||||
2. completes omitted bindings using the documented configuration defaults;
|
||||
3. looks up each module and validator spec without constructing it;
|
||||
4. checks required and provided capabilities in workflow order;
|
||||
5. resolves target-aware reference bindings and validator chains;
|
||||
6. calculates a digest over the resolved structure.
|
||||
4. for a typed extractor, derives its artifact kind, requires the codec, and
|
||||
selects exact-type merger, normalizer, and validator variants;
|
||||
5. checks required and provided capabilities in workflow order;
|
||||
6. resolves target-aware reference bindings and validator chains;
|
||||
7. calculates a digest over the resolved structure, including typed artifact
|
||||
kind and schema identity.
|
||||
|
||||
Resolution returns a `ResolvedPipeline` containing ordered lanes, concrete
|
||||
bindings, validator chains, reference targets, and the digest. It does not read
|
||||
@@ -59,9 +62,16 @@ one codec per stable artifact kind, validates its schema metadata and JSON
|
||||
Schema, retains the exact schema digest and Go type, and safely encodes or
|
||||
decodes framework-erased values with typed errors on incompatibility.
|
||||
|
||||
Typed extractor entries are keyed by module key and declare one artifact kind.
|
||||
Merger, normalizer, and typed-validator variants are keyed by module or
|
||||
validator key plus artifact kind. Chunk and serialized validators occupy
|
||||
separate target namespaces; serialized registrations declare whether they
|
||||
support chunks, artifacts, or both. Duplicate variants and exact Go-type
|
||||
mismatches are rejected deterministically.
|
||||
|
||||
Production composition initializes the artifact codec registry without adding
|
||||
codec entries. The resolver and runner do not consult it yet, and production
|
||||
lanes remain on the raw artifact path.
|
||||
codec entries, and production modules use the explicitly named legacy raw
|
||||
registration APIs. A raw registration cannot satisfy a typed lane.
|
||||
|
||||
A `ModuleSpec` declares its stage plus required and provided capabilities.
|
||||
Chunk, extract, merge, and normalize specs may also declare reference slots.
|
||||
@@ -82,6 +92,10 @@ selected input adapter. Later stage requests receive the generic source model;
|
||||
extract requests receive chunk-scoped input material, while chunk, merge, and
|
||||
normalize requests retain access to the original source material.
|
||||
|
||||
Typed lanes can be composed and resolved but are not passed to the current raw
|
||||
runner. The runner rejects such input before source work; production lanes are
|
||||
still resolved and executed exclusively through the legacy raw path.
|
||||
|
||||
Source validation requires every unit to carry a canonical self-reference to
|
||||
its containing document and its own unit ID. Explicit clone, checkpoint, and
|
||||
debug boundaries retain that reference, and the canonical source digest covers
|
||||
@@ -193,6 +207,9 @@ durable manifest and logical file schemas are defined in the
|
||||
capabilities, validator chains, and digest behavior.
|
||||
- `internal/framework/pipeline/artifact_codec_registry_test.go`: typed codec
|
||||
metadata, registration, erasure safety, strict decoding, and cloning.
|
||||
- `internal/framework/pipeline/typed_resolution_test.go`: heterogeneous typed
|
||||
lane resolution, target-specific validators, incompatibilities, ordering, and
|
||||
schema-sensitive pipeline identity.
|
||||
- `internal/framework/pipeline/references_test.go`: target resolution and
|
||||
materialization.
|
||||
- `internal/framework/pipeline/runner_test.go`: stage transitions, retries,
|
||||
|
||||
Reference in New Issue
Block a user