diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 22a3deee..1503f919 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -1731,6 +1731,26 @@ historical release/ADR/archive mentions rather than blindly deleting text matche ## Stage 36: Migrate The Maintained Minimal And Complete Examples +**Status:** Complete. The two version 6 examples now live in separate +`examples/dnd-minimal/` and `examples/dnd-complete/` directories with their own +transcripts and declaration-relative imports/references. Moved data fixtures +without changing their bytes and updated test consumers. Retired the old copyable +configurations/profile file. Minimal uses embedded resources only; complete uses +all D&D families, ordered generated references, optional domain auxiliaries, +native companion profile/backend inheritance, independent workers, and explicit +cache/mode/semantic-turn controls. The limited backend leaves native queue and +diagnostic defaults inherited; development profile/pipeline/overlay variants use +native customization and explicit zero semantic turns rather than repair wrappers. + +Both actual configurations and their pipelines pass native offline validation +without credentials, including the development variant and overlay. Maintained +fake-provider runs verify domain publication and source/contextual identity; +inspection tests verify companion isolation, inherited resources, and overlay +origins without provider work. Whole-tree tests, vet, build, repeated focused race +checks, direct executable validation, and `git diff --check` pass. No live model +or real credentials were used. Later assembled verification and documentation +stages remain pending. + **Goal:** two useful D&D configurations demonstrate the final native workflow. **Inspect/change:** `examples/dnd-{minimal,complete}.config.yml`, pipeline imports, diff --git a/examples/dnd-complete.config.yml b/examples/dnd-complete.config.yml deleted file mode 100644 index 87771e29..00000000 --- a/examples/dnd-complete.config.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 5 -config: - imports: - - path: pipelines/dnd-session.yml - required: true -promptkit: - profile_file: ./llm-profiles/dnd-extraction.yml - transient_retries: 2 -concurrency: - total_llm: 2 - stage_workers: - extract: 2 -output: - directory: ./notarius-output -cache: - chunk_plans: - mode: auto - directory: ./notarius-cache/chunk-plans - checkpoints: - enabled: true - directory: ./notarius-cache/checkpoints -debug: - directory: ./notarius-debug diff --git a/examples/dnd-complete/config.yml b/examples/dnd-complete/config.yml new file mode 100644 index 00000000..10a00847 --- /dev/null +++ b/examples/dnd-complete/config.yml @@ -0,0 +1,14 @@ +version: 6 +config: + imports: + - path: pipelines/dnd-session.yml + required: true +# This bounds ready pipeline jobs independently of native backend admission. +concurrency: + workers: 4 +output: + directory: ./notarius-output +cache_directory: ./notarius-cache +# A directory alone does not enable capture; select --debug when needed. +debug: + directory: ./notarius-debug diff --git a/examples/dnd-glossary.txt b/examples/dnd-complete/glossary.txt similarity index 100% rename from examples/dnd-glossary.txt rename to examples/dnd-complete/glossary.txt diff --git a/examples/dnd-complete/overlays/development.yml b/examples/dnd-complete/overlays/development.yml new file mode 100644 index 00000000..836a7a68 --- /dev/null +++ b/examples/dnd-complete/overlays/development.yml @@ -0,0 +1,11 @@ +# Invocation: --overlay development. These are application controls, not a +# replacement LLM scheduler or backend concurrency configuration. +concurrency: + workers: 1 +output: + directory: ../notarius-output-development +pipelines: + dnd-session: + llm_profile: notarius/dnd-extraction-development + max_additional_turns: 0 + cache: bypass diff --git a/examples/dnd-party.txt b/examples/dnd-complete/party.txt similarity index 100% rename from examples/dnd-party.txt rename to examples/dnd-complete/party.txt diff --git a/examples/pipelines/dnd-session.describe-session.yml b/examples/dnd-complete/pipelines/dnd-session.describe-session.yml similarity index 87% rename from examples/pipelines/dnd-session.describe-session.yml rename to examples/dnd-complete/pipelines/dnd-session.describe-session.yml index ffc346db..37c0fe80 100644 --- a/examples/pipelines/dnd-session.describe-session.yml +++ b/examples/dnd-complete/pipelines/dnd-session.describe-session.yml @@ -4,7 +4,6 @@ artifacts: item-registry: extract: module: dnd/item-registry - retries: 2 merge: module: appendorder normalize: @@ -12,25 +11,20 @@ artifacts: npc-registry: extract: module: dnd/npc-registry - retries: 2 merge: module: appendorder normalize: module: dnd/npc-registry - retries: 2 location-registry: extract: module: dnd/location-registry - retries: 2 merge: module: appendorder normalize: module: dnd/location-registry - retries: 2 scene-descriptions: extract: module: dnd/scene-descriptions - retries: 2 merge: module: appendorder normalize: diff --git a/examples/pipelines/dnd-session.yml b/examples/dnd-complete/pipelines/dnd-session.yml similarity index 86% rename from examples/pipelines/dnd-session.yml rename to examples/dnd-complete/pipelines/dnd-session.yml index c4010cab..08879b15 100644 --- a/examples/pipelines/dnd-session.yml +++ b/examples/dnd-complete/pipelines/dnd-session.yml @@ -6,18 +6,20 @@ config: placement: sequence-item pipelines: dnd-session: - llm_profile: dnd-extraction + llm_profile: notarius/dnd-extraction-example + mode: strict + max_additional_turns: 2 + cache: auto input: module: seriatim # Stable campaign context is shared by every module that accepts these slots. references: party: - path: ../dnd-party.txt + path: ../party.txt glossary: - path: ../dnd-glossary.txt + path: ../glossary.txt chunk: module: dnd/scenes - retries: 2 output: module: json options: @@ -60,7 +62,6 @@ pipelines: item-occurrences: extract: module: dnd/item-occurrences - retries: 2 merge: module: appendorder normalize: @@ -68,10 +69,9 @@ pipelines: spells: extract: module: dnd/spells - retries: 2 references: spell_catalog: - path: ../dnd-spell-catalog.json + path: ../spell-catalog.json merge: module: appendorder # Stage-local file references are intentionally bound at each stage. @@ -79,11 +79,10 @@ pipelines: module: dnd/spells references: spell_catalog: - path: ../dnd-spell-catalog.json + path: ../spell-catalog.json combat-turns: extract: module: dnd/combat-turns - retries: 2 merge: module: appendorder normalize: @@ -91,7 +90,6 @@ pipelines: npc-occurrences: extract: module: dnd/npc-occurrences - retries: 2 merge: module: appendorder normalize: @@ -99,7 +97,6 @@ pipelines: location-occurrences: extract: module: dnd/location-occurrences - retries: 2 merge: module: appendorder normalize: @@ -126,14 +123,14 @@ pipelines: enemy-events: extract: module: dnd/enemy-events - retries: 2 merge: module: appendorder normalize: module: dnd/enemy-events - # Development variant: disable PromptKit structural repairs while retaining - # the inherited steps and configured producer retry budgets. + # Inherit the full pipeline, select a native profile variant, and disable + # semantic continuation for a quick comparison. Structural repair stays native. dnd-session-development: extends: dnd-session - structured_output_repair_attempts: 0 + llm_profile: notarius/dnd-extraction-development + max_additional_turns: 0 diff --git a/examples/dnd-complete/prompts.yml b/examples/dnd-complete/prompts.yml new file mode 100644 index 00000000..7c912ea3 --- /dev/null +++ b/examples/dnd-complete/prompts.yml @@ -0,0 +1,15 @@ +# Native wrapperless settings, discovered beside this example's config.yml. +# Inherit the bundled backend without pinning its queue or diagnostic defaults. +backends: + - id: limited-openrouter + extends: {id: openrouter} + concurrency_limit: 2 +collections: + notarius: + profiles: + - id: dnd-extraction-example + extends: {id: dnd-extraction} + backend: limited-openrouter + - id: dnd-extraction-development + extends: {id: dnd-extraction-example} + temperature: 0.2 diff --git a/examples/dnd-spell-catalog.json b/examples/dnd-complete/spell-catalog.json similarity index 100% rename from examples/dnd-spell-catalog.json rename to examples/dnd-complete/spell-catalog.json diff --git a/examples/dnd-complete-transcript.json b/examples/dnd-complete/transcript.json similarity index 100% rename from examples/dnd-complete-transcript.json rename to examples/dnd-complete/transcript.json diff --git a/examples/dnd-minimal.config.yml b/examples/dnd-minimal/config.yml similarity index 77% rename from examples/dnd-minimal.config.yml rename to examples/dnd-minimal/config.yml index 704308c4..fbe4e2d6 100644 --- a/examples/dnd-minimal.config.yml +++ b/examples/dnd-minimal/config.yml @@ -1,7 +1,7 @@ -version: 5 +version: 6 pipelines: dnd-session: - llm_profile: dnd-extraction + llm_profile: notarius/dnd-extraction input: module: seriatim artifacts: diff --git a/examples/seriatim-minimal-transcript.json b/examples/dnd-minimal/transcript.json similarity index 100% rename from examples/seriatim-minimal-transcript.json rename to examples/dnd-minimal/transcript.json diff --git a/examples/llm-profiles/dnd-extraction.yml b/examples/llm-profiles/dnd-extraction.yml deleted file mode 100644 index ce0bd8fd..00000000 --- a/examples/llm-profiles/dnd-extraction.yml +++ /dev/null @@ -1,9 +0,0 @@ -profiles: - dnd-extraction: - backend: openrouter - model: openai/gpt-5.6-luna - timeout_seconds: 240 - service_tier: flex - dnd-extraction-development: - extends: dnd-extraction - temperature: 0.2 diff --git a/examples/overlays/development.yml b/examples/overlays/development.yml deleted file mode 100644 index c218f755..00000000 --- a/examples/overlays/development.yml +++ /dev/null @@ -1,8 +0,0 @@ -# This selects operational settings only; choose a different LLM profile with -# the pipeline's llm_profile field or the run command's --llm-profile flag. -concurrency: - total_llm: 1 - stage_workers: - extract: 1 -output: - directory: ./notarius-output-development diff --git a/internal/cli/assembled_enemy_event_codec_contract_test.go b/internal/cli/assembled_enemy_event_codec_contract_test.go index 88f85775..fbd99836 100644 --- a/internal/cli/assembled_enemy_event_codec_contract_test.go +++ b/internal/cli/assembled_enemy_event_codec_contract_test.go @@ -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) diff --git a/internal/cli/assembled_spell_pipeline_contract_test.go b/internal/cli/assembled_spell_pipeline_contract_test.go index 1dc1704c..31a58e69 100644 --- a/internal/cli/assembled_spell_pipeline_contract_test.go +++ b/internal/cli/assembled_spell_pipeline_contract_test.go @@ -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) diff --git a/internal/cli/dnd_enemy_events_contract_test.go b/internal/cli/dnd_enemy_events_contract_test.go index af49f573..d36218ff 100644 --- a/internal/cli/dnd_enemy_events_contract_test.go +++ b/internal/cli/dnd_enemy_events_contract_test.go @@ -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 diff --git a/internal/cli/dnd_scene_descriptions_contract_test.go b/internal/cli/dnd_scene_descriptions_contract_test.go index 97b6364c..f6c268d9 100644 --- a/internal/cli/dnd_scene_descriptions_contract_test.go +++ b/internal/cli/dnd_scene_descriptions_contract_test.go @@ -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) diff --git a/internal/cli/example_contract_test.go b/internal/cli/example_contract_test.go index ef5e4857..35e26586 100644 --- a/internal/cli/example_contract_test.go +++ b/internal/cli/example_contract_test.go @@ -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", diff --git a/internal/cli/npc_registry_contract_test.go b/internal/cli/npc_registry_contract_test.go index a83c0a8c..ce605575 100644 --- a/internal/cli/npc_registry_contract_test.go +++ b/internal/cli/npc_registry_contract_test.go @@ -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) diff --git a/internal/cli/production_contract_test.go b/internal/cli/production_contract_test.go index d6f9db51..e24ce0e5 100644 --- a/internal/cli/production_contract_test.go +++ b/internal/cli/production_contract_test.go @@ -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 { diff --git a/internal/cli/spell_catalog_correction_contract_test.go b/internal/cli/spell_catalog_correction_contract_test.go index 51d4d0b5..674de7c1 100644 --- a/internal/cli/spell_catalog_correction_contract_test.go +++ b/internal/cli/spell_catalog_correction_contract_test.go @@ -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) diff --git a/internal/cli/spell_catalog_identity_contract_test.go b/internal/cli/spell_catalog_identity_contract_test.go index 6eadb40c..94a8aaca 100644 --- a/internal/cli/spell_catalog_identity_contract_test.go +++ b/internal/cli/spell_catalog_identity_contract_test.go @@ -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()) } diff --git a/internal/cli/state_hardening_test.go b/internal/cli/state_hardening_test.go index 33472a57..1413a6e9 100644 --- a/internal/cli/state_hardening_test.go +++ b/internal/cli/state_hardening_test.go @@ -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{}, }