Consolidate the architecture plan into fewer packages

This commit is contained in:
2026-07-03 10:01:28 -05:00
parent 5a6e82f599
commit b4ee4c64f0
14 changed files with 364 additions and 242 deletions

View File

@@ -64,26 +64,26 @@ Add a constructor-based registry for `contracts.InputAdapter`.
### Files To Add
- `internal/framework/inputregistry/registry.go`
- `internal/framework/inputregistry/registry_test.go`
- `internal/framework/pipeline/input_registry.go`
- `internal/framework/pipeline/input_registry_test.go`
### Required API
Create package `inputregistry`.
Extend package `pipeline`.
Define:
```go
type Constructor func() (contracts.InputAdapter, error)
type InputAdapterConstructor func() (contracts.InputAdapter, error)
type Registry struct {
type InputAdapterRegistry struct {
// unexported fields
}
func New() *Registry
func (r *Registry) Register(key string, constructor Constructor) error
func (r *Registry) Build(key string) (contracts.InputAdapter, error)
func (r *Registry) RegisteredKeys() []string
func NewInputAdapterRegistry() *InputAdapterRegistry
func (r *InputAdapterRegistry) Register(key string, constructor InputAdapterConstructor) error
func (r *InputAdapterRegistry) Build(key string) (contracts.InputAdapter, error)
func (r *InputAdapterRegistry) RegisteredKeys() []string
```
### Required Behavior
@@ -137,8 +137,8 @@ Use fake adapters only. Do not add concrete input module packages.
Run:
```sh
gofmt -w internal/framework/inputregistry
go test ./internal/framework/inputregistry
gofmt -w internal/framework/pipeline
go test ./internal/framework/pipeline
go test ./...
```
@@ -150,31 +150,31 @@ Add a constructor-based registry for `contracts.Extractor`.
### Files To Add
- `internal/framework/extractorregistry/registry.go`
- `internal/framework/extractorregistry/registry_test.go`
- `internal/framework/pipeline/extractor_registry.go`
- `internal/framework/pipeline/extractor_registry_test.go`
### Required API
Create package `extractorregistry`.
Extend package `pipeline`.
Define:
```go
type Constructor func() (contracts.Extractor, error)
type ExtractorConstructor func() (contracts.Extractor, error)
type Registry struct {
type ExtractorRegistry struct {
// unexported fields
}
func New() *Registry
func (r *Registry) Register(key string, constructor Constructor) error
func (r *Registry) Build(key string) (contracts.Extractor, error)
func (r *Registry) RegisteredKeys() []string
func NewExtractorRegistry() *ExtractorRegistry
func (r *ExtractorRegistry) Register(key string, constructor ExtractorConstructor) error
func (r *ExtractorRegistry) Build(key string) (contracts.Extractor, error)
func (r *ExtractorRegistry) RegisteredKeys() []string
```
### Required Behavior
Mirror `inputregistry` behavior, but for `contracts.Extractor`.
Mirror input adapter registry behavior, but for `contracts.Extractor`.
`Build` must reject extractors whose `Key()` does not match the normalized key.
It should not validate artifact type, schema version, or validator chain. Those
@@ -203,8 +203,8 @@ Use fake extractors only. Do not add concrete extract module packages.
Run:
```sh
gofmt -w internal/framework/extractorregistry
go test ./internal/framework/extractorregistry
gofmt -w internal/framework/pipeline
go test ./internal/framework/pipeline
go test ./...
```
@@ -216,12 +216,12 @@ Add shared validator decision helpers and decision-cardinality enforcement.
### Files To Add
- `internal/framework/validators/validators.go`
- `internal/framework/validators/validators_test.go`
- `internal/framework/validate/validate.go`
- `internal/framework/validate/validate_test.go`
### Required API
Create package `validators`.
Create package `validate`.
Define reason constants:
@@ -285,8 +285,8 @@ Cover:
Run:
```sh
gofmt -w internal/framework/validators
go test ./internal/framework/validators
gofmt -w internal/framework/validate
go test ./internal/framework/validate
go test ./...
```
@@ -294,17 +294,17 @@ go test ./...
### Goal
Add runner package types and constructor without implementing the full run loop
Add pipeline runner types and constructor without implementing the full run loop
yet.
### Files To Add
- `internal/framework/runner/runner.go`
- `internal/framework/runner/runner_test.go`
- `internal/framework/pipeline/runner.go`
- `internal/framework/pipeline/runner_test.go`
### Required API
Create package `runner`.
Create or extend package `pipeline`.
Define:
@@ -364,8 +364,8 @@ assertions. Runner should depend only on framework contracts and core packages.
Run:
```sh
gofmt -w internal/framework/runner
go test ./internal/framework/runner
gofmt -w internal/framework/pipeline
go test ./internal/framework/pipeline
go test ./...
```
@@ -378,8 +378,8 @@ artifacts.
### Files To Update
- `internal/framework/runner/runner.go`
- `internal/framework/runner/runner_test.go`
- `internal/framework/pipeline/runner.go`
- `internal/framework/pipeline/runner_test.go`
### Required API
@@ -423,7 +423,7 @@ Validation behavior:
- if an extractor has no validators, all normalized candidates are approved;
- each validator receives only currently eligible candidates;
- each validator result must have `ValidatorName == Validator.Name()`;
- call `validators.EnforceDecisionCardinality` for every validator result;
- call `validate.EnforceDecisionCardinality` for every validator result;
- approved decisions keep candidates eligible for the next validator;
- rejected decisions create `artifacts.RejectedArtifact` records using the
candidate, validator name, reason code, and message;
@@ -469,8 +469,8 @@ Use fake extractors, validators, and factories only.
Run:
```sh
gofmt -w internal/framework/runner
go test ./internal/framework/runner
gofmt -w internal/framework/pipeline
go test ./internal/framework/pipeline
go test ./...
```
@@ -478,16 +478,16 @@ go test ./...
### Goal
Prove the extractor registry and runner compose without adding real process
Prove the extractor registry and runner compose without adding real extract
modules.
### Files To Add
- `internal/framework/runner/registry_integration_test.go`
- `internal/framework/pipeline/registry_integration_test.go`
### Required Test Scenario
Use `extractorregistry.New()` to register two fake extractor constructors.
Use `NewExtractorRegistry()` to register two fake extractor constructors.
Run the runner with:
@@ -509,8 +509,8 @@ Assertions:
Run:
```sh
gofmt -w internal/framework/runner
go test ./internal/framework/runner
gofmt -w internal/framework/pipeline
go test ./internal/framework/pipeline
go test ./...
go build ./cmd/notarius
```