Compare inherited effective pipeline values
This commit is contained in:
@@ -407,6 +407,112 @@ whisperx:
|
||||
}
|
||||
}
|
||||
|
||||
func TestInheritedAndExpandedConfigurationsHaveEqualEffectiveSemantics(t *testing.T) {
|
||||
load := func(t *testing.T, expanded bool) *Config {
|
||||
t.Helper()
|
||||
dir := t.TempDir()
|
||||
writePartyResolutionFile(t, filepath.Join(dir, "party.yml"), `schema_version: narratio.party.v1
|
||||
characters:
|
||||
alice:
|
||||
player: {name: Alice Player}
|
||||
character:
|
||||
name: Alice
|
||||
classes: [{name: wizard}]
|
||||
`)
|
||||
|
||||
pipeline := `configkit:
|
||||
imports:
|
||||
- path: definitions/parent.yml
|
||||
- path: definitions/child.yml
|
||||
whisperx:
|
||||
transcribe_url: https://transcription.example.test/transcribe
|
||||
`
|
||||
if expanded {
|
||||
pipeline = `whisperx:
|
||||
transcribe_url: https://transcription.example.test/transcribe
|
||||
scriptorium:
|
||||
artifacts:
|
||||
base:
|
||||
enabled: false
|
||||
prompt_id: dnd.summary
|
||||
profile_id: production
|
||||
output_path: artifacts/base.md
|
||||
render_debug: false
|
||||
summary:
|
||||
enabled: true
|
||||
prompt_id: dnd.summary
|
||||
profile_id: production
|
||||
output_path: artifacts/summary.md
|
||||
render_debug: false
|
||||
artifact_families:
|
||||
character_summary:
|
||||
enabled: true
|
||||
for_each: party.characters
|
||||
prompt_id: dnd.character_summary
|
||||
profile_id: production
|
||||
output_path_pattern: artifacts/characters/{character_id}/summary.md
|
||||
character_notes:
|
||||
enabled: true
|
||||
for_each: party.characters
|
||||
prompt_id: dnd.character_summary
|
||||
profile_id: production
|
||||
output_path_pattern: artifacts/characters/{character_id}/notes.md
|
||||
`
|
||||
} else {
|
||||
writePipelineFixture(t, dir, "definitions/parent.yml", `scriptorium:
|
||||
artifacts:
|
||||
base:
|
||||
enabled: false
|
||||
prompt_id: dnd.summary
|
||||
profile_id: production
|
||||
output_path: artifacts/base.md
|
||||
render_debug: false
|
||||
artifact_families:
|
||||
character_summary:
|
||||
enabled: true
|
||||
for_each: party.characters
|
||||
prompt_id: dnd.character_summary
|
||||
profile_id: production
|
||||
output_path_pattern: artifacts/characters/{character_id}/summary.md
|
||||
`)
|
||||
writePipelineFixture(t, dir, "definitions/child.yml", `scriptorium:
|
||||
artifacts:
|
||||
summary:
|
||||
extends: base
|
||||
enabled: true
|
||||
output_path: artifacts/summary.md
|
||||
artifact_families:
|
||||
character_notes:
|
||||
extends: character_summary
|
||||
output_path_pattern: artifacts/characters/{character_id}/notes.md
|
||||
`)
|
||||
}
|
||||
pipelinePath, campaignPath, sessionPath := writeArtifactFamilyConfig(t, dir, pipeline)
|
||||
cfg, err := LoadWithSessionOptions(pipelinePath, campaignPath, sessionPath, SessionLoadOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("LoadWithSessionOptions(expanded=%t): %v", expanded, err)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
inherited := load(t, false)
|
||||
expanded := load(t, true)
|
||||
inheritedValues, err := EffectivePipelineValues(inherited.Pipeline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expandedValues, err := EffectivePipelineValues(expanded.Pipeline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(inheritedValues, expandedValues) {
|
||||
t.Fatalf("inherited and expanded effective values differ:\ninherited=%#v\nexpanded=%#v", inheritedValues, expandedValues)
|
||||
}
|
||||
if inheritedDigest, expandedDigest := EffectivePipelineDigest(inherited.Pipeline), EffectivePipelineDigest(expanded.Pipeline); inheritedDigest != expandedDigest {
|
||||
t.Fatalf("inherited and expanded digests differ: %q != %q", inheritedDigest, expandedDigest)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExplicitFamilyMemberPublishDestinationResolution(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
writePartyResolutionFile(t, filepath.Join(dir, "party.yml"), `schema_version: narratio.party.v1
|
||||
|
||||
Reference in New Issue
Block a user