From e5475ea7f8c294439671bd133b3be23a2865cb78 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Mon, 2 Nov 2026 00:44:33 +0000 Subject: [PATCH] Update consumer examples for document-root controls --- docs/roadmap/implementation.md | 2 ++ examples/consumers/config_controls_test.go | 26 +++++++++++++++++++ examples/consumers/sequence_catalog_test.go | 4 +-- .../collections/weather/collection.yml | 2 +- .../collections/weather/metadata.yml | 2 +- .../collections/weather/profiles/index.yml | 2 +- .../collections/weather/prompts/index.yml | 2 +- .../layered-bundle/defaults/config.yml | 2 +- .../consumers/testdata/narratio/pipeline.yml | 2 +- .../testdata/notarius-paths/main.yml | 2 +- .../testdata/ordinary-imports/config.yml | 2 +- .../testdata/prompt-catalog/config.yml | 2 +- .../testdata/prompt-catalog/invalid.yml | 2 +- .../prompt-catalog/prompts/curated.yml | 2 +- .../testdata/prompt-catalog/simple.yml | 2 +- .../testdata/sequence-catalog/config.yml | 2 +- .../sequence-catalog/overlays/append.yml | 2 +- .../sequence-catalog/overlays/replace.yml | 2 +- .../sequence-catalog/overlays/upsert.yml | 2 +- .../testdata/sequence-catalog/underlay.yml | 2 +- 20 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 examples/consumers/config_controls_test.go diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 25a56df..62c859e 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -265,6 +265,8 @@ application `config` data. ## Stage 8 — Migrate maintained consumer fixtures and show the boundary +**Status:** Complete. The consumer examples and executable tests pass. + **Scope:** `examples/consumers`, its YAML fixtures, and their executable tests. 1. Migrate genuine root controls in consumer fixtures and inline generated diff --git a/examples/consumers/config_controls_test.go b/examples/consumers/config_controls_test.go new file mode 100644 index 0000000..597a7c3 --- /dev/null +++ b/examples/consumers/config_controls_test.go @@ -0,0 +1,26 @@ +package consumers + +import ( + "fmt" + "testing/fstest" + + configkit "go.maximumdirect.net/configkit" +) + +func Example_documentRootConfig() { + type app struct { + Config struct { + Timeout string `yaml:"timeout"` + } `yaml:"config"` + } + files := configkit.NewFilesystem("bundle", fstest.MapFS{ + "main.yml": {Data: []byte("config: {imports: [{path: settings.yml, destination: [config]}]}\n")}, + "settings.yml": {Data: []byte("timeout: 10s\n")}, + }) + result, err := configkit.Load[app](files.File("main.yml"), configkit.Options[app]{Imports: true}) + if err != nil { + panic(err) + } + fmt.Println(result.Config.Config.Timeout) + // Output: 10s +} diff --git a/examples/consumers/sequence_catalog_test.go b/examples/consumers/sequence_catalog_test.go index 4774e89..7af6351 100644 --- a/examples/consumers/sequence_catalog_test.go +++ b/examples/consumers/sequence_catalog_test.go @@ -171,7 +171,7 @@ collections: func Example_yamlDeclaredIdentityOnly() { result, err := configkit.Load(configkit.Bytes("YAML identity only", []byte(` -configkit: +config: sequences: - destination: [prompts] key: id @@ -193,7 +193,7 @@ prompts: func TestYAMLDeclaredIdentityDoesNotRegisterFinalTypedConstraint(t *testing.T) { result, err := configkit.Load(configkit.Bytes("YAML identity only", []byte(` -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/collection-bundle/collections/weather/collection.yml b/examples/consumers/testdata/collection-bundle/collections/weather/collection.yml index 3065c9d..c7b698f 100644 --- a/examples/consumers/testdata/collection-bundle/collections/weather/collection.yml +++ b/examples/consumers/testdata/collection-bundle/collections/weather/collection.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: metadata.yml destination: [] diff --git a/examples/consumers/testdata/collection-bundle/collections/weather/metadata.yml b/examples/consumers/testdata/collection-bundle/collections/weather/metadata.yml index bd19389..38dfc34 100644 --- a/examples/consumers/testdata/collection-bundle/collections/weather/metadata.yml +++ b/examples/consumers/testdata/collection-bundle/collections/weather/metadata.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: version.yml description: Imported collection metadata. diff --git a/examples/consumers/testdata/collection-bundle/collections/weather/profiles/index.yml b/examples/consumers/testdata/collection-bundle/collections/weather/profiles/index.yml index 199cd4e..acdacc4 100644 --- a/examples/consumers/testdata/collection-bundle/collections/weather/profiles/index.yml +++ b/examples/consumers/testdata/collection-bundle/collections/weather/profiles/index.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: compact.yml - path: weather.yml diff --git a/examples/consumers/testdata/collection-bundle/collections/weather/prompts/index.yml b/examples/consumers/testdata/collection-bundle/collections/weather/prompts/index.yml index 086113b..827f498 100644 --- a/examples/consumers/testdata/collection-bundle/collections/weather/prompts/index.yml +++ b/examples/consumers/testdata/collection-bundle/collections/weather/prompts/index.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: brief.yml - path: custom.yml diff --git a/examples/consumers/testdata/layered-bundle/defaults/config.yml b/examples/consumers/testdata/layered-bundle/defaults/config.yml index 702485e..00acd18 100644 --- a/examples/consumers/testdata/layered-bundle/defaults/config.yml +++ b/examples/consumers/testdata/layered-bundle/defaults/config.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: ../shared.yml enabled: true diff --git a/examples/consumers/testdata/narratio/pipeline.yml b/examples/consumers/testdata/narratio/pipeline.yml index a89d7b4..c109cd5 100644 --- a/examples/consumers/testdata/narratio/pipeline.yml +++ b/examples/consumers/testdata/narratio/pipeline.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: artifacts.yml poll_interval: 1m diff --git a/examples/consumers/testdata/notarius-paths/main.yml b/examples/consumers/testdata/notarius-paths/main.yml index df9daa2..e2c38a6 100644 --- a/examples/consumers/testdata/notarius-paths/main.yml +++ b/examples/consumers/testdata/notarius-paths/main.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: declarations/path.yml sensitive: PATH_REFERENCE_SECRET_CANARY diff --git a/examples/consumers/testdata/ordinary-imports/config.yml b/examples/consumers/testdata/ordinary-imports/config.yml index c6b31cb..99ce641 100644 --- a/examples/consumers/testdata/ordinary-imports/config.yml +++ b/examples/consumers/testdata/ordinary-imports/config.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: metadata.yml - path: prompts/brief.yml diff --git a/examples/consumers/testdata/prompt-catalog/config.yml b/examples/consumers/testdata/prompt-catalog/config.yml index c713ef2..7568de7 100644 --- a/examples/consumers/testdata/prompt-catalog/config.yml +++ b/examples/consumers/testdata/prompt-catalog/config.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/prompt-catalog/invalid.yml b/examples/consumers/testdata/prompt-catalog/invalid.yml index 49ed78d..2df7ead 100644 --- a/examples/consumers/testdata/prompt-catalog/invalid.yml +++ b/examples/consumers/testdata/prompt-catalog/invalid.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/prompt-catalog/prompts/curated.yml b/examples/consumers/testdata/prompt-catalog/prompts/curated.yml index 7cc3140..b29eddb 100644 --- a/examples/consumers/testdata/prompt-catalog/prompts/curated.yml +++ b/examples/consumers/testdata/prompt-catalog/prompts/curated.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: helpers/curated-id.yml name: Curated summary diff --git a/examples/consumers/testdata/prompt-catalog/simple.yml b/examples/consumers/testdata/prompt-catalog/simple.yml index 9dd0a16..1ab3cd7 100644 --- a/examples/consumers/testdata/prompt-catalog/simple.yml +++ b/examples/consumers/testdata/prompt-catalog/simple.yml @@ -1,4 +1,4 @@ -configkit: +config: imports: - path: prompts/required.yml required: true diff --git a/examples/consumers/testdata/sequence-catalog/config.yml b/examples/consumers/testdata/sequence-catalog/config.yml index cc2d08c..604c758 100644 --- a/examples/consumers/testdata/sequence-catalog/config.yml +++ b/examples/consumers/testdata/sequence-catalog/config.yml @@ -1,5 +1,5 @@ run_label: source-default -configkit: +config: imports: - dir: fragments pattern: '*.yml' diff --git a/examples/consumers/testdata/sequence-catalog/overlays/append.yml b/examples/consumers/testdata/sequence-catalog/overlays/append.yml index 8898d4d..3590192 100644 --- a/examples/consumers/testdata/sequence-catalog/overlays/append.yml +++ b/examples/consumers/testdata/sequence-catalog/overlays/append.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/sequence-catalog/overlays/replace.yml b/examples/consumers/testdata/sequence-catalog/overlays/replace.yml index 9eec06f..a5be76e 100644 --- a/examples/consumers/testdata/sequence-catalog/overlays/replace.yml +++ b/examples/consumers/testdata/sequence-catalog/overlays/replace.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/sequence-catalog/overlays/upsert.yml b/examples/consumers/testdata/sequence-catalog/overlays/upsert.yml index 826442d..ee25ba2 100644 --- a/examples/consumers/testdata/sequence-catalog/overlays/upsert.yml +++ b/examples/consumers/testdata/sequence-catalog/overlays/upsert.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id diff --git a/examples/consumers/testdata/sequence-catalog/underlay.yml b/examples/consumers/testdata/sequence-catalog/underlay.yml index 58db8b6..38cb3c7 100644 --- a/examples/consumers/testdata/sequence-catalog/underlay.yml +++ b/examples/consumers/testdata/sequence-catalog/underlay.yml @@ -1,4 +1,4 @@ -configkit: +config: sequences: - destination: [prompts] key: id