Cleaned up and removed legacy configuration surfaces
This commit is contained in:
@@ -10,8 +10,6 @@ func TestCacheDefaults(t *testing.T) {
|
||||
root: /tmp/narratio
|
||||
whisperx:
|
||||
transcribe_url: https://example.com/transcribe
|
||||
analyzer:
|
||||
timeout: 20m
|
||||
notification:
|
||||
timeout: 10s
|
||||
`, `session_id: 2026-05-03
|
||||
|
||||
@@ -130,7 +130,7 @@ func writeCampaignConfigTestFiles(t *testing.T, campaignYAML, sessionYAML string
|
||||
campaignPath := filepath.Join(dir, "campaign.yml")
|
||||
sessionPath := filepath.Join(dir, "session.yml")
|
||||
|
||||
pipelineYAML := "workspace:\n root: " + filepath.ToSlash(filepath.Join(dir, "work")) + "\nwhisperx:\n transcribe_url: https://example.com/transcribe\nanalyzer:\n timeout: 20m\nnotification:\n timeout: 10s\n"
|
||||
pipelineYAML := "workspace:\n root: " + filepath.ToSlash(filepath.Join(dir, "work")) + "\nwhisperx:\n transcribe_url: https://example.com/transcribe\nnotification:\n timeout: 10s\n"
|
||||
if err := os.WriteFile(pipelinePath, []byte(pipelineYAML), 0o644); err != nil {
|
||||
t.Fatalf("write pipeline.yml: %v", err)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ type PipelineConfig struct {
|
||||
Normalize *NormalizeConfig `yaml:"normalize"`
|
||||
Trim *TrimConfig `yaml:"trim"`
|
||||
Scriptorium *ScriptoriumConfig `yaml:"scriptorium"`
|
||||
Analyzer AnalyzerConfig `yaml:"analyzer"`
|
||||
Notification NotificationConfig `yaml:"notification"`
|
||||
}
|
||||
|
||||
@@ -70,8 +69,6 @@ type SecretsConfig struct {
|
||||
// StorageConfig configures storage backends and related parameters.
|
||||
type StorageConfig struct {
|
||||
Backend string `yaml:"backend"`
|
||||
Bucket string `yaml:"bucket"`
|
||||
Prefix string `yaml:"prefix"`
|
||||
S3 *StorageS3Config `yaml:"s3"`
|
||||
}
|
||||
|
||||
@@ -235,13 +232,6 @@ type ScriptoriumInputConfig struct {
|
||||
Required bool `yaml:"required"`
|
||||
}
|
||||
|
||||
// AnalyzerConfig configures analyzer adapter settings.
|
||||
type AnalyzerConfig struct {
|
||||
BinaryPath string `yaml:"binary_path"`
|
||||
Timeout string `yaml:"timeout"`
|
||||
Artifacts ArtifactSettings `yaml:"artifacts"`
|
||||
}
|
||||
|
||||
// NotificationConfig configures notification backend settings.
|
||||
type NotificationConfig struct {
|
||||
Backend string `yaml:"backend"`
|
||||
@@ -249,12 +239,6 @@ type NotificationConfig struct {
|
||||
Timeout string `yaml:"timeout"`
|
||||
}
|
||||
|
||||
// ArtifactSettings configures generated artifact selection and paths.
|
||||
type ArtifactSettings struct {
|
||||
OutputDir string `yaml:"output_dir"`
|
||||
Types []string `yaml:"types"`
|
||||
}
|
||||
|
||||
// SessionInputsConfig contains per-session input references.
|
||||
type SessionInputsConfig struct {
|
||||
AudioDir string `yaml:"audio_dir"`
|
||||
|
||||
@@ -27,8 +27,6 @@ seriatim:
|
||||
binary: seriatim
|
||||
audita:
|
||||
binary: audita
|
||||
analyzer:
|
||||
timeout: 20m
|
||||
notification:
|
||||
timeout: 15s
|
||||
`,
|
||||
@@ -48,8 +46,6 @@ inputs:
|
||||
root: /tmp/narratio
|
||||
whisperx:
|
||||
transcribe_url: https://transcription.ai.rakestrawhome.com/transcribe
|
||||
analyzer:
|
||||
timeout: 20m
|
||||
notification:
|
||||
timeout: 15s
|
||||
`,
|
||||
@@ -67,8 +63,6 @@ inputs:
|
||||
name: "workspace root defaults when omitted",
|
||||
pipelineYAML: `whisperx:
|
||||
transcribe_url: https://transcription.ai.rakestrawhome.com/transcribe
|
||||
analyzer:
|
||||
timeout: 20m
|
||||
notification:
|
||||
timeout: 15s
|
||||
`,
|
||||
@@ -97,6 +91,24 @@ inputs:
|
||||
`,
|
||||
wantLoadErr: "pipeline file",
|
||||
},
|
||||
{
|
||||
name: "legacy analyzer section fails strict decode",
|
||||
pipelineYAML: `workspace:
|
||||
root: /tmp/narratio
|
||||
whisperx:
|
||||
transcribe_url: https://transcription.ai.rakestrawhome.com/transcribe
|
||||
analyzer:
|
||||
timeout: 20m
|
||||
`,
|
||||
sessionYAML: `session_id: 2026-05-03
|
||||
inputs:
|
||||
audio_dir: ./audio
|
||||
speakers_file: ./speakers.yml
|
||||
autocorrect_file: ./autocorrect.yml
|
||||
glossary_file: ./glossary.yml
|
||||
`,
|
||||
wantLoadErr: "strict decode failed",
|
||||
},
|
||||
{
|
||||
name: "unknown whisperx field fails",
|
||||
pipelineYAML: `workspace:
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
legacyPreviousSource := "previous_session_" + "artifact"
|
||||
tests := []struct {
|
||||
name string
|
||||
scriptoriumYAML string
|
||||
@@ -94,7 +95,7 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
wantValidateErr: "pipeline.scriptorium.timeout must be a valid duration",
|
||||
},
|
||||
{
|
||||
name: "optional previous recap input is accepted",
|
||||
name: "legacy previous session artifact source fails validation",
|
||||
scriptoriumYAML: `scriptorium:
|
||||
binary: scriptorium
|
||||
artifacts:
|
||||
@@ -107,7 +108,7 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
source: narratio.transcript.polished
|
||||
required: true
|
||||
previous_recap:
|
||||
source: previous_session_artifact
|
||||
source: ` + legacyPreviousSource + `
|
||||
artifact: session_recap
|
||||
path: ""
|
||||
required: false
|
||||
@@ -115,6 +116,7 @@ func TestScriptoriumLoadAndValidate(t *testing.T) {
|
||||
session_id: true
|
||||
output_kind: session_recap
|
||||
`,
|
||||
wantValidateErr: `pipeline.scriptorium.artifacts.session_recap.inputs.previous_recap.source "` + legacyPreviousSource + `" is unsupported`,
|
||||
},
|
||||
{
|
||||
name: "canonical previous-session source is accepted",
|
||||
|
||||
@@ -39,6 +39,49 @@ storage:
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageLegacyTopLevelFieldsFailStrictDecode(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
storageYAML string
|
||||
wantField string
|
||||
}{
|
||||
{
|
||||
name: "bucket",
|
||||
storageYAML: `
|
||||
storage:
|
||||
bucket: my-dnd-archive
|
||||
`,
|
||||
wantField: "bucket",
|
||||
},
|
||||
{
|
||||
name: "prefix",
|
||||
storageYAML: `
|
||||
storage:
|
||||
prefix: dnd
|
||||
`,
|
||||
wantField: "prefix",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + tt.storageYAML
|
||||
pipelinePath, _ := writeConfigFiles(t, pipelineYAML, testSessionBaseYAML)
|
||||
|
||||
_, err := LoadPipeline(pipelinePath)
|
||||
if err == nil {
|
||||
t.Fatal("LoadPipeline() error = nil, want strict decode error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "strict decode failed") {
|
||||
t.Fatalf("LoadPipeline() error = %v, want strict decode failed", err)
|
||||
}
|
||||
if !strings.Contains(err.Error(), tt.wantField) {
|
||||
t.Fatalf("LoadPipeline() error = %v, want field %q", err, tt.wantField)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStorageS3CredentialEnvNamesLoadAndValidate(t *testing.T) {
|
||||
pipelineYAML := testPipelineBaseYAML + `
|
||||
storage:
|
||||
|
||||
@@ -87,9 +87,6 @@ func validatePipeline(cfg *PipelineConfig) error {
|
||||
if err := validateScriptorium(cfg.Scriptorium); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateDuration("pipeline.analyzer.timeout", cfg.Analyzer.Timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateDuration("pipeline.notification.timeout", cfg.Notification.Timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -720,8 +717,6 @@ func validateScriptoriumInputSource(artifactName, inputName, source string, conf
|
||||
|
||||
func isStaticSupportedScriptoriumInputSource(source string) bool {
|
||||
switch source {
|
||||
case "previous_session_artifact":
|
||||
return true
|
||||
case "narratio.transcript.merged":
|
||||
return true
|
||||
case "narratio.transcript.polished":
|
||||
|
||||
Reference in New Issue
Block a user