Complete session defaults within the ConfigKit lifecycle

This commit is contained in:
2026-11-20 04:24:20 +00:00
parent 16a4f7ee12
commit c3e6245416
17 changed files with 315 additions and 154 deletions

View File

@@ -42,18 +42,18 @@ inputs:
t.Fatalf("audio[%d] = %q", i, got)
}
}
if cfg.SessionDocument.Inputs.GlossaryFile != "" || cfg.SessionDocument.Inputs.SpeakersFile != filepath.Join(dir, "session/override.yml") {
t.Fatalf("detached session = %#v", cfg.SessionDocument)
if cfg.SessionDocument.Inputs.GlossaryFile != filepath.Join(dir, "campaign/glossary.yml") || cfg.SessionDocument.Inputs.SpeakersFile != filepath.Join(dir, "session/override.yml") {
t.Fatalf("completed session = %#v", cfg.SessionDocument)
}
if cfg.CampaignDocument.Inputs.GlossaryFile != filepath.Join(dir, "campaign/glossary.yml") {
t.Fatalf("detached campaign = %#v", cfg.CampaignDocument)
t.Fatalf("completed campaign = %#v", cfg.CampaignDocument)
}
}
func TestSessionDiscoveryDistinguishesAbsenceFromInvalidSelection(t *testing.T) {
dir := t.TempDir()
first := filepath.Join(dir, "first.yml")
second := writePipelineFixture(t, dir, "second.yml", "session_id: valid\n")
second := writePipelineFixture(t, dir, "second.yml", "session_id: valid\n"+standaloneSessionFields)
if cfg, path, err := DiscoverSession([]string{first, second}, SessionLoadOptions{}); err != nil || cfg == nil || path != second {
t.Fatalf("selected = %#v %q %v", cfg, path, err)
}
@@ -86,7 +86,7 @@ func TestRemoteSessionResourceBaseIgnoresDiagnosticLabel(t *testing.T) {
t.Fatal(err)
}
for _, label := range []string{"s3://bucket/session.yml", filepath.Join(t.TempDir(), "download.yml")} {
cfg, err := LoadSessionBytesWithOptions(label, []byte("session_id: test\ninputs: {audio_dir: ./audio}\n"), SessionLoadOptions{})
cfg, err := LoadSessionBytesWithOptions(label, []byte("session_id: test\n"+standaloneSessionFields), SessionLoadOptions{})
if err != nil {
t.Fatal(err)
}
@@ -110,7 +110,7 @@ func TestEquivalentDocumentLayoutsRenderIdentically(t *testing.T) {
if err != nil {
t.Fatal(err)
}
session, err := LoadSession(files[1])
session, err := LoadSessionWithOptions(files[1], SessionLoadOptions{Campaign: campaign, CampaignPath: files[0]})
if err != nil {
t.Fatal(err)
}