Refactor validators into package-owned components
This commit is contained in:
@@ -134,8 +134,30 @@ internal/framework/validators/
|
||||
llm_validators.go
|
||||
|
||||
internal/validators/
|
||||
metadata/
|
||||
metadata.go
|
||||
registry.go
|
||||
chains.go
|
||||
confidence_threshold/
|
||||
validator.go
|
||||
original_text_presence/
|
||||
validator.go
|
||||
non_empty_corrected_text/
|
||||
validator.go
|
||||
no_effect/
|
||||
validator.go
|
||||
protected_terms/
|
||||
validator.go
|
||||
spoken_form_plausibility/
|
||||
validator.go
|
||||
meaning_reversal_review/
|
||||
validator.go
|
||||
editorial_review/
|
||||
validator.go
|
||||
grammar_review/
|
||||
validator.go
|
||||
spoken_word_review/
|
||||
validator.go
|
||||
|
||||
internal/prompts/
|
||||
registry.go
|
||||
@@ -195,7 +217,7 @@ Current runtime flow (`internal/cli/run.go`):
|
||||
- test/injected module factory path remains available for deterministic runtime tests.
|
||||
- each module recomputes chunks from the current working transcript, runs chunk proposal work concurrently, aggregates deterministically, validates, and applies approved proposals once.
|
||||
13. Output working transcript to `--output` file or stdout.
|
||||
14. Build process report (`phase` currently set to `default_pipeline`).
|
||||
14. Build process report metadata.
|
||||
15. Optionally write `--report-json`; always write run-dir `report.json`.
|
||||
16. Apply work-dir retention.
|
||||
|
||||
@@ -495,6 +517,26 @@ Validator composition is now explicit and registry-backed through `internal/vali
|
||||
- built-in chain definitions per production module key;
|
||||
- production modules resolve validator chains from those built-in definitions.
|
||||
|
||||
Package ownership boundary:
|
||||
- `internal/validators/<validator_key>` owns built-in validator construction and stable key identity.
|
||||
- `internal/framework/validators` remains shared runtime machinery:
|
||||
- request/result models;
|
||||
- decision cardinality enforcement;
|
||||
- protected-vocabulary helpers;
|
||||
- generic LLM-backed validator runtime, batching, and diagnostics glue.
|
||||
|
||||
Validator execution classification metadata:
|
||||
- `internal/validators/metadata` defines execution class markers:
|
||||
- `deterministic`
|
||||
- `llm_backed`
|
||||
- runner ordering uses this metadata interface rather than concrete framework validator type assertions.
|
||||
- validators without classification metadata default to deterministic ordering.
|
||||
|
||||
`protected_terms` construction ownership:
|
||||
- `internal/validators/protected_terms.New()` builds the general (non-glossary-stage) variant.
|
||||
- `internal/validators/protected_terms.NewGlossaryStage()` builds the glossary-stage variant used by glossary chains.
|
||||
- both variants preserve the stable key `protected_terms`.
|
||||
|
||||
Stable built-in validator keys:
|
||||
- deterministic:
|
||||
- `confidence_threshold`
|
||||
|
||||
@@ -4,6 +4,36 @@ This document describes Audita's built-in validator registry and module validato
|
||||
|
||||
For LLM-backed validator prompt asset details, see [`docs/prompts.md`](prompts.md).
|
||||
|
||||
## Package ownership
|
||||
|
||||
Built-in validator construction is package-owned under `internal/validators/<validator_key>`:
|
||||
- `internal/validators/confidence_threshold`
|
||||
- `internal/validators/original_text_presence`
|
||||
- `internal/validators/non_empty_corrected_text`
|
||||
- `internal/validators/no_effect`
|
||||
- `internal/validators/protected_terms`
|
||||
- `internal/validators/spoken_form_plausibility`
|
||||
- `internal/validators/meaning_reversal_review`
|
||||
- `internal/validators/editorial_review`
|
||||
- `internal/validators/grammar_review`
|
||||
- `internal/validators/spoken_word_review`
|
||||
|
||||
Registry and chain wiring stay in:
|
||||
- `internal/validators/registry.go`
|
||||
- `internal/validators/chains.go`
|
||||
|
||||
Shared validator runtime mechanics stay in `internal/framework/validators`:
|
||||
- request/result/decision models
|
||||
- decision cardinality helpers
|
||||
- protected vocabulary helpers
|
||||
- shared LLM validator runtime, batching, and diagnostics helpers
|
||||
|
||||
Execution classification metadata is defined in `internal/validators/metadata`:
|
||||
- `deterministic`
|
||||
- `llm_backed`
|
||||
|
||||
Runner ordering uses this metadata so deterministic validators run before LLM-backed validators without concrete framework type assertions.
|
||||
|
||||
## Scope
|
||||
|
||||
Validator chains are built-in runtime behavior.
|
||||
@@ -82,6 +112,14 @@ Current built-in chains resolved from `internal/validators/chains.go`:
|
||||
- `grammar_review`
|
||||
- `meaning_reversal_review`
|
||||
|
||||
## Protected terms construction
|
||||
|
||||
`protected_terms` has explicit constructors:
|
||||
- general constructor used by non-glossary modules through the built-in registry
|
||||
- glossary-stage constructor used by glossary chain resolution
|
||||
|
||||
Both variants preserve existing behavior and report the stable key `protected_terms`.
|
||||
|
||||
## Execution semantics
|
||||
|
||||
- modules execute serially;
|
||||
@@ -105,6 +143,8 @@ These are separate outcomes and are reported separately.
|
||||
- validator LLM diagnostics include validator identity in interaction metadata and structured response schema metadata.
|
||||
- correction ledger entries include deterministic and LLM validator decision snapshots keyed by the same stable validator keys, and keep validator rejection distinct from application-level skip.
|
||||
|
||||
Prompt assets are unchanged by the validator package-ownership refactor and remain built-in under `internal/prompts`.
|
||||
|
||||
## Configurable knobs that remain supported
|
||||
|
||||
- per-module confidence thresholds (`thresholds.*` / equivalent env+CLI overrides)
|
||||
|
||||
Reference in New Issue
Block a user