Recognize spells from shared glossary documents

This commit is contained in:
2026-11-29 18:04:00 +00:00
parent d406aa6cd2
commit f84e737b2a
12 changed files with 215 additions and 558 deletions

View File

@@ -68,7 +68,7 @@ func TestMaterializedSpellCatalogOrderingPreservesSemanticContents(t *testing.T)
if err != nil {
t.Fatal(err)
}
if catalogA.Digest() != catalogB.Digest() || !reflect.DeepEqual(catalogA.OverlayIDs(), []string{"campaign.a", "campaign.b"}) || !reflect.DeepEqual(catalogB.OverlayIDs(), catalogA.OverlayIDs()) || !reflect.DeepEqual(catalogA.PromptSpells(), catalogB.PromptSpells()) {
if catalogA.Digest() != catalogB.Digest() || !reflect.DeepEqual(catalogA.CollectionNames(), []string{"spells"}) || !reflect.DeepEqual(catalogB.CollectionNames(), catalogA.CollectionNames()) || !reflect.DeepEqual(catalogA.PromptSpells(), catalogB.PromptSpells()) {
t.Fatal("catalog ordering changed semantic recognition")
}
}
@@ -76,7 +76,8 @@ func TestMaterializedSpellCatalogOrderingPreservesSemanticContents(t *testing.T)
func TestConfiguredSpellCatalogBindingChangesResolvedPipelineIdentity(t *testing.T) {
base := productionSpellCatalogContractConfig(t)
changed := strings.Replace(base, repositoryPath("examples", "dnd-complete", "spell-catalog.json"), filepath.Join(t.TempDir(), "alternate-spell-catalog.json"), 1)
source := loadMaintainedExample(t, writeProductionContractConfig(t, base)).Pipelines["dnd-session"].Artifacts["spells"].Extract.References["spell_catalog"].Path
changed := strings.Replace(base, source, filepath.Join(t.TempDir(), "alternate-spell-catalog.json"), 1)
if changed == base {
t.Fatal("production configuration did not contain the maintained catalog binding")
}
@@ -139,11 +140,11 @@ func TestProductionOverlayRunAlignsGroundingAndValidation(t *testing.T) {
}
const reorderedOverlayA = `{
"schema_version": "notarius.dnd.spell-catalog-overlay.v1",
"catalogs": [
{"id":"campaign.a","ruleset":"dnd-5e-2014","source":{"title":"Campaign A"},"spells":[{"name":"Aegis of Emberfall","aliases":["Emberfall Aegis"]}]},
{"id":"campaign.b","ruleset":"dnd-5e-2014","source":{"title":"Campaign B"},"spells":[{"name":"Cinder Veil","aliases":["Veil of Cinder","Cinder Shroud"]}]}
]
"schema_version": "maximumdirect.glossary.v1",
"collections": {"spells": {"entries": [
{"id":"a","name":"Aegis of Emberfall","category":"spell","aliases":["Emberfall Aegis"]},
{"id":"b","name":"Cinder Veil","category":"spell","aliases":["Veil of Cinder","Cinder Shroud"]}
]}}
}`
const reorderedOverlayB = `{"catalogs":[{"spells":[{"aliases":["Cinder Shroud","Veil of Cinder"],"name":"Cinder Veil"}],"source":{"title":"Campaign B"},"ruleset":"dnd-5e-2014","id":"campaign.b"},{"spells":[{"aliases":["Emberfall Aegis"],"name":"Aegis of Emberfall"}],"source":{"title":"Campaign A"},"ruleset":"dnd-5e-2014","id":"campaign.a"}],"schema_version":"notarius.dnd.spell-catalog-overlay.v1"}`
const reorderedOverlayB = `{"collections":{"spells":{"entries":[{"aliases":["Cinder Shroud","Veil of Cinder"],"name":"Cinder Veil","id":"b","category":"spell"},{"aliases":["Emberfall Aegis"],"name":"Aegis of Emberfall","id":"a","category":"spell"}]}},"schema_version":"maximumdirect.glossary.v1"}`