Migrate examples and guidance to shared domain inputs

This commit is contained in:
2026-11-29 18:22:32 +00:00
parent f05d2e593e
commit 9dc976afaf
24 changed files with 199 additions and 145 deletions

View File

@@ -93,9 +93,9 @@ func TestMaintainedCompleteInvocationPublishesRegistryBackedEntityOccurrences(t
code := RunWithOptions([]string{
"run", "dnd-session", "--config", configPath,
"--input-file", repositoryPath("examples", "dnd-complete", "transcript.json"),
"--reference", "party=" + repositoryPath("examples", "dnd-complete", "party.txt"),
"--reference", "glossary=" + repositoryPath("examples", "dnd-complete", "glossary.txt"),
"--reference", "spell_catalog=" + repositoryPath("examples", "dnd-complete", "spell-catalog.json"),
"--reference", "party=" + repositoryPath("examples", "dnd-complete", "party.yml"),
"--reference", "glossary=" + repositoryPath("examples", "dnd-complete", "glossary.yml"),
"--reference", "spell_catalog=" + repositoryPath("examples", "dnd-complete", "glossary.yml"),
"--cache", "bypass", "--output-dir", outputRoot,
"--llm-session-id", "enemy-event-session", "--format", "json",
}, &stdout, &stderr, options)

View File

@@ -106,8 +106,8 @@ func TestProductionNPCConfigurationValidatesOptionsReferencesAndPlacement(t *tes
if err := resolve(func(profile *pipeline.PipelineProfile) {
profile.References = pipeline.ExternalReferenceMap(map[string]string{
"players": "players.txt",
"party": "party.txt",
"glossary": "glossary.txt",
"party": "party.yml",
"glossary": "glossary.yml",
})
}); err != nil {
t.Fatalf("optional NPC references error = %v, want resolution success", err)

View File

@@ -15,6 +15,7 @@ import (
"gitea.maximumdirect.net/eric/notarius/internal/core/config"
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
"gitea.maximumdirect.net/eric/notarius/internal/integrations/domainrefs"
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
locationoccurrenceextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationoccurrences"
locationextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationregistry"
@@ -123,6 +124,25 @@ func TestMaintainedExamplesResolveComposition(t *testing.T) {
}
}
func TestMaintainedSharedReferencesConform(t *testing.T) {
for _, item := range []struct {
name string
validate func(map[string]any) error
}{
{"party.yml", domainrefs.ValidateParty},
{"glossary.yml", domainrefs.ValidateGlossary},
} {
content := readRepositoryFile(t, "examples", "dnd-complete", item.name)
doc, err := domainrefs.Load(item.name, "application/yaml", content)
if err == nil {
err = item.validate(doc)
}
if err != nil {
t.Fatalf("%s: %v", item.name, err)
}
}
}
func TestMaintainedExampleDevelopmentInheritsComposition(t *testing.T) {
path := repositoryPath("examples", "dnd-complete", "config.yml")
cfg := loadMaintainedExample(t, path)
@@ -427,10 +447,10 @@ func TestCompleteDNDSharedCLIReferencesExpandAcrossCompatibleTargets(t *testing.
cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-complete", "config.yml"))
catalog := catalogFromRegistries(productionTestComponents(t).registries)
sources := map[string]string{
"party": "/references/party.txt",
"party": "/references/party.yml",
"players": "/references/players.txt",
"glossary": "/references/glossary.txt",
"spell_catalog": "/references/spells.json",
"glossary": "/references/glossary.yml",
"spell_catalog": "/references/glossary.yml",
}
requests := make([]cliReferenceRequest, 0, len(sources))
for _, slot := range []string{"party", "players", "glossary", "spell_catalog"} {

View File

@@ -624,7 +624,7 @@ func productionSpellCatalogContractConfig(t *testing.T) string {
t.Helper()
partyPath := writeSharedReference(t, "party.yml", validPartyYAML)
glossaryPath := writeSharedReference(t, "glossary.json", validSharedGlossary)
catalogPath := filepath.Join(t.TempDir(), "spell-catalog.json")
catalogPath := filepath.Join(t.TempDir(), "spell-glossary.json")
if err := os.WriteFile(catalogPath, []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"spells":{"entries":[{"id":"aegis","name":"Aegis of Emberfall","category":"spell","aliases":["Emberfall Aegis"]}]}}}`), 0o600); err != nil {
t.Fatal(err)
}

View File

@@ -114,7 +114,7 @@ type recoveryFixture struct {
func newRecoveryFixture(t *testing.T) *recoveryFixture {
t.Helper()
root := t.TempDir()
for _, name := range []string{"prompts.yml", "transcript.json", "party.txt", "glossary.txt", "spell-catalog.json", "pipelines/dnd-session.yml", "pipelines/dnd-session.describe-session.yml"} {
for _, name := range []string{"prompts.yml", "transcript.json", "party.yml", "glossary.yml", "pipelines/dnd-session.yml", "pipelines/dnd-session.describe-session.yml"} {
content, err := os.ReadFile(repositoryPath("examples", "dnd-complete", name))
if err != nil {
t.Fatal(err)

View File

@@ -77,7 +77,7 @@ func TestMaterializedSpellCatalogOrderingPreservesSemanticContents(t *testing.T)
func TestConfiguredSpellCatalogBindingChangesResolvedPipelineIdentity(t *testing.T) {
base := productionSpellCatalogContractConfig(t)
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)
changed := strings.Replace(base, source, filepath.Join(t.TempDir(), "alternate-glossary.json"), 1)
if changed == base {
t.Fatal("production configuration did not contain the maintained catalog binding")
}