Verify shared glossary workflows and recovery
This commit is contained in:
@@ -202,7 +202,7 @@ func TestAuditaBinaryCompatibility(t *testing.T) {
|
||||
}
|
||||
dir := t.TempDir()
|
||||
configPath := filepath.Join(dir, "config.yml")
|
||||
mustWriteTestFile(t, configPath, "version: 3\nllm: {proposal_profile: proposal, validation_profile: review, correction_repair_attempts: 0}\npipeline: {stages: [{module: grammar}]}\nreporting: {enabled: false}\n")
|
||||
mustWriteTestFile(t, configPath, "version: 3\nllm: {proposal_profile: proposal, validation_profile: review, correction_repair_attempts: 0}\npipeline: {stages: [{module: grammar}]}\nglossary_collections:\n spells: {instruction: Audita default., entries: [{id: stale, name: Stale, category: spell}]}\nreporting: {enabled: false}\n")
|
||||
mustWriteTestFile(t, filepath.Join(dir, "prompts.yml"), fmt.Sprintf("backends:\n - {id: local, endpoint: %q}\nprofiles:\n - {id: proposal, backend: local, model: proposal-model}\n - {id: review, backend: local, model: review-model}\n", server.URL+"/v1"))
|
||||
req, _, err := stage.BuildPolishRequest(paths, m, "", filepath.Join(dir, "out.json"), filepath.Join(dir, "reports"), filepath.Join(dir, "debug"))
|
||||
if err != nil {
|
||||
@@ -250,4 +250,29 @@ func TestAuditaBinaryCompatibility(t *testing.T) {
|
||||
if err == nil || result.ExitCode != 1 || calls.Load() != 2 {
|
||||
t.Fatalf("negative preflight: %+v %v calls=%d", result, err, calls.Load())
|
||||
}
|
||||
empty, err := glossary.Resolve(glossary.Sources{}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
emptyPath := filepath.Join(dir, "empty-spells.yml")
|
||||
if err := os.WriteFile(emptyPath, empty["spells"], 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
emptyArgs := append([]string(nil), args...)
|
||||
for i := range emptyArgs {
|
||||
if emptyArgs[i] == req.GlossaryFiles[3] {
|
||||
emptyArgs[i] = emptyPath
|
||||
}
|
||||
}
|
||||
output, err = exec.Command(binary, emptyArgs...).CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("empty inspection: %v: %s", err, output)
|
||||
}
|
||||
if err := json.Unmarshal(output, &inspected); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
spells := inspected.Collections["spells"]
|
||||
if len(spells.Entries) != 0 || spells.Instruction == nil || *spells.Instruction != "Audita default." {
|
||||
t.Fatalf("empty prepared spells did not replace configured entries and retain instruction: %+v", spells)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user