From 3b7baed65e50050c3108db0f9c7ae7e4e0b984ce Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 29 Nov 2026 18:16:18 +0000 Subject: [PATCH] Document shared glossary inputs and migration --- docs/cli.md | 2 +- docs/config.md | 35 +++++++------ docs/integrations/subprocess.md | 4 +- .../integrations/transcript-glossary-files.md | 51 +++++++++++-------- docs/internal/cli-config.md | 13 +++-- docs/migrations/v4.3.md | 43 ++++++++++++++++ docs/operations.md | 4 +- docs/releases/README.md | 1 + docs/releases/v4.3.0.md | 20 ++++++++ docs/roadmap/future.md | 21 +++----- docs/roadmap/implementation.md | 2 + examples/README.md | 38 ++++++++------ examples/campaigns/glossary.yml | 1 + examples/campaigns/party.yml | 8 +++ examples/campaigns/shared.yml | 25 ++++----- examples/campaigns/spells.yml | 8 +++ examples/local/glossary.yml | 16 +++--- examples/prompt-edit/glossary.yml | 16 +++--- examples/service/runtime-glossary.yml | 17 ++++--- internal/cli/examples_integration_test.go | 35 ++++++++++++- 20 files changed, 248 insertions(+), 112 deletions(-) create mode 100644 docs/migrations/v4.3.md create mode 100644 docs/releases/v4.3.0.md create mode 100644 examples/campaigns/party.yml create mode 100644 examples/campaigns/spells.yml diff --git a/docs/cli.md b/docs/cli.md index 68545a4..8f513a1 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -44,7 +44,7 @@ work directory. `audita process --help` lists the available flags. An omitted fl does not contribute an override. [Configuration](config.md) defines their values and inheritance. -`--glossary-file PATH` supplies a wrapperless runtime glossary file. Repeat it +`--glossary-file PATH` supplies a shared glossary YAML or JSON file. Repeat it to compose files in argument order. Each occurrence is a single path resolved from the invocation working directory. This flag does not select collections: use configured selections or `--glossaries`. It is also accepted by configuration diff --git a/docs/config.md b/docs/config.md index 2d3f59b..a5b2e5d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -15,23 +15,28 @@ not continue after a selected file fails. An omitted version uses the v3 schema; a supplied version must be `3`. Operator sources may use ConfigKit imports. The selected main file provides the -base for an optional `overlays/.yml`, optional `glossary.yml`, and recursive -`glossary/` YAML files. Without a main source, automatic companion files are not -loaded from the working directory. ConfigKit composes sources, resolves native -inheritance, applies explicit overrides, records derived defaults, and validates -the result. Its [configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md) +base for an optional `overlays/.yml` and automatic prompt companions. +Without a main source, automatic companions are not loaded from the working +directory. ConfigKit composes sources, resolves native inheritance, applies +explicit overrides, records derived defaults, and validates the result. Its +[configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md) owns native composition and provenance semantics. -Runtime files supplied with `--glossary-file` are first composed separately in -argument order using native imports and entry identities. Imports are resolved -beside their declaring files. The resolved wrapperless mapping is then assigned -to `glossary_collections` as one CLI override in the application load. Supplied -entry lists replace configured lists at that boundary; unrelated configured -collections remain. Omitted fields retain configured values, while explicit -empty and null values follow native assignment and decoding. Application and -overlay parsing and validation still apply. Final explanation records the CLI -assignment, while original runtime file and import source records belong to the -preliminary load rather than final provenance. See the [runtime file contract](integrations/transcript-glossary-files.md). +Explicit `--glossary-file` inputs use the shared `glossary@0.2.0` contract from +schemas distribution `2026.11.1` and the `maximumdirect.glossary.v1` marker. +The files are ordered native layers; imports within a file are native peers and +resolve beside their declaring file. Audita validates the completed envelope, +then projects collection entries as one CLI assignment to +`glossary_collections`. Supplied entry lists replace configured lists at that +boundary; unrelated configured collections remain. ConfigKit governs native +composition and assignment. Final explanation records the CLI assignment; +runtime files and imports remain recorded for collision protection. See the +[shared file contract](integrations/transcript-glossary-files.md#glossary-collections). + +Audita does not automatically discover `glossary.yml` or files under `glossary/`. +Pass desired files explicitly. An extension named `instruction` in a shared +collection is data and is not application instruction guidance. Inline application +`glossary_collections` may still define `instruction`. Runtime glossary inheritance resolves only among the supplied files and their imports; it cannot name a parent defined only in application configuration. diff --git a/docs/integrations/subprocess.md b/docs/integrations/subprocess.md index 1468b2d..90fbc05 100644 --- a/docs/integrations/subprocess.md +++ b/docs/integrations/subprocess.md @@ -19,7 +19,7 @@ Supplying a configuration path also makes file selection predictable. Configured secrets bootstrap can populate the child environment before the shared load; see [configuration](../config.md#loading-and-composition). -For prepared vocabulary, write one or more wrapperless collection files and +For prepared vocabulary, write one or more shared glossary files and pass each path as a separate `--glossary-file` argument. Select the main configuration and overlay that define the desired pipeline and collection selections; supplying files does not select them. The same arguments can be @@ -28,7 +28,7 @@ used to inspect the effective configuration before processing. See the [CLI reference](../cli.md#processing) for composition and error outcomes. Choose a trusted configuration bundle. An explicit main path still allows -its configured imports and automatic overlay, glossary, and prompt companions. +its configured imports, selected overlay, and automatic prompt companions. Without a main path, Audita uses the configured discovery locations. The parent controls who can write those sources and which report destinations and retained debug directories the invocation will use. Native inspection is diff --git a/docs/integrations/transcript-glossary-files.md b/docs/integrations/transcript-glossary-files.md index 039cc97..f5fd750 100644 --- a/docs/integrations/transcript-glossary-files.md +++ b/docs/integrations/transcript-glossary-files.md @@ -30,29 +30,36 @@ types, duplicate supplied IDs, and the validation failures above are rejected. ## Glossary collections -Glossary definitions are composed as application configuration, including the -optional companion inputs described by the [configuration reference](../config.md). -The [local example](../../examples/local/glossary.yml) provides a complete -collection. Configuration may contain empty collections; processing preflight -requires every glossary-correction entry to select at least one glossary entry. -The previous standalone `glossary` file format is not a processing input. - -Runtime files supplied with `--glossary-file` are YAML mappings keyed directly -by collection name, without a `glossary_collections` wrapper. Each collection -may contain `instruction` and `entries`; entries retain additional fields as -extensions. For example: +Runtime glossary files supplied with `--glossary-file PATH` use the shared +`glossary@0.2.0` contract from schemas distribution `2026.11.1`, with marker +`maximumdirect.glossary.v1`. Audita bundles the selected schema and validates +completed inputs offline. The upstream [schema](https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json) +and [semantics](https://schemas.maximumdirect.net/glossary/v0.2.0/semantics.md) +define its fields and extensions. Full conformance includes the +[ConfigKit v1.4.0 loading boundary](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md). ```yaml -people: - instruction: Prefer the speaker's stated name when supported by context. - entries: - - id: speaker - name: Mira Chen - category: person - aliases: [Mira] - source_note: Prepared for this recording +schema_version: maximumdirect.glossary.v1 +collections: + people: + entries: + - id: speaker + name: Mira Chen + category: person + aliases: [Mira] ``` -See the [complete runtime glossary example](../../examples/README.md#runtime-glossary-input) -and [composition and selection rules](../config.md#loading-and-composition). -Files and their imports are protected by the existing output collision checks. +Each path is relative to the invocation working directory. A file can hold one +or many collections; repeated flags compose files in order. Native imports are +resolved relative to their declaring file, and imported fragments can contribute +to a completed envelope. All selected and imported paths are protected from +output collisions. Loading does not select collections. Configure selections or +use the CLI selection flags; empty collections are valid for inspection, while +glossary correction needs at least one selected entry. + +Audita no longer automatically loads `glossary.yml` or files in `glossary/`; +pass those paths explicitly if needed. Automatic prompt companions remain. +Collection extensions, including `instruction`, are data and do not become +prompt guidance. See [configuration and composition](../config.md#loading-and-composition), +[examples](../../examples/README.md#runtime-glossary-input), and the +[v4.3 migration guide](../migrations/v4.3.md). diff --git a/docs/internal/cli-config.md b/docs/internal/cli-config.md index 6bdaace..98d130d 100644 --- a/docs/internal/cli-config.md +++ b/docs/internal/cli-config.md @@ -42,10 +42,13 @@ profile and backend inspections and equivalent glossary views within the invocation. Native inspection commands continue to inspect configuration without running processing readiness checks. -Runtime glossary files use a preliminary ConfigKit load before the shared -application load. Processing retains its acquired source paths for output -collision checks; inspection receives the final native result and CLI origin. -Both sides of a native comparison use the same invocation file list. +Explicit shared glossary files use a preliminary ConfigKit load with ordered +layers, native imports, and entry identities. The shared-glossary adapter +validates the completed envelope against the bundled offline schema before +projecting entries into the application load. Processing retains acquired source +paths for output collision checks; inspection receives the final native result +and CLI origin. Both sides of comparison use the same invocation file list. +Automatic prompt companions remain; glossary companions are not discovered. ## Validating Examples @@ -54,7 +57,7 @@ their canonical contract documentation. Keep them valid and secret-free. Run the commands in the [example guide](../../examples/README.md) from each project's directory. `internal/cli/examples_integration_test.go` exercises the maintained projects with a controlled provider, and the preview fixture can be -prepared without inference. Review automatic companion sources and overlays in +prepared without inference. Review automatic prompt sources and overlays in their actual project directories. Keep service credentials synthetic in tests. ## Runtime Change Checks diff --git a/docs/migrations/v4.3.md b/docs/migrations/v4.3.md new file mode 100644 index 0000000..42e93d9 --- /dev/null +++ b/docs/migrations/v4.3.md @@ -0,0 +1,43 @@ +# Migrating to Audita v4.3 + +Audita v4.3.0 adopts the shared `glossary@0.2.0` contract from schemas +distribution `2026.11.1`. Runtime glossary files now require the +`maximumdirect.glossary.v1` marker and a `collections` mapping. The former +wrapperless runtime format is no longer accepted. See the +[shared input contract](../integrations/transcript-glossary-files.md#glossary-collections) +and [upstream semantics](https://schemas.maximumdirect.net/glossary/v0.2.0/semantics.md). + +```yaml +schema_version: maximumdirect.glossary.v1 +collections: + people: + entries: + - {id: speaker, name: Mira Chen, category: person} +``` + +Pass files explicitly to every configuration-consuming invocation: + +```sh +audita preflight --smoke=false --config config.yml --glossary-file glossary.yml --output corrected.json transcript.json +audita process --config config.yml --glossary-file party.yml --glossary-file spells.yml --output corrected.json transcript.json +``` + +One file can contain multiple collections, or repeated arguments can supply +separate files or a mixture. Paths are relative to the invocation directory; +native imports are relative to their declaring file. Formerly discovered +`glossary.yml` and `glossary/` files must now be named explicitly. Automatic +prompt companions, inline application vocabulary, and main configuration +discovery remain available. + +Explicit files have CLI assignment priority over main and overlay vocabulary, +whereas automatic glossary companions previously acted as an underlay. Supplied +entry lists replace configured lists at that boundary; unrelated configured +collections remain. Files compose as ordered native layers before the completed +envelope is validated and projected. Inheritance and value presence follow the +[ConfigKit reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md), +within the boundaries described in [configuration](../config.md#loading-and-composition). + +Loading does not select collections. Keep root or per-pipeline selections, or +supply the applicable CLI overrides. Empty collections can be inspected, but +glossary correction requires a selected entry. Application configuration remains +version 3 and the Go module path remains `/v4`. diff --git a/docs/operations.md b/docs/operations.md index ed8ecc4..b055739 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -37,8 +37,8 @@ for native diagnostic behavior. ## Configuration trust -Treat the selected main file, imports, overlay, and automatically loaded -glossary and prompt companions as one trusted bundle. Choose the working +Treat the selected main file, imports, overlay, explicit glossary files, and +automatically loaded prompt companions as one trusted bundle. Choose the working directory deliberately when using automatic discovery. A bundle can select the provider, prompt content, and local files consumed by processing. Review these sources before running with sensitive transcript data. Native inspection diff --git a/docs/releases/README.md b/docs/releases/README.md index b958ba6..394370a 100644 --- a/docs/releases/README.md +++ b/docs/releases/README.md @@ -1,5 +1,6 @@ # Release Notes +- [Audita v4.3.0](v4.3.0.md) - [Audita v4.2.0](v4.2.0.md) - [Audita v4.1.0](v4.1.0.md) - [Audita v4.0.0](v4.0.0.md) diff --git a/docs/releases/v4.3.0.md b/docs/releases/v4.3.0.md new file mode 100644 index 0000000..ce255f1 --- /dev/null +++ b/docs/releases/v4.3.0.md @@ -0,0 +1,20 @@ +# Audita v4.3.0 + +Audita v4.3.0 adopts the Maximum Direct shared glossary contract for explicit +runtime files. Prepared shared vocabulary, including multi-collection spell +inputs, can be used directly for correction and protection. + +## Compatibility and migration + +`--glossary-file` now expects the `glossary@0.2.0` envelope with marker +`maximumdirect.glossary.v1`. Wrapperless glossary files are no longer accepted. +Automatic `glossary.yml` and `glossary/` discovery has been removed; callers +must pass desired files explicitly. Those files now have CLI assignment priority, +and supplied entry lists replace configured lists at that boundary. Collection +selection remains separate. Automatic prompt companions and inline application +vocabulary remain supported. See the [migration guide](../migrations/v4.3.md) +and [input contract](../integrations/transcript-glossary-files.md#glossary-collections). + +Application configuration remains version 3 and the Go module path remains `/v4`. + +[COPYRIGHT](https://gitea.maximumdirect.net/eric/audita/src/tag/v4.3.0/COPYRIGHT) | [LICENSE](https://gitea.maximumdirect.net/eric/audita/src/tag/v4.3.0/LICENSE) | [ATTRIBUTION](https://gitea.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/oss/attribution.md) diff --git a/docs/roadmap/future.md b/docs/roadmap/future.md index 50ea48a..ba508e0 100644 --- a/docs/roadmap/future.md +++ b/docs/roadmap/future.md @@ -99,17 +99,10 @@ See the [current validator context](../internal/validators.md#supplemental-valid ## Narratio Runtime Glossary Adoption -Audita's runtime glossary feature and the production/testing overlays in the -separate `audita-pipelines-dnd` repository are implemented. Recipe roles, stage -selections, profile aliases, installation and examples now belong to that -repository's [README](https://forge.maximumdirect.net/eric/audita-pipelines-dnd/src/branch/main/README.md). -Audita's interface belongs in the [CLI](../cli.md), [configuration](../config.md), -and [input contracts](../integrations/transcript-glossary-files.md). - -Narratio's adapter migration remains separate work: supply native runtime -glossary files, select the operator's configuration/overlay, and review remaining -CLI/output assumptions, including legacy `--modules`. Narratio owns projecting -campaign/session content such as party rosters into native collections. It can -pin a recipe revision without encoding the processing sequence. This work does -not restore legacy Audita flags or formats. Publishing recipes and selecting -an Audita release remain separate from their implementation. +Audita's shared glossary boundary accepts explicit `glossary@0.2.0` inputs; +see the [input contract](../integrations/transcript-glossary-files.md) and +[v4.3 migration guide](../migrations/v4.3.md). Narratio's adapter migration and +updates to the separate [audita-pipelines-dnd recipes](https://forge.maximumdirect.net/eric/audita-pipelines-dnd/src/branch/main/README.md) +remain separate work. They can pass prepared shared documents, choose explicit +files and selections, and review their CLI and output assumptions. Publishing +recipes and selecting an Audita release remain separate from implementation. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 431ee25..8b39f9c 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -225,6 +225,8 @@ format-validation matrices at every CLI boundary. ## Stage 6: Update Examples and Canonical Documentation +**Completed.** Integrated acceptance validation remains outstanding. + **Work** 1. Convert maintained runtime and former companion glossary files, including diff --git a/examples/README.md b/examples/README.md index 211ca70..53fc55b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,7 +2,7 @@ Build Audita from the repository root with Go 1.27 or newer. The commands below assume the executable is on `PATH`. Each project selects its main file from its -own directory, which also determines companion resources and overlay context. +own directory, which also determines prompt companions and overlay context. All models, credentials, names, and endpoints are illustrative. ## Local processing @@ -11,9 +11,9 @@ From `examples/local`, edit `prompts.yml` to match a reachable OpenAI-compatible local service and its model. Then run: ```sh -audita config validate --config config.yml -audita preflight --smoke=false --config config.yml --output corrected.json transcript.json -audita process --config config.yml --output corrected.json transcript.json +audita config validate --config config.yml --glossary-file glossary.yml +audita preflight --smoke=false --config config.yml --glossary-file glossary.yml --output corrected.json transcript.json +audita process --config config.yml --glossary-file glossary.yml --output corrected.json transcript.json ``` The local-only preflight checks the intended destination without contacting the @@ -24,7 +24,7 @@ unless disabled. For an offline validator preview, from the same directory: ```sh audita promptkit show prepared audita/validators.meaning_reversal_review \ - --config config.yml --profile local \ + --config config.yml --glossary-file glossary.yml --profile local \ --var "PayloadJSON=$(cat validation-candidate.json)" \ --var 'TranscriptDescriptionBlock=' ``` @@ -33,7 +33,7 @@ To preview the repair instruction and its output schema without inference: ```sh audita promptkit show prepared audita/modules.grammar.repair \ - --config config.yml --profile local \ + --config config.yml --glossary-file glossary.yml --profile local \ --var "RepairRequestJSON=$(cat repair-candidate.json)" ``` @@ -57,7 +57,7 @@ The example does not promise a provider's model availability, price, or quality. From `examples/service`, the `runtime-glossary` overlay selects a configured reference collection and an incoming collection. The runtime file replaces the -incoming entries and supplies its instruction. Inspect the combined settings: +incoming entries. Inspect the combined settings: ```sh audita config show --scope app --config config.yml --overlay runtime-glossary \ @@ -79,11 +79,11 @@ The [runtime file](service/runtime-glossary.yml) and From `examples/prompt-edit`, inspect the operator replacement: ```sh -audita promptkit show prompt audita/modules.grammar.proposal --config config.yml +audita promptkit show prompt audita/modules.grammar.proposal --config config.yml --glossary-file glossary.yml ``` Edit its message in `prompts.yml`, repeat the inspection, and run `audita process ---config config.yml --output corrected.json transcript.json` against a configured +--config config.yml --glossary-file glossary.yml --output corrected.json transcript.json` against a configured local service. Its complete replacement also selects a structural-repair budget; see the [v4.1 migration guide](../docs/migrations/v4.1.md). Each invocation captures the files anew. For native resource formats and commands, see the @@ -92,20 +92,28 @@ and [ckprompt guide](https://forge.maximumdirect.net/base-layer/commandkit/src/t ## Shared glossary library -From `examples/campaigns`, `first.yml` and `second.yml` each consume the common -`shared.yml` through the companion `glossary.yml`. Inspect each configuration: +From `examples/campaigns`, `first.yml` and `second.yml` explicitly select the +[shared multi-collection file](campaigns/glossary.yml), which imports the +[synthetic party and spell data](campaigns/shared.yml). Inspect each configuration: ```sh -audita config validate --config first.yml -audita config validate --config second.yml +audita config validate --config first.yml --glossary-file glossary.yml +audita config validate --config second.yml --glossary-file glossary.yml +``` + +The equivalent arrangement uses separate complete files: + +```sh +audita config validate --config first.yml --glossary-file party.yml --glossary-file spells.yml ``` With a local service configured, process either campaign: ```sh -audita process --config first.yml --output first-output.json transcript.json -audita process --config second.yml --output second-output.json transcript.json +audita process --config first.yml --glossary-file glossary.yml --output first-output.json transcript.json +audita process --config second.yml --glossary-file glossary.yml --output second-output.json transcript.json ``` Edit `prompts.yml` for a local service before processing either campaign. The first uses separate party and spell corrections; the second selects only party. +The spell input is a shared document and needs no Audita-specific vocabulary copy. diff --git a/examples/campaigns/glossary.yml b/examples/campaigns/glossary.yml index 54a3749..af337d9 100644 --- a/examples/campaigns/glossary.yml +++ b/examples/campaigns/glossary.yml @@ -2,3 +2,4 @@ config: imports: - path: shared.yml required: true +schema_version: maximumdirect.glossary.v1 diff --git a/examples/campaigns/party.yml b/examples/campaigns/party.yml new file mode 100644 index 0000000..3952c72 --- /dev/null +++ b/examples/campaigns/party.yml @@ -0,0 +1,8 @@ +schema_version: maximumdirect.glossary.v1 +collections: + party: + entries: + - id: lyra + name: Lyra + category: character + description: A fictional adventurer. diff --git a/examples/campaigns/shared.yml b/examples/campaigns/shared.yml index 4a0dce1..346d421 100644 --- a/examples/campaigns/shared.yml +++ b/examples/campaigns/shared.yml @@ -1,12 +1,13 @@ -party: - entries: - - id: lyra - name: Lyra - category: character - description: A fictional adventurer. -spells: - entries: - - id: shield - name: Shield - category: spell - aliases: [Ward] +collections: + party: + entries: + - id: lyra + name: Lyra + category: character + description: A fictional adventurer. + spells: + entries: + - id: shield + name: Shield + category: spell + aliases: [Ward] diff --git a/examples/campaigns/spells.yml b/examples/campaigns/spells.yml new file mode 100644 index 0000000..ac514da --- /dev/null +++ b/examples/campaigns/spells.yml @@ -0,0 +1,8 @@ +schema_version: maximumdirect.glossary.v1 +collections: + spells: + entries: + - id: shield + name: Shield + category: spell + aliases: [Ward] diff --git a/examples/local/glossary.yml b/examples/local/glossary.yml index f4d4d3e..37e5564 100644 --- a/examples/local/glossary.yml +++ b/examples/local/glossary.yml @@ -1,7 +1,9 @@ -party: - entries: - - id: jesters - name: Jesters - category: faction - description: A traveling group of performers. - aliases: [Jester] +schema_version: maximumdirect.glossary.v1 +collections: + party: + entries: + - id: jesters + name: Jesters + category: faction + description: A traveling group of performers. + aliases: [Jester] diff --git a/examples/prompt-edit/glossary.yml b/examples/prompt-edit/glossary.yml index f4d4d3e..37e5564 100644 --- a/examples/prompt-edit/glossary.yml +++ b/examples/prompt-edit/glossary.yml @@ -1,7 +1,9 @@ -party: - entries: - - id: jesters - name: Jesters - category: faction - description: A traveling group of performers. - aliases: [Jester] +schema_version: maximumdirect.glossary.v1 +collections: + party: + entries: + - id: jesters + name: Jesters + category: faction + description: A traveling group of performers. + aliases: [Jester] diff --git a/examples/service/runtime-glossary.yml b/examples/service/runtime-glossary.yml index 8cad0c3..e620165 100644 --- a/examples/service/runtime-glossary.yml +++ b/examples/service/runtime-glossary.yml @@ -1,8 +1,9 @@ -incoming: - instruction: Use the speaker's preferred spelling when supported by context. - entries: - - id: speaker - name: Mira Chen - category: person - aliases: [Mira] - source_note: Prepared for this recording +schema_version: maximumdirect.glossary.v1 +collections: + incoming: + entries: + - id: speaker + name: Mira Chen + category: person + aliases: [Mira] + source_note: Prepared for this recording diff --git a/internal/cli/examples_integration_test.go b/internal/cli/examples_integration_test.go index 82f52b0..02c8854 100644 --- a/internal/cli/examples_integration_test.go +++ b/internal/cli/examples_integration_test.go @@ -9,6 +9,7 @@ import ( "net/http/httptest" "os" "path/filepath" + "reflect" "runtime" "strings" "sync" @@ -63,7 +64,11 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) { t.Setenv("AUDITA_EXAMPLE_KEY", "") main = filepath.Join(dir, "config.yml") } - loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{Overlay: tc.overlay}) + var glossaryFiles []string + if tc.dir != "service" { + glossaryFiles = []string{filepath.Join(root, tc.dir, "glossary.yml")} + } + loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{Overlay: tc.overlay, GlossaryFiles: glossaryFiles}) if err != nil { t.Fatal(err) } @@ -159,7 +164,7 @@ func TestExamplePromptEditIsCapturedOnNextLoad(t *testing.T) { } } inspect := func() string { - loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{}) + loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{GlossaryFiles: []string{filepath.Join(dir, "glossary.yml")}}) if err != nil { t.Fatal(err) } @@ -258,3 +263,29 @@ func TestRuntimeGlossaryExampleWorkflow(t *testing.T) { t.Fatal(err) } } + +func TestCampaignGlossaryArrangementsAgree(t *testing.T) { + _, file, _, ok := runtime.Caller(0) + if !ok { + t.Fatal("cannot locate examples") + } + dir := filepath.Join(filepath.Dir(file), "..", "..", "examples", "campaigns") + input := ck.Input{Source: ck.File(filepath.Join(dir, "first.yml"))} + load := func(names ...string) *appconfig.Acquisition { + t.Helper() + var files []string + for _, name := range names { + files = append(files, filepath.Join(dir, name)) + } + result, _, err := appconfig.Load(context.Background(), input, appconfig.Options{GlossaryFiles: files}) + if err != nil { + t.Fatal(err) + } + return result + } + combined := load("glossary.yml").Config.Application.GlossaryCollections + separate := load("party.yml", "spells.yml").Config.Application.GlossaryCollections + if !reflect.DeepEqual(combined, separate) { + t.Fatalf("combined=%+v separate=%+v", combined, separate) + } +}