Complete Phase 8 deterministic validators

This commit is contained in:
2026-05-12 00:26:27 +00:00
parent 28fe899aa1
commit aeb31f1c0d
13 changed files with 940 additions and 115 deletions

View File

@@ -19,14 +19,21 @@ Implemented today:
- Framework foundation packages for contracts and proposal application.
- Production runner orchestration package with deterministic sequential module execution.
- Module-level report structures with applied/skipped change records.
- Runtime validator models and deterministic validators.
- Deterministic validator-chain execution in the runner with cardinality enforcement.
- Module-level validator decision/rejection reporting.
Not implemented in CLI runtime path today:
- Real module execution pipeline (`glossary`, `homophones`, `spoken_word`, `grammar`).
- Structured LLM proposal generation.
- Validator chain execution.
- LLM-backed validators.
- Production LLM scheduler behavior.
- End-to-end transcript polishing with real module behavior.
Phase sequencing note:
- structured LLM client and scheduler infrastructure remain Phase 9 work;
- LLM-backed validators remain Phase 10 work.
## Actual Go package layout
```text
@@ -77,6 +84,10 @@ internal/framework/proposals/
internal/framework/runner/
runner.go
internal/framework/validators/
models.go
deterministic.go
```
## Current CLI behavior
@@ -100,7 +111,7 @@ Current runtime flow (`internal/cli/run.go`):
11. Write chunking summary artifact.
12. Optionally execute runner modules sequentially when an injected module registry/factory is available (used by deterministic tests today).
13. Output working transcript to `--output` file or stdout.
14. Build process report (`phase` currently set to `phase7-runner`).
14. Build process report (`phase` currently set to `phase8-validators`).
15. Optionally write `--report-json`; always write run-dir `report.json`.
16. Apply work-dir retention.
@@ -194,6 +205,24 @@ Current behavior details:
These primitives are wired into the production runner and report model. Real module implementations are still pending.
## Implemented validator runtime infrastructure
`internal/framework/validators` provides deterministic validator infrastructure:
- runtime validation request/result models;
- stable validator reason codes;
- cardinality enforcement for validator decisions:
- missing proposal indexes fail
- duplicate proposal indexes fail
- unknown proposal indexes fail
- deterministic validators:
- confidence threshold by module key/config threshold
- original-text presence against current working transcript
- non-empty corrected text
- identical/no-effect rejection
- conservative protected glossary-term guard for non-glossary modules
`internal/framework/runner` executes validator chains in order for each module and applies only validator-approved proposals.
Validator rejections are reported distinctly from proposal-application skips.
## Reports and diagnostics (implemented)
Current per-run artifacts include:
- `source-transcript.json`
@@ -222,6 +251,7 @@ Current process reports include diagnostics metadata references for:
Current process reports also include:
- module-level results (when runner modules execute), including applied/skipped proposal changes;
- run-level module summary totals and failed module instance metadata.
- module-level validator decisions and validator rejections.
Retention modes implemented in `ApplyRetention`:
- `always`: keep all run directories.
@@ -247,8 +277,9 @@ Implemented tests currently cover:
- contracts/foundation composition tests (`internal/framework/contracts/*_test.go`)
- runner sequencing and failure behavior with deterministic fake modules (`internal/framework/runner/*_test.go`)
- CLI runner integration through injected fake module factories (`internal/cli/run_test.go`)
- validator models, cardinality enforcement, and deterministic validators (`internal/framework/validators/*_test.go`)
Not covered yet (because not implemented): validator runtime flow with approvals/rejections and real LLM integration.
Not covered yet (because not implemented): real LLM validator/runtime integration and production module behavior.
## Intended final architecture (not yet implemented)
The intended end-state still matches the rewrite plan: