Verify shared glossary selection across CLI workflows

This commit is contained in:
2026-11-29 18:14:11 +00:00
parent 994cba3ba2
commit 04546acee0
8 changed files with 92 additions and 24 deletions

View File

@@ -72,11 +72,6 @@ func TestProcessingUsesPerEntryProfilesInOrder(t *testing.T) {
dir := t.TempDir()
files := map[string]string{
"config.yml": `version: 3
glossary_collections:
party:
entries: [{id: alice, name: Alice, category: person}]
spells:
entries: [{id: shield, name: Shield, category: spell}]
protected_terms: [party, spells]
llm: {validation_profile: review}
pipeline:
@@ -92,6 +87,15 @@ pipeline:
- module: grammar
glossaries: [party, spells]
llm: {proposal_profile: three}
`,
"shared.yml": `schema_version: maximumdirect.glossary.v1
collections:
party:
entries: [{id: alice, name: Alice, category: person}]
spells:
entries: [{id: shield, name: Shield, category: spell}]
unused:
entries: [{id: unused, name: Unselected, category: topic}]
`,
"prompts.yml": fmt.Sprintf("profiles:\n - {id: one, endpoint: %q, model: model-one, api_key_required: false}\n - {id: two, endpoint: %q, model: model-two, api_key_required: false}\n - {id: three, endpoint: %q, model: model-three, api_key_required: false}\n - {id: review, endpoint: %q, model: review, api_key_required: false}\n", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1"),
"transcript.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Alyce casts Sheeld."}]`,
@@ -101,7 +105,7 @@ pipeline:
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{GlossaryFiles: []string{filepath.Join(dir, "shared.yml")}})
if err != nil {
t.Fatal(err)
}
@@ -121,6 +125,19 @@ pipeline:
t.Fatal(err)
}
defer prepared.Prepared.Output.Close()
specs := prepared.Invocation.Plan.Specs
if len(specs[0].Glossary) != 1 || specs[0].Glossary[0].Name != "Alice" || len(specs[1].Glossary) != 1 || specs[1].Glossary[0].Name != "Shield" {
t.Fatalf("selected glossary views: %+v %+v", specs[0].Glossary, specs[1].Glossary)
}
protectedShield := false
for _, term := range specs[0].ProtectedTerms {
if term.Spelling == "Shield" && !term.Exempt {
protectedShield = true
}
}
if !protectedShield {
t.Fatalf("missing protected spell: %+v", specs[0].ProtectedTerms)
}
result, err := executePipeline(context.Background(), prepared, func(error) {}, nil)
if err != nil {
t.Fatal(err)