Cleanup pass to remove refactoring-related artifacts and references
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}}},
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user