Load native PromptKit settings through application configuration version six

This commit is contained in:
2026-11-21 22:42:35 +00:00
parent bd30e86c0d
commit cc14a7a5cc
21 changed files with 210 additions and 485 deletions

View File

@@ -8,11 +8,11 @@ import (
configkit "go.maximumdirect.net/configkit"
)
func TestDocumentLoadAcceptsVersion5AndCanonicalShapes(t *testing.T) {
func TestDocumentLoadAcceptsVersion6AndCanonicalShapes(t *testing.T) {
t.Parallel()
for _, source := range []string{
`version: 5
`version: 6
pipelines:
session:
input:
@@ -41,7 +41,7 @@ pipelines:
extract:
module: dnd/locations
`,
`version: "5"
`version: "6"
pipelines:
session:
input:
@@ -70,8 +70,8 @@ func TestDocumentLoadRejectsUnsupportedVersionsBeforeDocumentDecoding(t *testing
{name: "missing", source: "unknown: value\n", code: configkit.CodeVersionError},
{name: "null", source: "version: null\nunknown: value\n", code: configkit.CodeVersionError},
{name: "version four", source: "version: 4\nunknown: value\n", code: configkit.CodeVersionError},
{name: "unsupported", source: "version: 6\nunknown: value\n", code: configkit.CodeVersionError},
{name: "noninteger", source: "version: 5.0\n", code: configkit.CodeVersionType},
{name: "version five", source: "version: 5\nunknown: value\n", code: configkit.CodeVersionError},
{name: "noninteger", source: "version: 6.0\n", code: configkit.CodeVersionType},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
@@ -102,19 +102,19 @@ func TestDocumentLoadRejectsShorthandAndUnknownFields(t *testing.T) {
}{
{
name: "binding shorthand",
source: "version: 5\npipelines:\n session:\n input: seriatim\n",
source: "version: 6\npipelines:\n session:\n input: seriatim\n",
code: configkit.CodeDecodeType,
path: "/pipelines/session/input",
},
{
name: "validator nested producer field",
source: "version: 5\npipelines:\n session:\n input:\n module: seriatim\n validators:\n - module: generic/valid_json\n validators: []\n",
source: "version: 6\npipelines:\n session:\n input:\n module: seriatim\n validators:\n - module: generic/valid_json\n validators: []\n",
code: configkit.CodeDecodeUnknownField,
path: "/pipelines/session/input/validators/0/validators",
},
{
name: "unknown field",
source: "version: 5\npipelines:\n session:\n input:\n module: seriatim\n unknown: true\n",
source: "version: 6\npipelines:\n session:\n input:\n module: seriatim\n unknown: true\n",
code: configkit.CodeDecodeUnknownField,
path: "/pipelines/session/input/unknown",
},
@@ -137,14 +137,14 @@ func TestDocumentLoadRejectsShorthandAndUnknownFields(t *testing.T) {
func TestDocumentDefinitionReturnsIndependentDefaults(t *testing.T) {
t.Parallel()
first, err := loadDocumentSource(configkit.Bytes("first.yml", []byte("version: 5\n")), LoadOptions{})
first, err := loadDocumentSource(configkit.Bytes("first.yml", []byte("version: 6\n")), LoadOptions{})
if err != nil {
t.Fatal(err)
}
first.Config.Pipelines["changed"] = PipelineDocument{}
first.Config.Concurrency.StageWorkers["extract"] = 3
second, err := loadDocumentSource(configkit.Bytes("second.yml", []byte("version: 5\n")), LoadOptions{})
second, err := loadDocumentSource(configkit.Bytes("second.yml", []byte("version: 6\n")), LoadOptions{})
if err != nil {
t.Fatal(err)
}