Migrate maintained D&D examples to native configuration
This commit is contained in:
@@ -52,7 +52,7 @@ func TestAssembledEnemyEventLaneRejectsInvalidFinalArtifactDespiteValidatorOverr
|
||||
}
|
||||
_, err = pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if err == nil || !strings.Contains(err.Error(), "encode dnd enemy event list") || !strings.Contains(err.Error(), "must not exceed") {
|
||||
t.Fatalf("Run() error = %v, want final durable range rejection", err)
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestAssembledSpellPipelineNormalizesMergedCasts(t *testing.T) {
|
||||
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Run() error = %v, want nil", err)
|
||||
@@ -106,7 +106,7 @@ func TestAssembledSpellPipelineCorrectsRejectedDirectExtraction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{Prepared: prepared, RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json")})
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{Prepared: prepared, RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json")})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func TestAssembledSpellPipelineHonorsNormalizeValidatorOverride(t *testing.T) {
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if err != nil || output.FallbackCount != 0 || len(output.OutputFiles) != 1 {
|
||||
t.Fatalf("Run() error = %v output = %#v, want approved override run", err, output)
|
||||
@@ -173,7 +173,7 @@ func TestAssembledSpellPipelineRejectsUnknownSpellDuringNormalization(t *testing
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{Prepared: prepared, RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json")})
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{Prepared: prepared, RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json")})
|
||||
for _, fragment := range []string{"normalize", `lane "spells"`, "extract/dnd/spells/catalog"} {
|
||||
if err == nil || !strings.Contains(err.Error(), fragment) {
|
||||
t.Fatalf("error=%v, want scoped catalog rejection (%s)", err, fragment)
|
||||
@@ -192,7 +192,7 @@ func TestAssembledSpellPipelinePromotesUnknownSpellAdvisoryWhenOverrideAccepts(t
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Run() error = %v, want nil", err)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
func TestProductionEnemyEventConfigurationResolvesGeneratedHandoffs(t *testing.T) {
|
||||
components := productionTestComponents(t)
|
||||
configPath := writeEnemyEventContractConfig(t)
|
||||
configPath := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
loaded, err := config.Load(configPath, config.LoadOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -83,15 +83,16 @@ func TestProductionEnemyEventConfigurationResolvesGeneratedHandoffs(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestNativeOrderedDNDRunPublishesRegistryBackedEntityOccurrences(t *testing.T) {
|
||||
configPath := writeEnemyEventContractConfig(t)
|
||||
func TestMaintainedCompleteInvocationPublishesRegistryBackedEntityOccurrences(t *testing.T) {
|
||||
t.Setenv("OPENROUTER_API_KEY", "notarius-test-credential")
|
||||
configPath := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
outputRoot := filepath.Join(t.TempDir(), "output")
|
||||
client := &enemyEventLLMClient{}
|
||||
options := productionRunOptions(t, client)
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"run", "dnd-session", "--config", configPath,
|
||||
"--input-file", repositoryPath("examples", "dnd-complete-transcript.json"),
|
||||
"--input-file", repositoryPath("examples", "dnd-complete", "transcript.json"),
|
||||
"--cache", "bypass", "--output-dir", outputRoot,
|
||||
"--llm-session-id", "enemy-event-session", "--format", "json",
|
||||
}, &stdout, &stderr, options)
|
||||
@@ -188,83 +189,6 @@ func TestNativeOrderedDNDRunPublishesRegistryBackedEntityOccurrences(t *testing.
|
||||
}
|
||||
}
|
||||
|
||||
func writeEnemyEventContractConfig(t *testing.T) string {
|
||||
t.Helper()
|
||||
return writeProductionContractConfig(t, fmt.Sprintf(`version: 6
|
||||
pipelines:
|
||||
dnd-session:
|
||||
cache: bypass
|
||||
input: {module: seriatim}
|
||||
chunk: {module: dnd/scenes}
|
||||
references:
|
||||
party: {path: %q}
|
||||
glossary: {path: %q}
|
||||
output:
|
||||
module: json
|
||||
options:
|
||||
include_chunk_map: true
|
||||
evidence_context:
|
||||
enabled: true
|
||||
window_units: 3
|
||||
lanes: [item-occurrences, item-registry, location-registry, location-occurrences, npc-registry, spells, combat-turns, npc-occurrences, enemy-events]
|
||||
steps:
|
||||
- id: describe-session
|
||||
artifacts:
|
||||
item-registry:
|
||||
extract: {module: dnd/item-registry}
|
||||
normalize: {module: dnd/item-registry}
|
||||
npc-registry:
|
||||
extract: {module: dnd/npc-registry}
|
||||
normalize: {module: dnd/npc-registry}
|
||||
location-registry:
|
||||
extract: {module: dnd/location-registry}
|
||||
normalize: {module: dnd/location-registry}
|
||||
scene-descriptions:
|
||||
extract: {module: dnd/scene-descriptions}
|
||||
normalize: {module: dnd/scene-descriptions}
|
||||
- id: extract-events
|
||||
references:
|
||||
location_registry: {artifact: {step: describe-session, lane: location-registry}}
|
||||
npc_registry: {artifact: {step: describe-session, lane: npc-registry}}
|
||||
scene_descriptions: {artifact: {step: describe-session, lane: scene-descriptions}}
|
||||
item_registry: {artifact: {step: describe-session, lane: item-registry}}
|
||||
artifacts:
|
||||
item-occurrences:
|
||||
extract: {module: dnd/item-occurrences}
|
||||
normalize: {module: dnd/item-occurrences}
|
||||
spells:
|
||||
extract:
|
||||
module: dnd/spells
|
||||
references:
|
||||
spell_catalog: {path: %q}
|
||||
normalize:
|
||||
module: dnd/spells
|
||||
references:
|
||||
spell_catalog: {path: %q}
|
||||
combat-turns:
|
||||
extract: {module: dnd/combat-turns}
|
||||
normalize: {module: dnd/combat-turns}
|
||||
npc-occurrences:
|
||||
extract: {module: dnd/npc-occurrences}
|
||||
normalize: {module: dnd/npc-occurrences}
|
||||
location-occurrences:
|
||||
extract: {module: dnd/location-occurrences}
|
||||
normalize: {module: dnd/location-occurrences}
|
||||
- id: track-enemies
|
||||
references:
|
||||
npc_registry: {artifact: {step: describe-session, lane: npc-registry}}
|
||||
scene_descriptions: {artifact: {step: describe-session, lane: scene-descriptions}}
|
||||
combat_turns: {artifact: {step: extract-events, lane: combat-turns}}
|
||||
npc_occurrences: {artifact: {step: extract-events, lane: npc-occurrences}}
|
||||
artifacts:
|
||||
enemy-events:
|
||||
extract: {module: dnd/enemy-events}
|
||||
normalize: {module: dnd/enemy-events}
|
||||
`+productionProviderConfiguration,
|
||||
repositoryPath("examples", "dnd-party.txt"), repositoryPath("examples", "dnd-glossary.txt"),
|
||||
repositoryPath("examples", "dnd-spell-catalog.json"), repositoryPath("examples", "dnd-spell-catalog.json")))
|
||||
}
|
||||
|
||||
type enemyEventLLMClient struct {
|
||||
mu sync.Mutex
|
||||
requests []promptkit.GenerateRequest
|
||||
|
||||
@@ -51,7 +51,7 @@ func TestProductionSceneDescriptionWorkflow(t *testing.T) {
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Run() error = %v", err)
|
||||
|
||||
@@ -3,9 +3,11 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -20,6 +22,8 @@ import (
|
||||
locationnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/locationregistry"
|
||||
spellnormalize "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/normalize/spells"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/seriatim/input/transcript"
|
||||
"go.maximumdirect.net/commandkit"
|
||||
"go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
func TestMaintainedExamplesLoadResolveAndList(t *testing.T) {
|
||||
@@ -28,8 +32,8 @@ func TestMaintainedExamplesLoadResolveAndList(t *testing.T) {
|
||||
for _, example := range maintainedExampleFiles(t) {
|
||||
t.Run(example.name, func(t *testing.T) {
|
||||
cfg := loadMaintainedExample(t, example.path)
|
||||
if example.name == "complete" && cfg.Concurrency.Workers != 2 {
|
||||
t.Fatalf("complete example concurrency = %#v, want an explicit shared worker limit of 2", cfg.Concurrency)
|
||||
if example.name == "complete" && cfg.Concurrency.Workers != 4 {
|
||||
t.Fatalf("complete example concurrency = %#v, want four shared workers independent of backend admission", cfg.Concurrency)
|
||||
}
|
||||
raw, err := os.ReadFile(example.transcriptPath)
|
||||
if err != nil {
|
||||
@@ -59,6 +63,9 @@ func TestMaintainedExamplesLoadResolveAndList(t *testing.T) {
|
||||
}
|
||||
if example.name == "complete" {
|
||||
if pipelineID == "dnd-session-development" {
|
||||
if materialized.ChunkControls.MaxAdditionalTurns != 0 || materialized.Chunk.LLMProfile != "notarius/dnd-extraction-development" {
|
||||
t.Fatalf("development native controls=%#v profile=%q", materialized.ChunkControls, materialized.Chunk.LLMProfile)
|
||||
}
|
||||
parent, found := completePipelines["dnd-session"]
|
||||
if !found {
|
||||
t.Fatal("complete parent pipeline was not resolved before its development variant")
|
||||
@@ -137,56 +144,104 @@ func TestMaintainedExamplesLoadResolveAndList(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaintainedConfigurationExampleSet(t *testing.T) {
|
||||
entries, err := os.ReadDir(repositoryPath("examples"))
|
||||
func TestMaintainedExamplesIsolateCompanionsAndInheritNativeResources(t *testing.T) {
|
||||
client := &productionFakeLLMClient{}
|
||||
loaders := &nativeLoaders{lookupEnv: emptyLookup, engineOptions: []promptkit.Option{promptkit.WithLLMClient(client)}}
|
||||
ctx := context.Background()
|
||||
completePath := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
complete, err := loaders.engine(ctx, nativeSelection(completePath))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var names []string
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".config.yml") {
|
||||
names = append(names, entry.Name())
|
||||
base, err := complete.InspectProfile(ctx, "notarius/dnd-extraction")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
example, err := complete.InspectProfile(ctx, "notarius/dnd-extraction-example")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
development, err := complete.InspectProfile(ctx, "notarius/dnd-extraction-development")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, profile := range []*promptkit.ProfileInspection{example, development} {
|
||||
if !reflect.DeepEqual(profile.Model, base.Model) || !reflect.DeepEqual(profile.TimeoutSeconds, base.TimeoutSeconds) || !reflect.DeepEqual(profile.ServiceTier, base.ServiceTier) || profile.Backend == nil || *profile.Backend != "limited-openrouter" {
|
||||
t.Fatalf("inherited profile=%#v, embedded parent=%#v", profile, base)
|
||||
}
|
||||
}
|
||||
sort.Strings(names)
|
||||
if got := strings.Join(names, ","); got != "dnd-complete.config.yml,dnd-minimal.config.yml" {
|
||||
t.Fatalf("maintained configuration examples = %q, want only the minimal and complete D&D examples", got)
|
||||
if development.Temperature == nil || *development.Temperature != 0.2 || !reflect.DeepEqual(example.Temperature, base.Temperature) {
|
||||
t.Fatalf("development customization leaked into parent: %#v %#v", development, example)
|
||||
}
|
||||
bundled, err := complete.InspectBackend(ctx, "openrouter")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
limited, err := complete.InspectBackend(ctx, "limited-openrouter")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if limited.ConcurrencyLimit == nil || *limited.ConcurrencyLimit != 2 || limited.Endpoint != bundled.Endpoint || !reflect.DeepEqual(limited.APIKeyEnv, bundled.APIKeyEnv) || !reflect.DeepEqual(limited.SmokeTests, bundled.SmokeTests) {
|
||||
t.Fatalf("limited backend=%#v, bundled parent=%#v", limited, bundled)
|
||||
}
|
||||
minimal, err := loaders.engine(ctx, nativeSelection(repositoryPath("examples", "dnd-minimal", "config.yml")))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := minimal.InspectProfile(ctx, "notarius/dnd-extraction-example"); !errors.Is(err, promptkit.ErrProfileNotFound) {
|
||||
t.Fatalf("complete example profile leaked into minimal selection: %v", err)
|
||||
}
|
||||
if _, err := minimal.InspectBackend(ctx, "limited-openrouter"); !errors.Is(err, promptkit.ErrBackendNotFound) {
|
||||
t.Fatalf("complete example backend leaked into minimal selection: %v", err)
|
||||
}
|
||||
if len(client.requestsSnapshot()) != 0 {
|
||||
t.Fatal("example inspection called provider")
|
||||
}
|
||||
}
|
||||
|
||||
overlayEntries, err := os.ReadDir(repositoryPath("examples", "overlays"))
|
||||
func TestMaintainedDevelopmentOverlayResolvesNativeControlsAndRelativeOutput(t *testing.T) {
|
||||
path := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
selection := nativeSelection(path)
|
||||
selection.Overlay = commandkit.Supplied[string]{Set: true, Value: "development"}
|
||||
loaders := &nativeLoaders{lookupEnv: emptyLookup}
|
||||
result, err := loaders.application(context.Background(), selection)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
names = names[:0]
|
||||
for _, entry := range overlayEntries {
|
||||
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".yml") {
|
||||
names = append(names, entry.Name())
|
||||
}
|
||||
}
|
||||
sort.Strings(names)
|
||||
if got := strings.Join(names, ","); got != "development.yml" {
|
||||
t.Fatalf("maintained configuration overlays = %q, want development.yml", got)
|
||||
}
|
||||
llmProfiles, err := os.ReadDir(repositoryPath("examples", "llm-profiles"))
|
||||
loaded, err := config.FromResult(result)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(llmProfiles) != 1 || llmProfiles[0].Name() != "dnd-extraction.yml" {
|
||||
t.Fatalf("maintained LLM profile files = %#v, want the single combined profile file", llmProfiles)
|
||||
cfg := loaded.RuntimeConfig()
|
||||
if cfg.Concurrency.Workers != 1 || cfg.Output.Directory != filepath.Join(filepath.Dir(path), "notarius-output-development") {
|
||||
t.Fatalf("development application controls=%#v %#v", cfg.Concurrency, cfg.Output)
|
||||
}
|
||||
resolved, err := cfg.Resolve(resolveInputForMaintainedExample(productionTestComponents(t), "dnd-session"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if resolved.ResolvedPipeline.Chunk.LLMProfile != "notarius/dnd-extraction-development" || resolved.ResolvedPipeline.ChunkControls != (contracts.ProducerControls{Mode: contracts.ModeStrict, MaxAdditionalTurns: 0, Cache: contracts.CacheBypass}) {
|
||||
t.Fatalf("development chunk selection=%#v controls=%#v", resolved.ResolvedPipeline.Chunk, resolved.ResolvedPipeline.ChunkControls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaintainedExamplesValidateEffectiveProfilesOffline(t *testing.T) {
|
||||
t.Chdir(repositoryPath())
|
||||
t.Setenv("OPENROUTER_API_KEY", "")
|
||||
client := &productionFakeLLMClient{}
|
||||
options := Options{LLMClient: client}
|
||||
for _, example := range maintainedExampleFiles(t) {
|
||||
t.Run(example.name, func(t *testing.T) {
|
||||
var configOut, configErr strings.Builder
|
||||
if code := RunWithOptions([]string{"config", "validate", "--config", example.path}, &configOut, &configErr, options); code != 0 {
|
||||
t.Fatalf("configuration validation: status=%d stdout=%q stderr=%q", code, configOut.String(), configErr.String())
|
||||
}
|
||||
for _, pipelineID := range example.pipelineIDs {
|
||||
t.Run(pipelineID, func(t *testing.T) {
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"pipeline", "validate", pipelineID, "--config", example.path,
|
||||
}, &stdout, &stderr, Options{})
|
||||
}, &stdout, &stderr, options)
|
||||
if code != 0 || stderr.Len() != 0 || !strings.Contains(stdout.String(), pipelineID) {
|
||||
t.Fatalf("code=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
@@ -198,11 +253,14 @@ func TestMaintainedExamplesValidateEffectiveProfilesOffline(t *testing.T) {
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"promptkit", "show", "profile", "notarius/dnd-extraction-development",
|
||||
"--config", repositoryPath("examples", "dnd-complete.config.yml"), "--format", "json",
|
||||
}, &stdout, &stderr, Options{})
|
||||
"--config", repositoryPath("examples", "dnd-complete", "config.yml"), "--format", "json",
|
||||
}, &stdout, &stderr, options)
|
||||
if code != 0 || stderr.Len() != 0 || !json.Valid([]byte(stdout.String())) || !strings.Contains(stdout.String(), "dnd-extraction-development") {
|
||||
t.Fatalf("development profile inspection: status=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
if len(client.requestsSnapshot()) != 0 {
|
||||
t.Fatal("offline example validation or inspection called provider")
|
||||
}
|
||||
}
|
||||
|
||||
func exampleStepLaneIDs(resolved pipeline.ResolvedPipeline) []string {
|
||||
@@ -244,7 +302,8 @@ func generatedReferenceBindingDescriptions(resolved pipeline.ResolvedPipeline) [
|
||||
}
|
||||
|
||||
func TestMaintainedMinimalInvocationPublishesDomainArtifacts(t *testing.T) {
|
||||
cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-minimal.config.yml"))
|
||||
t.Setenv("OPENROUTER_API_KEY", "notarius-test-credential")
|
||||
cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-minimal", "config.yml"))
|
||||
resolved, err := cfg.Resolve(resolveInputForMaintainedExample(productionTestComponents(t), "dnd-session"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -259,8 +318,8 @@ func TestMaintainedMinimalInvocationPublishesDomainArtifacts(t *testing.T) {
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"run", "dnd-session",
|
||||
"--config", repositoryPath("examples", "dnd-minimal.config.yml"),
|
||||
"--input-file", repositoryPath("examples", "seriatim-minimal-transcript.json"),
|
||||
"--config", repositoryPath("examples", "dnd-minimal", "config.yml"),
|
||||
"--input-file", repositoryPath("examples", "dnd-minimal", "transcript.json"),
|
||||
"--lane", "spells", "--cache", "bypass", "--output-dir", outputRoot, "--format", "json",
|
||||
}, &stdout, &stderr, options)
|
||||
if code != 0 {
|
||||
@@ -301,7 +360,7 @@ func TestMaintainedMalformedInputOnlyRecordsDebugFailureWhenRequested(t *testing
|
||||
options := productionRunOptions(t, client)
|
||||
args := []string{
|
||||
"run", "dnd-session",
|
||||
"--config", repositoryPath("examples", "dnd-minimal.config.yml"),
|
||||
"--config", repositoryPath("examples", "dnd-minimal", "config.yml"),
|
||||
"--input-file", malformed, "--cache", "bypass", "--output-dir", outputRoot,
|
||||
}
|
||||
if debug {
|
||||
@@ -340,7 +399,7 @@ func resolveInputForMaintainedExample(components productionComponents, pipelineI
|
||||
}
|
||||
|
||||
func TestCompleteDNDSharedCLIReferencesExpandAcrossCompatibleTargets(t *testing.T) {
|
||||
cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-complete.config.yml"))
|
||||
cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-complete", "config.yml"))
|
||||
catalog := catalogFromRegistries(productionTestComponents(t).registries)
|
||||
sources := map[string]string{
|
||||
"party": "/references/party.txt",
|
||||
|
||||
@@ -34,7 +34,7 @@ pipelines:
|
||||
configPath := writeProductionContractConfig(t, content)
|
||||
client := &productionFakeLLMClient{}
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configPath, "--input-file", repositoryPath("examples", "seriatim-minimal-transcript.json")}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configPath, "--input-file", repositoryPath("examples", "dnd-minimal", "transcript.json")}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
for _, fragment := range []string{`pipeline "dnd-session"`, `reference slot "npc_registry"`, "1048577 bytes", "limit 1048576"} {
|
||||
if code == 0 || !strings.Contains(stderr.String(), fragment) {
|
||||
t.Fatalf("status=%d stderr=%q, want %q", code, stderr.String(), fragment)
|
||||
|
||||
@@ -388,14 +388,14 @@ func TestProductionSpellNormalizerRejectsInvalidCatalogReferencesBeforeExecution
|
||||
t.Fatal(err)
|
||||
}
|
||||
content := productionSpellCatalogContractConfig(t)
|
||||
catalogSource := repositoryPath("examples", "dnd-spell-catalog.json")
|
||||
catalogSource := repositoryPath("examples", "dnd-complete", "spell-catalog.json")
|
||||
content = strings.Replace(content, catalogSource, "__extract_catalog__", 1)
|
||||
content = replaceRequiredOnce(t, content, catalogSource, catalogPath)
|
||||
content = replaceRequiredOnce(t, content, "__extract_catalog__", catalogSource)
|
||||
configFile := writeProductionContractConfig(t, content)
|
||||
client := &productionFakeLLMClient{}
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configFile, "--input-file", repositoryPath("examples", "seriatim-minimal-transcript.json"), "--cache", "bypass"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configFile, "--input-file", repositoryPath("examples", "dnd-minimal", "transcript.json"), "--cache", "bypass"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
for _, fragment := range []string{"normalize", `lane "spells"`, `reference slot "spell_catalog"`, "1048577 bytes", "limit 1048576"} {
|
||||
if code == 0 || !strings.Contains(stderr.String(), fragment) {
|
||||
t.Fatalf("status=%d stderr=%q, want %q", code, stderr.String(), fragment)
|
||||
@@ -565,7 +565,7 @@ func TestProductionSceneRunPublishesAnnotationFreeChunkPlan(t *testing.T) {
|
||||
path := writeProductionContractConfig(t, productionRunConfig(outputRoot, "dnd/scenes"))
|
||||
client := &productionFakeLLMClient{}
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", path, "--input-file", repositoryPath("examples", "seriatim-minimal-transcript.json"), "--cache", "bypass", "--llm-session-id", "offline-session", "--format", "json"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", path, "--input-file", repositoryPath("examples", "dnd-minimal", "transcript.json"), "--cache", "bypass", "--llm-session-id", "offline-session", "--format", "json"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
if code != 0 {
|
||||
t.Fatalf("status=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
@@ -615,8 +615,8 @@ type maintainedExample struct {
|
||||
func maintainedExampleFiles(t *testing.T) []maintainedExample {
|
||||
t.Helper()
|
||||
return []maintainedExample{
|
||||
{name: "minimal", path: repositoryPath("examples", "dnd-minimal.config.yml"), transcriptPath: repositoryPath("examples", "seriatim-minimal-transcript.json"), pipelineIDs: []string{"dnd-session"}},
|
||||
{name: "complete", path: repositoryPath("examples", "dnd-complete.config.yml"), transcriptPath: repositoryPath("examples", "dnd-complete-transcript.json"), pipelineIDs: []string{"dnd-session", "dnd-session-development"}},
|
||||
{name: "minimal", path: repositoryPath("examples", "dnd-minimal", "config.yml"), transcriptPath: repositoryPath("examples", "dnd-minimal", "transcript.json"), pipelineIDs: []string{"dnd-session"}},
|
||||
{name: "complete", path: repositoryPath("examples", "dnd-complete", "config.yml"), transcriptPath: repositoryPath("examples", "dnd-complete", "transcript.json"), pipelineIDs: []string{"dnd-session", "dnd-session-development"}},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@ pipelines:
|
||||
references:
|
||||
spell_catalog:
|
||||
path: %q
|
||||
`, repositoryPath("examples", "dnd-party.txt"), repositoryPath("examples", "dnd-glossary.txt"), repositoryPath("examples", "dnd-spell-catalog.json"), repositoryPath("examples", "dnd-spell-catalog.json"))
|
||||
`, repositoryPath("examples", "dnd-complete", "party.txt"), repositoryPath("examples", "dnd-complete", "glossary.txt"), repositoryPath("examples", "dnd-complete", "spell-catalog.json"), repositoryPath("examples", "dnd-complete", "spell-catalog.json"))
|
||||
}
|
||||
|
||||
func writeProductionSpellCatalogContractConfig(t *testing.T) string {
|
||||
|
||||
@@ -78,7 +78,7 @@ func TestProductionSpellCatalogValidationCoordinatesCorrections(t *testing.T) {
|
||||
}
|
||||
output, err := pipeline.New().Run(context.Background(), pipeline.RunInput{
|
||||
Prepared: prepared,
|
||||
RawInput: readRepositoryFile(t, "examples", "seriatim-minimal-transcript.json"),
|
||||
RawInput: readRepositoryFile(t, "examples", "dnd-minimal", "transcript.json"),
|
||||
})
|
||||
if calls := llmClient.CallCount(); calls > additionalTurns+1 || calls != tt.wantCalls {
|
||||
t.Fatalf("LLM calls = %d, want %d and no more than %d", calls, tt.wantCalls, additionalTurns+1)
|
||||
|
||||
@@ -76,7 +76,7 @@ func TestMaterializedSpellCatalogOrderingPreservesSemanticContents(t *testing.T)
|
||||
|
||||
func TestConfiguredSpellCatalogBindingChangesResolvedPipelineIdentity(t *testing.T) {
|
||||
base := productionSpellCatalogContractConfig(t)
|
||||
changed := strings.Replace(base, repositoryPath("examples", "dnd-spell-catalog.json"), filepath.Join(t.TempDir(), "alternate-spell-catalog.json"), 1)
|
||||
changed := strings.Replace(base, repositoryPath("examples", "dnd-complete", "spell-catalog.json"), filepath.Join(t.TempDir(), "alternate-spell-catalog.json"), 1)
|
||||
if changed == base {
|
||||
t.Fatal("production configuration did not contain the maintained catalog binding")
|
||||
}
|
||||
@@ -108,7 +108,7 @@ func TestProductionOverlayRunAlignsGroundingAndValidation(t *testing.T) {
|
||||
client := &productionFakeLLMClient{spellResponse: productionSpellResponse("Aegis of Emberfall")}
|
||||
configPath := writeProductionContractConfig(t, productionSpellCatalogContractConfig(t)+productionProviderConfiguration)
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configPath, "--input-file", repositoryPath("examples", "seriatim-minimal-transcript.json"), "--lane", "spells", "--cache", "bypass", "--output-dir", outputRoot, "--format", "json"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
code := RunWithOptions([]string{"run", "dnd-session", "--config", configPath, "--input-file", repositoryPath("examples", "dnd-minimal", "transcript.json"), "--lane", "spells", "--cache", "bypass", "--output-dir", outputRoot, "--format", "json"}, &stdout, &stderr, productionRunOptions(t, client))
|
||||
if code != 0 {
|
||||
t.Fatalf("status=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func newStateRunFixture(t *testing.T) *stateRunFixture {
|
||||
root := t.TempDir()
|
||||
fixture := &stateRunFixture{
|
||||
configPath: filepath.Join(root, "config.yml"),
|
||||
inputPath: repositoryPath("examples", "seriatim-minimal-transcript.json"),
|
||||
inputPath: repositoryPath("examples", "dnd-minimal", "transcript.json"),
|
||||
outputRoot: filepath.Join(root, "output"), cacheRoot: filepath.Join(root, "cache"), debugRoot: filepath.Join(root, "debug"),
|
||||
client: &productionFakeLLMClient{},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user