Cleanup pass to remove refactoring-related artifacts and references

This commit is contained in:
2026-05-12 15:19:50 -05:00
parent af84249da0
commit 390daa8b84
24 changed files with 138 additions and 173 deletions

View File

@@ -542,7 +542,7 @@ func extractErrorPhase(err error) (phase string, message string) {
func buildProcessReport(status string, inv processInvocation, runDir *diagnostics.RunDirectory, startedAt, completedAt time.Time, errorMessage string, errorPhase string, normalizationSummary *normalization.NormalizationSummary, chunkingSummary *chunking.Summary, runOutput *runner.RunOutput) reporting.ProcessReport {
report := reporting.ProcessReport{
Phase: "phase16-default-pipeline-integration",
Phase: "default_pipeline",
Status: status,
Operation: "process",
TranscriptPath: inv.TranscriptPath,

View File

@@ -750,8 +750,8 @@ func TestRunProcessReportJSONIncludesChunkingSummary(t *testing.T) {
if report.Chunking.MaxSectionTokens == 0 {
t.Errorf("expected max_section_tokens in report")
}
if report.Phase != "phase16-default-pipeline-integration" {
t.Errorf("expected phase 'phase16-default-pipeline-integration', got %q", report.Phase)
if report.Phase != "default_pipeline" {
t.Errorf("expected phase 'default_pipeline', got %q", report.Phase)
}
}
@@ -1114,7 +1114,7 @@ func TestRunProcessExplicitUnsupportedModulesFailClearly(t *testing.T) {
}
func TestRunProcessExplicitGrammarAppliesCorrectionAndReportsDiagnostics(t *testing.T) {
secret := "phase12-secret"
secret := "grammar-secret"
processProposalLLMClient = &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{
@@ -1309,7 +1309,7 @@ func TestRunProcessExplicitGrammarMalformedLLMOutputFailsWithErrorLog(t *testing
}
func TestRunProcessDefaultRunExecutesFullModuleSequence(t *testing.T) {
secret := "phase16-secret"
secret := "pipeline-secret"
proposalClient := &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{Corrections: []proposal_generation.StructuredCorrectionProposal{
@@ -1531,7 +1531,7 @@ func TestRunProcessDefaultFullPipelineFailurePreservesPartialProgressAndRetentio
}
func TestRunProcessDefaultFullPipelineAggregatesSkipsAndAutoRetentionKeepsRunDir(t *testing.T) {
secret := "phase16-retention-secret"
secret := "retention-secret"
proposalClient := &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{Corrections: []proposal_generation.StructuredCorrectionProposal{
@@ -1648,7 +1648,7 @@ func TestRunProcessDefaultFullPipelineAggregatesSkipsAndAutoRetentionKeepsRunDir
}
func TestRunProcessExplicitGlossaryAppliesCorrectionAndReportsDiagnostics(t *testing.T) {
secret := "phase13-secret"
secret := "glossary-secret"
proposalClient := &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{
@@ -1923,7 +1923,7 @@ func TestRunProcessExplicitGlossaryMalformedLLMOutputFailsWithErrorLog(t *testin
}
func TestRunProcessExplicitHomophonesAppliesCorrectionAndReportsDiagnostics(t *testing.T) {
secret := "phase14-secret"
secret := "homophones-secret"
proposalClient := &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{
@@ -2241,7 +2241,7 @@ func TestRunProcessExplicitGlossaryThenHomophonesSeesWorkingTranscriptChanges(t
}
func TestRunProcessExplicitSpokenWordAppliesCleanupAndReportsDiagnostics(t *testing.T) {
secret := "phase15-secret"
secret := "spoken-word-secret"
proposalClient := &fakeStructuredLLMClient{
proposalResponses: []proposal_generation.StructuredCorrectionSet{
{

View File

@@ -5,8 +5,8 @@
"proposal_responses_file": "default-full-pipeline.proposals.json",
"validation_responses_file": "default-full-pipeline.validations.json",
"env": {
"AUDITA_LLM_API_KEY": "phase17-secret",
"AUDITA_VALIDATION_LLM_API_KEY": "phase17-secret"
"AUDITA_LLM_API_KEY": "parity-secret",
"AUDITA_VALIDATION_LLM_API_KEY": "parity-secret"
},
"expect": {
"exit_code": 0,
@@ -16,7 +16,7 @@
"module_count": 5,
"total_applied_changes": 3,
"total_skipped_changes": 3,
"secret_markers": ["phase17-secret"],
"secret_markers": ["parity-secret"],
"expected_proposal_calls": [
"glossary_1:proposal",
"homophones:proposal",

View File

@@ -7,6 +7,6 @@
{"validations": [{"correction_index": 0, "approved": true, "confidence": 0.99, "reason": "ok"}]},
{"validations": [{"correction_index": 0, "approved": true, "confidence": 0.99, "reason": "ok"}]},
{"validations": [{"correction_index": 0, "approved": false, "confidence": 0.99, "reason": "reject cleanup"}]},
{"validations": [{"correction_index": 0, "approved": true, "confidence": 0.99, "reason": "phase17-secret"}]},
{"validations": [{"correction_index": 0, "approved": true, "confidence": 0.99, "reason": "parity-secret"}]},
{"validations": [{"correction_index": 0, "approved": true, "confidence": 0.99, "reason": "ok"}]}
]

View File

@@ -11,7 +11,7 @@ import (
func TestProcessReportModuleResultsJSONSuccessAndSkipped(t *testing.T) {
now := time.Now().UTC()
report := ProcessReport{
Phase: "phase15-spoken-word-module",
Phase: "default_pipeline",
Status: "success",
ModuleResults: []ModuleReport{
{
@@ -80,7 +80,7 @@ func TestProcessReportModuleResultsJSONSuccessAndSkipped(t *testing.T) {
func TestProcessReportModuleResultsJSONFailedModule(t *testing.T) {
now := time.Now().UTC()
report := ProcessReport{
Phase: "phase15-spoken-word-module",
Phase: "default_pipeline",
Status: "failed",
ModuleResults: []ModuleReport{
{

View File

@@ -13,7 +13,7 @@ import (
// testChunkProposalHarness is a test-only helper that composes existing
// deterministic chunking and proposal-application primitives.
// Production runner orchestration is implemented in later phases.
// It isolates proposal/composition behavior from full runner orchestration.
type testChunkProposalHarness struct {
module TranscriptModule
}

View File

@@ -22,8 +22,7 @@ const (
)
const (
ReasonUnsupportedModule = "unsupported_module"
ReasonUnimplementedModule = "unimplemented_module"
ReasonUnsupportedModule = "unsupported_module"
)
var knownModuleKeys = map[string]struct{}{
@@ -66,8 +65,7 @@ type Factory struct {
constructors map[string]Constructor
}
// NewFactory creates a production registry scaffold with known module keys but
// no real module constructors registered yet.
// NewFactory creates a production module registry.
func NewFactory(deps Dependencies) *Factory {
factory := &Factory{
deps: deps,
@@ -133,7 +131,7 @@ func (f *Factory) ModuleForSpec(spec contracts.ModuleRunSpec) (contracts.Transcr
constructor, ok := f.constructors[key]
if !ok || constructor == nil {
return nil, &UnimplementedModuleError{ModuleKey: key}
return nil, fmt.Errorf("internal module registry error: constructor for module %q is not configured", key)
}
module, err := constructor(context.Background(), ConstructRequest{
@@ -170,17 +168,3 @@ func (e *UnsupportedModuleError) Error() string {
func (e *UnsupportedModuleError) ReasonCode() string {
return ReasonUnsupportedModule
}
// UnimplementedModuleError indicates a known module key without constructor.
type UnimplementedModuleError struct {
ModuleKey string
}
func (e *UnimplementedModuleError) Error() string {
return fmt.Sprintf("module %q is recognized but not implemented", strings.TrimSpace(e.ModuleKey))
}
// ReasonCode returns a stable reason code suitable for reporting.
func (e *UnimplementedModuleError) ReasonCode() string {
return ReasonUnimplementedModule
}

View File

@@ -3,6 +3,7 @@ package modules
import (
"context"
"errors"
"strings"
"testing"
"gitea.maximumdirect.net/eric/audita/internal/framework/contracts"
@@ -64,22 +65,17 @@ func TestUnsupportedUnknownModuleKeyFailsCleanly(t *testing.T) {
}
}
func TestRecognizedButUnimplementedModuleKeyFailsCleanly(t *testing.T) {
func TestRecognizedButMissingConstructorFailsWithInternalRegistryError(t *testing.T) {
factory := NewFactory(Dependencies{})
// Force an unimplemented state for a known key to keep reason-code behavior tested.
// Force a missing constructor state for a known key.
factory.constructors[ModuleKeySpokenWord] = nil
_, err := factory.ModuleForSpec(contracts.ModuleRunSpec{ModuleKey: ModuleKeySpokenWord, InstanceName: ModuleKeySpokenWord})
if err == nil {
t.Fatal("expected unimplemented-module error")
t.Fatal("expected constructor-missing error")
}
var unimplemented *UnimplementedModuleError
if !errors.As(err, &unimplemented) {
t.Fatalf("expected UnimplementedModuleError, got %T (%v)", err, err)
}
if unimplemented.ReasonCode() != ReasonUnimplementedModule {
t.Fatalf("unexpected reason code: %q", unimplemented.ReasonCode())
if !strings.Contains(err.Error(), "internal module registry error") {
t.Fatalf("expected internal registry error, got %v", err)
}
}

View File

@@ -185,7 +185,7 @@ func TestGenerateCandidatesMultipleSectionsStableMetadata(t *testing.T) {
}
func TestGenerateCandidatesDiagnosticsWrittenAndRedacted(t *testing.T) {
secret := "phase11-secret"
secret := "proposal-secret"
client := &fakeStructuredClient{
responses: []StructuredCorrectionSet{
{Corrections: []StructuredCorrectionProposal{{TargetSegmentID: 1, OriginalText: secret, CorrectedText: "safe", Confidence: 0.9}}},

View File

@@ -30,7 +30,7 @@ type EnrichedCorrectionProposal struct {
// Validate checks only basic structural integrity of the proposal.
// Semantic checks (staleness, span presence, replacement behavior) are handled
// by later proposal preview/application and validator phases.
// by proposal preview/application and validator execution.
func (p CorrectionProposal) Validate() error {
if p.TargetSegmentID <= 0 {
return fmt.Errorf("proposal id must be positive")

View File

@@ -41,7 +41,7 @@ func New() (*Module, error) {
func (m *Module) Key() string { return "glossary" }
func (m *Module) ReplacementPolicy() proposals.ReplacementPolicy {
// Python glossary module uses replace_all to update repeated term occurrences.
// Update repeated term occurrences.
return proposals.ReplacementPolicyReplaceAll
}

View File

@@ -41,7 +41,7 @@ func New() (*Module, error) {
func (m *Module) Key() string { return "grammar" }
func (m *Module) ReplacementPolicy() proposals.ReplacementPolicy {
// Python grammar module uses require_unique for conservative single-span replacement.
// Conservative single-span replacement.
return proposals.ReplacementPolicyRequireUnique
}

View File

@@ -22,8 +22,8 @@ type promptTranscriptSection struct {
Segments []promptSegment `json:"segments"`
}
// BuildProposalMessages mirrors the Python grammar-module prompt intent:
// punctuation/capitalization/spacing cleanup only, with strict meaning guards.
// BuildProposalMessages constrains corrections to punctuation/capitalization/
// spacing cleanup with strict meaning guards.
func BuildProposalMessages(transcript *schema.Transcript, glossary *schema.Glossary, sectionIndex int) ([]contracts.LLMMessage, error) {
glossaryJSON, err := json.MarshalIndent(glossary, "", " ")
if err != nil {

View File

@@ -41,7 +41,7 @@ func New() (*Module, error) {
func (m *Module) Key() string { return "homophones" }
func (m *Module) ReplacementPolicy() proposals.ReplacementPolicy {
// Python homophones module uses require_unique for conservative single-span replacement.
// Conservative single-span replacement.
return proposals.ReplacementPolicyRequireUnique
}

View File

@@ -22,8 +22,8 @@ type promptTranscriptSection struct {
Segments []promptSegment `json:"segments"`
}
// BuildProposalMessages mirrors the Python homophones-module prompt intent:
// conservative homophone and mistranscription correction only.
// BuildProposalMessages constrains corrections to conservative homophone and
// mistranscription updates.
func BuildProposalMessages(transcript *schema.Transcript, glossary *schema.Glossary, sectionIndex int) ([]contracts.LLMMessage, error) {
glossaryJSON, err := json.MarshalIndent(glossary, "", " ")
if err != nil {

View File

@@ -41,7 +41,7 @@ func New() (*Module, error) {
func (m *Module) Key() string { return "spoken_word" }
func (m *Module) ReplacementPolicy() proposals.ReplacementPolicy {
// Python spoken_word module uses require_unique for conservative single-span replacement.
// Conservative single-span replacement.
return proposals.ReplacementPolicyRequireUnique
}

View File

@@ -22,8 +22,8 @@ type promptTranscriptSection struct {
Segments []promptSegment `json:"segments"`
}
// BuildProposalMessages mirrors the Python spoken_word-module prompt intent:
// conservative dysfluency cleanup with strict semantic preservation.
// BuildProposalMessages constrains corrections to conservative dysfluency
// cleanup with strict semantic preservation.
func BuildProposalMessages(transcript *schema.Transcript, glossary *schema.Glossary, sectionIndex int) ([]contracts.LLMMessage, error) {
glossaryJSON, err := json.MarshalIndent(glossary, "", " ")
if err != nil {