|
|
|
|
@@ -1,11 +1,10 @@
|
|
|
|
|
# Audita Go Architecture
|
|
|
|
|
# Audita Architecture
|
|
|
|
|
|
|
|
|
|
## Scope and intent
|
|
|
|
|
This document describes:
|
|
|
|
|
- the implemented Go architecture used in production today; and
|
|
|
|
|
- historical rewrite-phase context that explains how the architecture was delivered.
|
|
|
|
|
- the architecture used in production today.
|
|
|
|
|
|
|
|
|
|
Status labels are explicit so future engineers and LLM agents do not infer missing behavior that is not actually missing.
|
|
|
|
|
Historical rewrite details live in `docs/rewrite-notes.md`.
|
|
|
|
|
|
|
|
|
|
## Current implementation status
|
|
|
|
|
Implemented today:
|
|
|
|
|
@@ -14,7 +13,7 @@ Implemented today:
|
|
|
|
|
- Transcript and glossary parsing/validation.
|
|
|
|
|
- Deterministic transcript normalization.
|
|
|
|
|
- Deterministic token estimation and transcript chunking.
|
|
|
|
|
- Per-run diagnostics directory creation plus Phase 6 process-level artifacts.
|
|
|
|
|
- Per-run diagnostics directory creation plus process-level artifacts.
|
|
|
|
|
- Process report JSON output with diagnostics artifact references.
|
|
|
|
|
- Framework foundation packages for contracts and proposal application.
|
|
|
|
|
- Production runner orchestration package with deterministic sequential module execution.
|
|
|
|
|
@@ -32,7 +31,7 @@ Implemented today:
|
|
|
|
|
- Shared LLM proposal-generation helper with structured correction-set parsing.
|
|
|
|
|
- Deterministic proposal-index assignment and enriched proposal mapping for shared generation.
|
|
|
|
|
- Proposal-generation diagnostics artifacts with secret redaction.
|
|
|
|
|
- Production module registry scaffolding with known-key recognition and explicit unsupported/unimplemented errors.
|
|
|
|
|
- Production module registry with known-key recognition and explicit unsupported-module errors.
|
|
|
|
|
- Production `grammar` module implementation in `internal/modules/grammar`.
|
|
|
|
|
- Production `glossary` module implementation in `internal/modules/glossary`.
|
|
|
|
|
- Production `homophones` module implementation in `internal/modules/homophones`.
|
|
|
|
|
@@ -52,19 +51,6 @@ Current reality:
|
|
|
|
|
- `grammar`
|
|
|
|
|
- repeated glossary stages are deterministic and reported distinctly as `glossary_1` and `glossary_2`.
|
|
|
|
|
|
|
|
|
|
Phase sequencing note:
|
|
|
|
|
- Phase 9 LLM infrastructure is complete (structured client, scheduler, effective config resolution, diagnostics primitives);
|
|
|
|
|
- Phase 10 LLM-backed validator runtime integration is complete;
|
|
|
|
|
- Phase 11 shared proposal-generation framework and module-registry scaffolding are complete;
|
|
|
|
|
- Phase 12 grammar module implementation and explicit runtime wiring are complete;
|
|
|
|
|
- Phase 13 glossary module and protected-term behavior are complete;
|
|
|
|
|
- Phase 14 homophones module implementation and explicit runtime wiring are complete;
|
|
|
|
|
- Phase 15 spoken-word module implementation and explicit runtime wiring are complete;
|
|
|
|
|
- Phase 16 default full pipeline integration is complete;
|
|
|
|
|
- Phase 17 parity fixture suite is complete;
|
|
|
|
|
- Phase 18 operational hardening and subprocess integration are complete;
|
|
|
|
|
- Phase 19 documentation/rollout completion is complete.
|
|
|
|
|
|
|
|
|
|
## Actual Go package layout
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
@@ -177,7 +163,7 @@ Current runtime flow (`internal/cli/run.go`):
|
|
|
|
|
- explicit `--modules` overrides the default sequence;
|
|
|
|
|
- test/injected module factory path remains available for deterministic runtime tests.
|
|
|
|
|
13. Output working transcript to `--output` file or stdout.
|
|
|
|
|
14. Build process report (`phase` currently set to `phase16-default-pipeline-integration`).
|
|
|
|
|
14. Build process report (`phase` currently set to `default_pipeline`).
|
|
|
|
|
15. Optionally write `--report-json`; always write run-dir `report.json`.
|
|
|
|
|
16. Apply work-dir retention.
|
|
|
|
|
|
|
|
|
|
@@ -290,7 +276,7 @@ Current behavior details:
|
|
|
|
|
- section balancing is deterministic but heuristic.
|
|
|
|
|
|
|
|
|
|
## Implemented proposal/replacement infrastructure
|
|
|
|
|
`internal/framework/proposals` provides deterministic foundation logic:
|
|
|
|
|
`internal/framework/proposals` provides deterministic proposal composition logic:
|
|
|
|
|
- `CorrectionProposal` and `EnrichedCorrectionProposal` models;
|
|
|
|
|
- replacement policies: `require_unique`, `replace_all`;
|
|
|
|
|
- safe preview (`PreviewProposalForSegment`) with stable skip reasons;
|
|
|
|
|
@@ -362,7 +348,7 @@ This helper only produces candidate proposals; validator-chain execution and pro
|
|
|
|
|
- proposal/validation structured LLM clients
|
|
|
|
|
- proposal/validation schedulers
|
|
|
|
|
- diagnostics directory context
|
|
|
|
|
- returns explicit errors for unknown keys (`unsupported_module`) and recognized-but-unimplemented keys (`unimplemented_module`).
|
|
|
|
|
- returns explicit errors for unknown keys (`unsupported_module`).
|
|
|
|
|
|
|
|
|
|
The `grammar`, `glossary`, `homophones`, and `spoken_word` module keys are now registered and constructible.
|
|
|
|
|
|
|
|
|
|
@@ -372,7 +358,7 @@ The `grammar`, `glossary`, `homophones`, and `spoken_word` module keys are now r
|
|
|
|
|
- explicit guardrails against meaning-changing rewrites, style rewrites, summarization, and invention;
|
|
|
|
|
- proposal generation through `internal/framework/proposal_generation` and `contracts.StructuredLLMClient`;
|
|
|
|
|
- scheduler-aware proposal calls through existing `contracts.LLMScheduler` hooks;
|
|
|
|
|
- replacement policy `require_unique` (matching Python implementation);
|
|
|
|
|
- replacement policy `require_unique` (current runtime policy);
|
|
|
|
|
- validator chain integration using existing deterministic + LLM-backed validators;
|
|
|
|
|
- grammar confidence threshold enforcement through existing validator/config infrastructure;
|
|
|
|
|
- module-level reporting and diagnostics capture through existing runner/reporting paths.
|
|
|
|
|
@@ -465,9 +451,6 @@ Current runtime note:
|
|
|
|
|
- default non-explicit runs usually have no module-level skipped corrections, so `auto` commonly removes clean successful run directories.
|
|
|
|
|
- explicit grammar/glossary/homophones/spoken_word runs can produce validator rejections and application skips, which are reflected in reports and retention input.
|
|
|
|
|
|
|
|
|
|
Phase note:
|
|
|
|
|
- Earlier-phase documentation deferred module and LLM prompt work; those deferred items were completed by Phases 12-16.
|
|
|
|
|
|
|
|
|
|
## Current tests and quality posture
|
|
|
|
|
Implemented tests currently cover:
|
|
|
|
|
- CLI argument handling and behavior (`internal/cli/run_test.go`)
|
|
|
|
|
@@ -483,7 +466,7 @@ Implemented tests currently cover:
|
|
|
|
|
- validator models, cardinality enforcement, and deterministic validators (`internal/framework/validators/*_test.go`)
|
|
|
|
|
- LLM-backed validator batching, prompt builders, structured-response safety, scheduler hooks, and diagnostics redaction (`internal/framework/validators/*_test.go`, `internal/framework/runner/*_test.go`)
|
|
|
|
|
- shared proposal-generation request/response parsing, deterministic indexing, scheduler hooks, and diagnostics redaction (`internal/framework/proposal_generation/*_test.go`, `internal/framework/runner/*_test.go`)
|
|
|
|
|
- production module-registry known-key recognition and unsupported/unimplemented error behavior (`internal/framework/modules/*_test.go`, `internal/cli/run_test.go`)
|
|
|
|
|
- production module-registry known-key recognition and unsupported/internal-registry error behavior (`internal/framework/modules/*_test.go`, `internal/cli/run_test.go`)
|
|
|
|
|
- production grammar module prompt constraints, proposal mapping, validator-chain behavior, confidence-threshold enforcement, diagnostics redaction, and explicit CLI/runtime integration (`internal/modules/grammar/*_test.go`, `internal/cli/run_test.go`, `internal/framework/runner/*_test.go`)
|
|
|
|
|
- production glossary module prompt constraints, proposal mapping, validator-chain behavior, confidence-threshold enforcement, diagnostics redaction, repeated-stage behavior, and explicit CLI/runtime integration (`internal/modules/glossary/*_test.go`, `internal/cli/run_test.go`, `internal/framework/runner/*_test.go`)
|
|
|
|
|
- production homophones module prompt constraints, proposal mapping, validator-chain behavior, confidence-threshold enforcement, diagnostics redaction, protected-term behavior, and explicit CLI/runtime integration (`internal/modules/homophones/*_test.go`, `internal/cli/run_test.go`, `internal/framework/runner/*_test.go`)
|
|
|
|
|
@@ -493,7 +476,7 @@ Implemented tests currently cover:
|
|
|
|
|
- subprocess operational hardening behavior including large-input, failure-mode, timeout/cancellation, backend-failure, and partial-progress paths (`cmd/audita/main_integration_test.go`)
|
|
|
|
|
- report/diagnostics redaction and artifact-shape behavior across success and failure paths (`internal/cli/run_test.go`, `cmd/audita/main_integration_test.go`)
|
|
|
|
|
|
|
|
|
|
## Operational hardening status (Phase 18)
|
|
|
|
|
## Operational hardening status
|
|
|
|
|
The runtime now includes hardened subprocess behavior for parent-process callers:
|
|
|
|
|
- deterministic success/failure exit codes;
|
|
|
|
|
- strict stdout/stderr separation suitable for machine orchestration;
|
|
|
|
|
@@ -504,9 +487,7 @@ The runtime now includes hardened subprocess behavior for parent-process callers
|
|
|
|
|
|
|
|
|
|
Operational caller guidance is documented in [`docs/subprocess-operations.md`](docs/subprocess-operations.md).
|
|
|
|
|
|
|
|
|
|
## Final status (Phase 19 complete)
|
|
|
|
|
- Go Audita is the active implementation.
|
|
|
|
|
- Default full module-sequence runtime is implemented and tested.
|
|
|
|
|
## Final status
|
|
|
|
|
- Audita's default full module-sequence runtime is implemented and tested.
|
|
|
|
|
- Parity fixtures and operational hardening coverage are in place.
|
|
|
|
|
- Python is preserved as a legacy/reference implementation in `python/` and is no longer the primary operational path.
|
|
|
|
|
- Migration and rollout guidance is documented in [`docs/migration-from-python.md`](docs/migration-from-python.md).
|
|
|
|
|
- Historical migration context is documented in [`docs/migration-from-python.md`](docs/migration-from-python.md).
|
|
|
|
|
|