Collect prompt file paths from effective configuration
This commit is contained in:
@@ -15,11 +15,13 @@ import (
|
||||
func TestRuntimeTracksCapturedConfigurationAndInheritedMessageFiles(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for name, content := range map[string]string{
|
||||
"config.yml": "version: 3\n",
|
||||
"prompts.yml": "config:\n imports:\n - path: catalog/arbitrary-name.yaml\n required: true\n",
|
||||
"catalog/arbitrary-name.yaml": "prompts:\n - id: source\n messages:\n - role: user\n content_file: instruction.md\n output:\n format: text\n validation_mode: none\n",
|
||||
"catalog/instruction.md": "Captured operator message.\n",
|
||||
"prompts/nested/override.yaml": "prompts:\n - id: literal-child\n extends: {id: source}\n",
|
||||
"config.yml": "version: 3\n",
|
||||
"prompts.yml": "config:\n imports:\n - path: catalog/arbitrary-name.yaml\n required: true\n",
|
||||
"catalog/arbitrary-name.yaml": "prompts:\n - id: source\n messages:\n - role: user\n content_file: instruction.md\n output:\n format: text\n validation_mode: none\n",
|
||||
"catalog/instruction.md": "Captured operator message.\n",
|
||||
"prompts/nested/override.yaml": "prompts:\n - id: literal-child\n extends: {id: source}\n",
|
||||
"prompts/nested/collection.yml": "collections:\n operator:\n prompts:\n - id: local\n messages:\n - role: user\n content_file: ../shared/collection.md\n output:\n format: text\n validation_mode: none\n",
|
||||
"prompts/shared/collection.md": "Message in a collection.\n",
|
||||
} {
|
||||
file := filepath.Join(dir, name)
|
||||
if err := os.MkdirAll(filepath.Dir(file), 0700); err != nil {
|
||||
@@ -37,7 +39,14 @@ func TestRuntimeTracksCapturedConfigurationAndInheritedMessageFiles(t *testing.T
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []string{filepath.Join(dir, "prompts.yml"), filepath.Join(dir, "catalog/arbitrary-name.yaml"), filepath.Join(dir, "catalog/instruction.md"), filepath.Join(dir, "prompts/nested/override.yaml")}
|
||||
want := []string{
|
||||
filepath.Join(dir, "prompts.yml"),
|
||||
filepath.Join(dir, "catalog/arbitrary-name.yaml"),
|
||||
filepath.Join(dir, "catalog/instruction.md"),
|
||||
filepath.Join(dir, "prompts/nested/override.yaml"),
|
||||
filepath.Join(dir, "prompts/nested/collection.yml"),
|
||||
filepath.Join(dir, "prompts/shared/collection.md"),
|
||||
}
|
||||
sort.Strings(want)
|
||||
if !reflect.DeepEqual(runtime.SourcePaths, want) {
|
||||
t.Fatalf("captured source paths = %#v, want %#v", runtime.SourcePaths, want)
|
||||
|
||||
Reference in New Issue
Block a user