Add read-only configuration inspection commands

This commit is contained in:
2026-08-30 14:43:25 +00:00
parent b5b1d22011
commit a102db36af
10 changed files with 614 additions and 4 deletions

View File

@@ -34,6 +34,53 @@ inputs:
}
}
func TestMarshalEffectivePipelineRendersStablePublicConfiguration(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "pipeline.yml")
if err := os.WriteFile(path, []byte(`scriptorium:
artifacts:
zeta:
enabled: false
output_path: artifacts/zeta.md
alpha:
enabled: false
output_path: artifacts/alpha.md
workspace:
root: /srv/narratio
whisperx:
transcribe_url: https://transcription.example.com/transcribe
`), 0o644); err != nil {
t.Fatal(err)
}
first, err := LoadPipeline(path)
if err != nil {
t.Fatal(err)
}
second, err := LoadPipeline(path)
if err != nil {
t.Fatal(err)
}
firstYAML, err := MarshalEffectivePipeline(first)
if err != nil {
t.Fatal(err)
}
secondYAML, err := MarshalEffectivePipeline(second)
if err != nil {
t.Fatal(err)
}
if string(firstYAML) != string(secondYAML) || !strings.HasSuffix(string(firstYAML), "\n") {
t.Fatalf("effective YAML is not stable: first=%q second=%q", firstYAML, secondYAML)
}
output := string(firstYAML)
if strings.Contains(output, "artifact_families") || strings.Contains(output, "resolution") {
t.Fatalf("effective YAML leaked runtime fields: %q", output)
}
if strings.Index(output, "alpha:") > strings.Index(output, "zeta:") {
t.Fatalf("configured artifacts are not sorted: %q", output)
}
}
func TestValidateMissingAudioSource(t *testing.T) {
cfg := loadedValidConfig(t)
cfg.Session.Inputs.AudioDir = ""