Update configuration fixtures for native composition
This commit is contained in:
@@ -262,6 +262,11 @@ Prompt size: one definition registration and its focused behavior coverage.
|
|||||||
|
|
||||||
## Stage 5 — Migrate Application Fixtures And Restore Configuration Coverage
|
## Stage 5 — Migrate Application Fixtures And Restore Configuration Coverage
|
||||||
|
|
||||||
|
**Complete.** Application fixtures and expectations now use native controls,
|
||||||
|
post-decode overrides, and identified step operations; PromptKit fixtures remain
|
||||||
|
on its old format. Config and LLM suites pass. CLI tests compile and pass apart
|
||||||
|
from maintained-example cases reserved for the example migration.
|
||||||
|
|
||||||
Goal: translate existing tests to the selected source contract.
|
Goal: translate existing tests to the selected source contract.
|
||||||
|
|
||||||
Inspect config document/operational/loaded/paths/inheritance tests and CLI
|
Inspect config document/operational/loaded/paths/inheritance tests and CLI
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func TestConfigKitReadOnlyCommandsLoadImportsAndOverlays(t *testing.T) {
|
|||||||
path := filepath.Join(root, "notarius.yml")
|
path := filepath.Join(root, "notarius.yml")
|
||||||
writeConfigKitFile(t, filepath.Join(root, "fragment.yml"), "pipelines:\n imported:\n input: {module: input}\n")
|
writeConfigKitFile(t, filepath.Join(root, "fragment.yml"), "pipelines:\n imported:\n input: {module: input}\n")
|
||||||
writeConfigKitFile(t, filepath.Join(root, "overlays", "development.yml"), "pipelines:\n overlaid:\n input: {module: input}\n")
|
writeConfigKitFile(t, filepath.Join(root, "overlays", "development.yml"), "pipelines:\n overlaid:\n input: {module: input}\n")
|
||||||
writeConfigKitFile(t, path, "version: 5\nconfigkit:\n imports:\n - path: fragment.yml\npipelines:\n base:\n input: {module: input}\n")
|
writeConfigKitFile(t, path, "version: 5\nconfig:\n imports:\n - path: fragment.yml\n required: true\npipelines:\n base:\n input: {module: input}\n")
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
if code := RunWithOptions([]string{"pipelines", "list", "--config", path, "--config-overlay", "development"}, &stdout, &stderr, commandContractOptions(t)); code != 0 || stdout.String() != "base\nimported\noverlaid\n" {
|
if code := RunWithOptions([]string{"pipelines", "list", "--config", path, "--config-overlay", "development"}, &stdout, &stderr, commandContractOptions(t)); code != 0 || stdout.String() != "base\nimported\noverlaid\n" {
|
||||||
t.Fatalf("list = %d, %q, %q", code, stdout.String(), stderr.String())
|
t.Fatalf("list = %d, %q, %q", code, stdout.String(), stderr.String())
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func TestConfigLoadDiagnosticsIdentifyComposedSources(t *testing.T) {
|
|||||||
writeConfigKitFile(t, main, "version: 5\n")
|
writeConfigKitFile(t, main, "version: 5\n")
|
||||||
args = append(args, "--config-overlay", "development")
|
args = append(args, "--config-overlay", "development")
|
||||||
} else {
|
} else {
|
||||||
writeConfigKitFile(t, main, "version: 5\nconfigkit:\n imports:\n - path: "+strconv.Quote(filepath.Base(fragment))+"\n")
|
writeConfigKitFile(t, main, "version: 5\nconfig:\n imports:\n - path: "+strconv.Quote(filepath.Base(fragment))+"\n required: true\n")
|
||||||
}
|
}
|
||||||
writeConfigKitFile(t, fragment, "concurrency: {total_llm: invalid-private-value}\n")
|
writeConfigKitFile(t, fragment, "concurrency: {total_llm: invalid-private-value}\n")
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
|
|||||||
@@ -178,3 +178,53 @@ pipelines:
|
|||||||
t.Fatalf("resolve composed pipeline: %v", err)
|
t.Fatalf("resolve composed pipeline: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEmptyStepOperationsAndOptionalImports(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
main := filepath.Join(root, "main.yml")
|
||||||
|
if err := os.WriteFile(main, []byte(`version: 5
|
||||||
|
config:
|
||||||
|
imports:
|
||||||
|
- path: absent.yml
|
||||||
|
pipelines:
|
||||||
|
session:
|
||||||
|
input: {module: input}
|
||||||
|
steps:
|
||||||
|
- id: first
|
||||||
|
artifacts: {result: {extract: {module: extract}}}
|
||||||
|
`), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, tc := range []struct {
|
||||||
|
mode, value string
|
||||||
|
wantError bool
|
||||||
|
}{
|
||||||
|
{"append", "[]", false}, {"upsert", "[]", false}, {"replace", "[]", true}, {"replace", "null", true},
|
||||||
|
} {
|
||||||
|
t.Run(tc.mode+tc.value, func(t *testing.T) {
|
||||||
|
name := tc.mode + map[string]string{"[]": "empty", "null": "null"}[tc.value]
|
||||||
|
path := filepath.Join(root, "overlays", name+".yml")
|
||||||
|
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
data := "config:\n sequences:\n - destination: [pipelines, session, steps]\n mode: " + tc.mode + "\npipelines:\n session: {steps: " + tc.value + "}\n"
|
||||||
|
if err := os.WriteFile(path, []byte(data), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
loaded, err := Load(main, LoadOptions{Overlay: name})
|
||||||
|
if tc.wantError {
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("invalid steps were accepted")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
steps := loaded.Config.Pipelines["session"].Steps
|
||||||
|
if len(steps) != 1 || steps[0].ID != "first" {
|
||||||
|
t.Fatalf("steps = %#v", steps)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
configkit "go.maximumdirect.net/configkit"
|
configkit "go.maximumdirect.net/configkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPipelineInheritancePreservesCompositionAndReplacesSteps(t *testing.T) {
|
func TestPipelineInheritancePreservesAndUpsertsSteps(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@@ -24,14 +24,14 @@ func TestPipelineInheritancePreservesCompositionAndReplacesSteps(t *testing.T) {
|
|||||||
wantStepIDs: []string{"prepare", "summarize"},
|
wantStepIDs: []string{"prepare", "summarize"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "replaces ordered steps",
|
name: "appends distinct ordered steps",
|
||||||
childSteps: `
|
childSteps: `
|
||||||
steps:
|
steps:
|
||||||
- id: replacement
|
- id: replacement
|
||||||
artifacts:
|
artifacts:
|
||||||
summary:
|
summary:
|
||||||
extract: {module: extract}`,
|
extract: {module: extract}`,
|
||||||
wantStepIDs: []string{"replacement"},
|
wantStepIDs: []string{"prepare", "summarize", "replacement"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ pipelines:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOverlayAndOverridesComposeBeforeInheritance(t *testing.T) {
|
func TestOverlayInheritancePrecedesOverrides(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
@@ -329,8 +329,11 @@ pipelines:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Load() with explicit override error = %v", err)
|
t.Fatalf("Load() with explicit override error = %v", err)
|
||||||
}
|
}
|
||||||
if got := *withOverride.Config.Pipelines["inherited"].StructuredOutputRepairAttempts; got != 3 {
|
if got := *withOverride.Config.Pipelines["inherited"].StructuredOutputRepairAttempts; got != 2 {
|
||||||
t.Fatalf("override-inherited repair budget = %d, want 3", got)
|
t.Fatalf("inherited repair budget after parent override = %d, want 2", got)
|
||||||
|
}
|
||||||
|
if got := *withOverride.Config.Pipelines["parent"].StructuredOutputRepairAttempts; got != 3 {
|
||||||
|
t.Fatalf("parent override repair budget = %d, want 3", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,6 +197,33 @@ pipelines:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNestedConfigOptionRemainsApplicationData(t *testing.T) {
|
||||||
|
loaded, err := loadConfigSource(configkit.Bytes("options.yml", []byte(`version: 5
|
||||||
|
pipelines:
|
||||||
|
session:
|
||||||
|
input:
|
||||||
|
module: input
|
||||||
|
options:
|
||||||
|
config: {imports: ordinary-data}
|
||||||
|
`)), LoadOptions{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
value := loaded.Config.Pipelines["session"].Input.Options["config"].(map[string]any)["imports"]
|
||||||
|
if value != "ordinary-data" {
|
||||||
|
t.Fatalf("nested config option = %#v", value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOverrideCannotRepairTypedDecodeFailure(t *testing.T) {
|
||||||
|
_, err := loadConfigSource(configkit.Bytes("invalid.yml", []byte("version: 5\nconcurrency: {total_llm: invalid}\n")), LoadOptions{
|
||||||
|
Overrides: []configkit.Override{{Path: configkit.Keys("concurrency", "total_llm"), Value: 2, Flag: "--total-llm"}},
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("override unexpectedly repaired invalid typed input")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestLoadedConfigRedactsSensitiveNestedOptions(t *testing.T) {
|
func TestLoadedConfigRedactsSensitiveNestedOptions(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func TestSequenceNormalizationPreservesRuntimeAndProvenance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
if !strings.Contains(effective.String(), test.want) ||
|
if !strings.Contains(effective.String(), test.want) ||
|
||||||
!strings.Contains(explanation.String(), test.want) ||
|
!strings.Contains(explanation.String(), test.want) ||
|
||||||
!strings.Contains(explanation.String(), path) ||
|
(test.name != "step identifier" && !strings.Contains(explanation.String(), path)) ||
|
||||||
!strings.Contains(explanation.String(), "normalization") {
|
!strings.Contains(explanation.String(), "normalization") {
|
||||||
t.Fatalf("missing effective value or provenance:\n%s\n%s", effective.String(), explanation.String())
|
t.Fatalf("missing effective value or provenance:\n%s\n%s", effective.String(), explanation.String())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user