Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f97f31ccb | |||
| 0e565b3abf | |||
| fb612b361d | |||
| e72f69c68b | |||
| c15204bdc7 | |||
| 8699ec442a | |||
| 00a3628451 | |||
| 9af2c146f1 | |||
| 3b7baed65e | |||
| 04546acee0 | |||
| 994cba3ba2 | |||
| ff4f98d2f7 | |||
| 009373130c | |||
| 3e287503eb | |||
| c0d2280305 | |||
| 38c5f3c290 | |||
| 1ded570158 | |||
| 7ee50d1a3f | |||
| 4543d66e21 | |||
| 5a842f6a7f | |||
| 0b9c7912c2 | |||
| 4c2b11aa45 |
@@ -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
|
does not contribute an override. [Configuration](config.md) defines their values
|
||||||
and inheritance.
|
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
|
to compose files in argument order. Each occurrence is a single path resolved
|
||||||
from the invocation working directory. This flag does not select collections:
|
from the invocation working directory. This flag does not select collections:
|
||||||
use configured selections or `--glossaries`. It is also accepted by configuration
|
use configured selections or `--glossaries`. It is also accepted by configuration
|
||||||
|
|||||||
@@ -15,23 +15,31 @@ not continue after a selected file fails. An omitted version uses the v3 schema;
|
|||||||
a supplied version must be `3`.
|
a supplied version must be `3`.
|
||||||
|
|
||||||
Operator sources may use ConfigKit imports. The selected main file provides the
|
Operator sources may use ConfigKit imports. The selected main file provides the
|
||||||
base for an optional `overlays/<name>.yml`, optional `glossary.yml`, and recursive
|
base for an optional `overlays/<name>.yml` and automatic prompt companions.
|
||||||
`glossary/` YAML files. Without a main source, automatic companion files are not
|
Without a main source, automatic companions are not loaded from the working
|
||||||
loaded from the working directory. ConfigKit composes sources, resolves native
|
directory. ConfigKit composes sources, resolves native inheritance, applies
|
||||||
inheritance, applies explicit overrides, records derived defaults, and validates
|
explicit overrides, records derived defaults, and validates the result. Its
|
||||||
the result. Its [configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
|
[configuration reference](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
|
||||||
owns native composition and provenance semantics.
|
owns native composition and provenance semantics.
|
||||||
|
|
||||||
Runtime files supplied with `--glossary-file` are first composed separately in
|
Explicit `--glossary-file` inputs use the shared `glossary@0.2.0` contract from
|
||||||
argument order using native imports and entry identities. Imports are resolved
|
schemas distribution `2026.11.1` and the `maximumdirect.glossary.v1` marker.
|
||||||
beside their declaring files. The resolved wrapperless mapping is then assigned
|
The files are ordered native layers; imports within a file are native peers and
|
||||||
to `glossary_collections` as one CLI override in the application load. Supplied
|
resolve beside their declaring file. Audita validates the completed envelope,
|
||||||
entry lists replace configured lists at that boundary; unrelated configured
|
then projects collection entries through native CLI assignments to
|
||||||
collections remain. Omitted fields retain configured values, while explicit
|
`glossary_collections`. When other CLI overrides target that namespace, file
|
||||||
empty and null values follow native assignment and decoding. Application and
|
assignments are scoped to their supplied entry lists so disjoint overrides can
|
||||||
overlay parsing and validation still apply. Final explanation records the CLI
|
coexist. An empty collection map adds no assignment. Native override budgets and
|
||||||
assignment, while original runtime file and import source records belong to the
|
genuine overlap checks still apply. Supplied entry lists replace configured lists
|
||||||
preliminary load rather than final provenance. See the [runtime file contract](integrations/transcript-glossary-files.md).
|
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
|
Runtime glossary inheritance resolves only among the supplied files and their
|
||||||
imports; it cannot name a parent defined only in application configuration.
|
imports; it cannot name a parent defined only in application configuration.
|
||||||
|
|||||||
@@ -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;
|
secrets bootstrap can populate the child environment before the shared load;
|
||||||
see [configuration](../config.md#loading-and-composition).
|
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
|
pass each path as a separate `--glossary-file` argument. Select the main
|
||||||
configuration and overlay that define the desired pipeline and collection
|
configuration and overlay that define the desired pipeline and collection
|
||||||
selections; supplying files does not select them. The same arguments can be
|
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.
|
[CLI reference](../cli.md#processing) for composition and error outcomes.
|
||||||
|
|
||||||
Choose a trusted configuration bundle. An explicit main path still allows
|
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
|
Without a main path, Audita uses the configured discovery locations. The
|
||||||
parent controls who can write those sources and which report destinations and
|
parent controls who can write those sources and which report destinations and
|
||||||
retained debug directories the invocation will use. Native inspection is
|
retained debug directories the invocation will use. Native inspection is
|
||||||
|
|||||||
@@ -30,29 +30,36 @@ types, duplicate supplied IDs, and the validation failures above are rejected.
|
|||||||
|
|
||||||
## Glossary collections
|
## Glossary collections
|
||||||
|
|
||||||
Glossary definitions are composed as application configuration, including the
|
Runtime glossary files supplied with `--glossary-file PATH` use the shared
|
||||||
optional companion inputs described by the [configuration reference](../config.md).
|
`glossary@0.2.0` contract from schemas distribution `2026.11.1`, with marker
|
||||||
The [local example](../../examples/local/glossary.yml) provides a complete
|
`maximumdirect.glossary.v1`. Audita bundles the selected schema and validates
|
||||||
collection. Configuration may contain empty collections; processing preflight
|
completed inputs offline. The upstream [schema](https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json)
|
||||||
requires every glossary-correction entry to select at least one glossary entry.
|
and [semantics](https://schemas.maximumdirect.net/glossary/v0.2.0/semantics.md)
|
||||||
The previous standalone `glossary` file format is not a processing input.
|
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).
|
||||||
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:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
people:
|
people:
|
||||||
instruction: Prefer the speaker's stated name when supported by context.
|
|
||||||
entries:
|
entries:
|
||||||
- id: speaker
|
- id: speaker
|
||||||
name: Mira Chen
|
name: Mira Chen
|
||||||
category: person
|
category: person
|
||||||
aliases: [Mira]
|
aliases: [Mira]
|
||||||
source_note: Prepared for this recording
|
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [complete runtime glossary example](../../examples/README.md#runtime-glossary-input)
|
Each path is relative to the invocation working directory. A file can hold one
|
||||||
and [composition and selection rules](../config.md#loading-and-composition).
|
or many collections; repeated flags compose files in order. Native imports are
|
||||||
Files and their imports are protected by the existing output collision checks.
|
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).
|
||||||
|
|||||||
@@ -42,10 +42,16 @@ profile and backend inspections and equivalent glossary views within the
|
|||||||
invocation. Native inspection commands continue to inspect configuration
|
invocation. Native inspection commands continue to inspect configuration
|
||||||
without running processing readiness checks.
|
without running processing readiness checks.
|
||||||
|
|
||||||
Runtime glossary files use a preliminary ConfigKit load before the shared
|
Explicit shared glossary files use a preliminary ConfigKit load with ordered
|
||||||
application load. Processing retains its acquired source paths for output
|
layers, native imports, and entry identities. The shared-glossary adapter
|
||||||
collision checks; inspection receives the final native result and CLI origin.
|
validates the completed envelope against the bundled offline schema before
|
||||||
Both sides of a native comparison use the same invocation file list.
|
projecting entries into the application load. Entry assignments share the
|
||||||
|
glossary namespace with disjoint caller overrides; ordinary loads retain a
|
||||||
|
single batch contribution to avoid consuming a native override record per
|
||||||
|
collection, and empty maps contribute no override. 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
|
## Validating Examples
|
||||||
|
|
||||||
@@ -54,7 +60,7 @@ their canonical contract documentation. Keep them valid and secret-free.
|
|||||||
Run the commands in the [example guide](../../examples/README.md) from each
|
Run the commands in the [example guide](../../examples/README.md) from each
|
||||||
project's directory. `internal/cli/examples_integration_test.go` exercises the
|
project's directory. `internal/cli/examples_integration_test.go` exercises the
|
||||||
maintained projects with a controlled provider, and the preview fixture can be
|
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.
|
their actual project directories. Keep service credentials synthetic in tests.
|
||||||
|
|
||||||
## Runtime Change Checks
|
## Runtime Change Checks
|
||||||
|
|||||||
43
docs/migrations/v4.3.md
Normal file
43
docs/migrations/v4.3.md
Normal file
@@ -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`.
|
||||||
@@ -37,8 +37,8 @@ for native diagnostic behavior.
|
|||||||
|
|
||||||
## Configuration trust
|
## Configuration trust
|
||||||
|
|
||||||
Treat the selected main file, imports, overlay, and automatically loaded
|
Treat the selected main file, imports, overlay, explicit glossary files, and
|
||||||
glossary and prompt companions as one trusted bundle. Choose the working
|
automatically loaded prompt companions as one trusted bundle. Choose the working
|
||||||
directory deliberately when using automatic discovery. A bundle can select
|
directory deliberately when using automatic discovery. A bundle can select
|
||||||
the provider, prompt content, and local files consumed by processing. Review
|
the provider, prompt content, and local files consumed by processing. Review
|
||||||
these sources before running with sensitive transcript data. Native inspection
|
these sources before running with sensitive transcript data. Native inspection
|
||||||
|
|||||||
@@ -258,3 +258,16 @@ License and notices: [BSD 3-Clause](licenses/BSD-3-Clause-Go.txt) |
|
|||||||
[LICENSE](https://github.com/spf13/pflag/blob/f8a990678a6d44385313e9b19e40737f889f9b14/LICENSE).
|
[LICENSE](https://github.com/spf13/pflag/blob/f8a990678a6d44385313e9b19e40737f889f9b14/LICENSE).
|
||||||
|
|
||||||
[Source](https://github.com/spf13/pflag/tree/f8a990678a6d44385313e9b19e40737f889f9b14).
|
[Source](https://github.com/spf13/pflag/tree/f8a990678a6d44385313e9b19e40737f889f9b14).
|
||||||
|
|
||||||
|
## Maximum Direct shared schemas
|
||||||
|
|
||||||
|
Material: `glossary/v0.2.0/` from schemas distribution `2026.11.1`.
|
||||||
|
|
||||||
|
Copyright 2026 Eric Rakestraw
|
||||||
|
|
||||||
|
SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
License and notices: [CC0 1.0](licenses/CC0-1.0.txt) |
|
||||||
|
[COPYRIGHT](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/COPYRIGHT).
|
||||||
|
|
||||||
|
[Source](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7).
|
||||||
|
|||||||
121
docs/oss/licenses/CC0-1.0.txt
Normal file
121
docs/oss/licenses/CC0-1.0.txt
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
# Release Notes
|
# Release Notes
|
||||||
|
|
||||||
|
- [Audita v4.3.0](v4.3.0.md)
|
||||||
- [Audita v4.2.0](v4.2.0.md)
|
- [Audita v4.2.0](v4.2.0.md)
|
||||||
- [Audita v4.1.0](v4.1.0.md)
|
- [Audita v4.1.0](v4.1.0.md)
|
||||||
- [Audita v4.0.0](v4.0.0.md)
|
- [Audita v4.0.0](v4.0.0.md)
|
||||||
|
|||||||
51
docs/releases/v4.3.0.md
Normal file
51
docs/releases/v4.3.0.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Audita v4.3.0
|
||||||
|
|
||||||
|
Audita v4.3.0 adopts the Maximum Direct shared glossary contract for explicit
|
||||||
|
runtime files. Applications such as Narratio can pass prepared shared vocabulary
|
||||||
|
directly to Audita for correction and protection.
|
||||||
|
|
||||||
|
## Shared glossary inputs
|
||||||
|
|
||||||
|
Runtime files use `glossary@0.2.0` from schemas distribution `2026.11.1`.
|
||||||
|
One YAML or JSON file can contain multiple collections; repeat `--glossary-file`
|
||||||
|
to supply multiple files. Native imports and ordered composition remain available.
|
||||||
|
Audita bundles the selected schema and validates the completed shared envelope
|
||||||
|
offline before applying its collection entries to application configuration.
|
||||||
|
|
||||||
|
Processing, standalone preflight, and configuration-consuming inspection commands
|
||||||
|
use the same glossary acquisition. Loading vocabulary remains separate from
|
||||||
|
selecting collections for correction or protection. See the
|
||||||
|
[input contract](../integrations/transcript-glossary-files.md#glossary-collections)
|
||||||
|
and [updated examples](../../examples/README.md#runtime-glossary-input).
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
- Schema validation diagnostics identify the affected field and contributing
|
||||||
|
source, including failures originating in an earlier glossary file.
|
||||||
|
- Shared-file entries coexist with disjoint native `--set` glossary overrides.
|
||||||
|
An empty collection map no longer creates an assignment that conflicts with
|
||||||
|
those overrides. Native checks still reject genuinely overlapping assignments.
|
||||||
|
|
||||||
|
## Compatibility and migration
|
||||||
|
|
||||||
|
This release changes the runtime glossary input contract:
|
||||||
|
|
||||||
|
- Replace wrapperless glossary files with the shared envelope containing
|
||||||
|
`schema_version: maximumdirect.glossary.v1` and a `collections` mapping.
|
||||||
|
- Pass desired files explicitly. Automatic `glossary.yml` and recursive
|
||||||
|
`glossary/` discovery have been removed.
|
||||||
|
- Formerly discovered glossary companions acted as an underlay. Explicit files
|
||||||
|
have CLI assignment priority; supplied entry lists replace configured lists,
|
||||||
|
while unrelated configured collections remain.
|
||||||
|
- An `instruction` extension in a shared collection is data and does not become
|
||||||
|
prompt guidance. Inline application collection instructions remain supported.
|
||||||
|
|
||||||
|
See the [migration guide](../migrations/v4.3.md) and
|
||||||
|
[configuration guide](../config.md#loading-and-composition) before upgrading.
|
||||||
|
Automatic prompt companions and inline application vocabulary remain supported.
|
||||||
|
Application configuration remains version 3, and transcript and report schemas
|
||||||
|
are unchanged. Source builds still require Go 1.27.0 or newer; the Go module path
|
||||||
|
remains `gitea.maximumdirect.net/eric/audita/v4`. Dependency versions are unchanged
|
||||||
|
from v4.2.0.
|
||||||
|
|
||||||
|
[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)
|
||||||
@@ -99,17 +99,10 @@ See the [current validator context](../internal/validators.md#supplemental-valid
|
|||||||
|
|
||||||
## Narratio Runtime Glossary Adoption
|
## Narratio Runtime Glossary Adoption
|
||||||
|
|
||||||
Audita's runtime glossary feature and the production/testing overlays in the
|
Audita's shared glossary boundary accepts explicit `glossary@0.2.0` inputs;
|
||||||
separate `audita-pipelines-dnd` repository are implemented. Recipe roles, stage
|
see the [input contract](../integrations/transcript-glossary-files.md) and
|
||||||
selections, profile aliases, installation and examples now belong to that
|
[v4.3 migration guide](../migrations/v4.3.md). Narratio's adapter migration and
|
||||||
repository's [README](https://forge.maximumdirect.net/eric/audita-pipelines-dnd/src/branch/main/README.md).
|
updates to the separate [audita-pipelines-dnd recipes](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),
|
remain separate work. They can pass prepared shared documents, choose explicit
|
||||||
and [input contracts](../integrations/transcript-glossary-files.md).
|
files and selections, and review their CLI and output assumptions. Publishing
|
||||||
|
recipes and selecting an Audita release remain separate from implementation.
|
||||||
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.
|
|
||||||
|
|||||||
162
docs/roadmap/narratio-shared-glossary-feature-request.md
Normal file
162
docs/roadmap/narratio-shared-glossary-feature-request.md
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
# Feature request: adopt the shared glossary schema
|
||||||
|
|
||||||
|
## Requested outcome
|
||||||
|
|
||||||
|
Adopt the Maximum Direct shared glossary contract so operators can maintain one
|
||||||
|
vocabulary source for Audita, Notarius, Narratio, and relevant Scriptorium prompts.
|
||||||
|
Narratio should be able to supply its prepared glossary documents directly to
|
||||||
|
Audita without producing an Audita-specific format or embedding task instructions
|
||||||
|
in shared domain data.
|
||||||
|
|
||||||
|
This request describes external behavior and ownership. Audita owns its roadmap,
|
||||||
|
implementation plan, internal representation, and correction strategy. No package
|
||||||
|
structure, parsing library, or internal loading sequence is prescribed.
|
||||||
|
|
||||||
|
## Contract and adoption baseline
|
||||||
|
|
||||||
|
The initial [schemas distribution, 2026.11.0](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0)
|
||||||
|
is published. Recommend adopting `glossary@0.1.0`, identified in operator documents
|
||||||
|
by `maximumdirect.glossary.v1`.
|
||||||
|
|
||||||
|
Authoritative references:
|
||||||
|
|
||||||
|
- [Canonical schema](https://schemas.maximumdirect.net/glossary/v0.1.0/schema.json)
|
||||||
|
and [versioned semantics](https://schemas.maximumdirect.net/glossary/v0.1.0/semantics.md).
|
||||||
|
- [Published inventory](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/catalog.json)
|
||||||
|
and [source archive](https://forge.maximumdirect.net/eric/schemas/archive/2026.11.0.tar.gz).
|
||||||
|
- [Validation profile](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/validation.md)
|
||||||
|
and [compatibility guidance](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/compatibility.md).
|
||||||
|
|
||||||
|
The contracts are also available locally in `../schemas`. Schema and semantic
|
||||||
|
document jointly define the contract. Repository releases use CalVer; individual
|
||||||
|
schemas use independent SemVer. The document marker identifies a contract
|
||||||
|
generation, not the exact schema or distribution version. Canonical hosting serves
|
||||||
|
`main`; published tags and their inventories establish release status.
|
||||||
|
|
||||||
|
Pin the adopted schema version and source distribution. Ordinary validation should
|
||||||
|
work offline, without resolving schemas from the network or depending on a moving
|
||||||
|
latest inventory. The schema repository's internal Go harness is a development
|
||||||
|
tool, not a consumer SDK. This request concerns glossary adoption only; Audita need
|
||||||
|
not adopt the RPG party or campaign schemas to perform this work.
|
||||||
|
|
||||||
|
## External input behavior
|
||||||
|
|
||||||
|
The current [runtime glossary input](../integrations/transcript-glossary-files.md)
|
||||||
|
is a wrapperless mapping keyed by collection name. Recommend replacing that
|
||||||
|
external format with the shared `schema_version` and `collections` envelope.
|
||||||
|
Prefer retaining the established repeated `--glossary-file` interface and its
|
||||||
|
separate collection-selection controls; exact interface changes belong in Audita's
|
||||||
|
roadmap and migration guidance.
|
||||||
|
|
||||||
|
Accept YAML-authored shared documents and equivalent JSON. Operators should not
|
||||||
|
need to remove the envelope, rename shared fields, or maintain a second vocabulary
|
||||||
|
file to use Audita. Composition through native ConfigKit imports and inheritance
|
||||||
|
remains useful. Validate the completed shared document at that boundary; authoring
|
||||||
|
fragments need not independently satisfy the complete-document schema.
|
||||||
|
|
||||||
|
Document how supplied documents interact with configured vocabulary, repeated
|
||||||
|
files, and collection selections. Preserve ConfigKit ownership of composition,
|
||||||
|
precedence, inheritance, and overrides. Do not add a parallel merge or collision
|
||||||
|
policy for Narratio. Configuration inspection and other commands accepting runtime
|
||||||
|
glossary inputs should expose behavior consistent with processing, using their
|
||||||
|
native interfaces.
|
||||||
|
|
||||||
|
Narratio intends to supply four named collections: `party`, `campaign`, `setting`,
|
||||||
|
and `spells`. It derives the party vocabulary from its canonical roster and saves
|
||||||
|
all prepared glossaries as shared domain inputs. These are domain conventions,
|
||||||
|
not an exhaustive schema enumeration or mandatory collection set for Audita.
|
||||||
|
Audita should remain equally useful for weather, sports, and other domains.
|
||||||
|
|
||||||
|
Allow callers to select the collections relevant to each processing task without
|
||||||
|
requiring unrelated collections. Loading vocabulary should not implicitly select
|
||||||
|
all of it. Audita retains ownership of correction behavior, protected-term use,
|
||||||
|
matching, and how domain information is presented to its prompts.
|
||||||
|
|
||||||
|
## Instructions and extension fields
|
||||||
|
|
||||||
|
The shared contract contains domain information, not consumer task instructions.
|
||||||
|
Audita's correction instructions must come from its application configuration.
|
||||||
|
Provide a documented way to associate those instructions with selected vocabulary
|
||||||
|
without requiring the vocabulary itself to be duplicated in configuration.
|
||||||
|
|
||||||
|
Unlike the current runtime format, a collection or entry extension named
|
||||||
|
`instruction` must not become executable guidance merely because it appears in a
|
||||||
|
shared file. Shared input data must not replace or clear configured instructions
|
||||||
|
through that field. Ordinary native configuration controls remain responsible
|
||||||
|
for instruction selection and overrides.
|
||||||
|
|
||||||
|
Honor the shared contract's required fields and optional/null/empty distinctions,
|
||||||
|
including nullable aliases and plural forms. Allow extensions at the envelope,
|
||||||
|
collection, provenance, and entry levels as specified by the contract. Acceptance
|
||||||
|
of an extension does not imply that Audita understands its meaning. Preserve
|
||||||
|
extensions when forwarding a shared document; task-specific prompt views may
|
||||||
|
omit irrelevant information.
|
||||||
|
|
||||||
|
Collection provenance describes source information. It does not supply processing
|
||||||
|
instructions, establish transcript evidence, or require Audita to interpret
|
||||||
|
RPG-specific metadata. A spell glossary may contain information useful only to
|
||||||
|
Notarius, and Audita should not reject it solely for that reason.
|
||||||
|
|
||||||
|
## Validation and readiness
|
||||||
|
|
||||||
|
Apply the adopted structural and semantic contract to completed shared inputs,
|
||||||
|
including exact entry-ID uniqueness within each collection. Shared schema validity
|
||||||
|
is separate from readiness for an Audita task. For example, the schema permits
|
||||||
|
empty collections, while Audita's selected glossary-correction task may require
|
||||||
|
at least one selected entry. Keep that requirement explicit as Audita policy rather
|
||||||
|
than tightening the shared schema.
|
||||||
|
|
||||||
|
Use the same glossary acceptance, composition, and selection semantics in
|
||||||
|
[preflight and processing](../cli.md#preflight). Preflight should catch malformed
|
||||||
|
shared inputs, unsupported contract generations, missing selected collections,
|
||||||
|
and determinable task-input failures before expensive correction begins. Execution
|
||||||
|
still validates its real inputs. Preserve native reporting and error outcomes,
|
||||||
|
with actionable identification of the affected file, collection, or field where
|
||||||
|
practical; no new error taxonomy or report protocol is requested.
|
||||||
|
|
||||||
|
Narratio runs early preflight with its real prepared glossary files and a known-good
|
||||||
|
synthetic transcript, using the intended configuration and provider environment.
|
||||||
|
Continue accepting that through the ordinary preflight interface. No fixture mode
|
||||||
|
is requested, and successful inspection of the supplied transcript does not
|
||||||
|
establish correctness of a future transcript. Preserve Audita's existing provider
|
||||||
|
readiness responsibilities without making schema adoption a separate redesign of
|
||||||
|
preflight.
|
||||||
|
|
||||||
|
## Decisions for Audita's roadmap
|
||||||
|
|
||||||
|
- How the shared envelope enters the public glossary-file interface and how native
|
||||||
|
composition works across runtime files and application configuration.
|
||||||
|
- How configured correction instructions are associated with shared collections,
|
||||||
|
while instruction-named data extensions remain inert.
|
||||||
|
- How root/stage glossary and protected-term selections apply to shared inputs,
|
||||||
|
and which task-specific requirements supplement schema conformance.
|
||||||
|
- The pinned schema version, exact public input behavior, release scope, and
|
||||||
|
migration guidance for existing wrapperless files and embedded instructions.
|
||||||
|
|
||||||
|
Recommend a direct cutover with release documentation, without legacy conversion,
|
||||||
|
compatibility shims, or duplicate operator-maintained vocabulary. Audita should
|
||||||
|
identify genuine shared-contract gaps explicitly rather than silently defining
|
||||||
|
another competing glossary format. No transcript input or corrected-output schema
|
||||||
|
change is requested solely for this adoption.
|
||||||
|
|
||||||
|
## Observable acceptance
|
||||||
|
|
||||||
|
The resulting roadmap should establish that:
|
||||||
|
|
||||||
|
1. A shared glossary prepared by Narratio is accepted directly, in YAML or equivalent
|
||||||
|
JSON, and the selected collections reach the intended correction/protection tasks.
|
||||||
|
2. One authored spell glossary can support both Audita and Notarius after each
|
||||||
|
consumer adopts it, without application-specific vocabulary copies.
|
||||||
|
3. Generic collections work without D&D-specific names or metadata; unrelated
|
||||||
|
collections need not be present or selected.
|
||||||
|
4. Permitted extensions, source provenance, and nullable optional fields are accepted;
|
||||||
|
malformed known fields and duplicate IDs in completed collections are rejected.
|
||||||
|
5. Configured instructions guide processing, while an `instruction` field in shared
|
||||||
|
data neither supplies guidance nor overrides those settings.
|
||||||
|
6. Native composition and preflight expose the same effective glossary inputs and
|
||||||
|
task requirements used by processing, with useful failure diagnostics.
|
||||||
|
7. Ordinary glossary validation works offline, and maintained examples and migration
|
||||||
|
guidance identify the supported contract and external interface.
|
||||||
|
|
||||||
|
Audita owns the roadmap, verification approach, and implementation plan. Narratio
|
||||||
|
will adopt the resulting released interface in its subsequent work.
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Build Audita from the repository root with Go 1.27 or newer. The commands below
|
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
|
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.
|
All models, credentials, names, and endpoints are illustrative.
|
||||||
|
|
||||||
## Local processing
|
## 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:
|
local service and its model. Then run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
audita config validate --config config.yml
|
audita config validate --config config.yml --glossary-file glossary.yml
|
||||||
audita preflight --smoke=false --config config.yml --output corrected.json transcript.json
|
audita preflight --smoke=false --config config.yml --glossary-file glossary.yml --output corrected.json transcript.json
|
||||||
audita process --config config.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
|
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
|
```sh
|
||||||
audita promptkit show prepared audita/validators.meaning_reversal_review \
|
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 "PayloadJSON=$(cat validation-candidate.json)" \
|
||||||
--var 'TranscriptDescriptionBlock='
|
--var 'TranscriptDescriptionBlock='
|
||||||
```
|
```
|
||||||
@@ -33,7 +33,7 @@ To preview the repair instruction and its output schema without inference:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
audita promptkit show prepared audita/modules.grammar.repair \
|
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)"
|
--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
|
From `examples/service`, the `runtime-glossary` overlay selects a configured
|
||||||
reference collection and an incoming collection. The runtime file replaces the
|
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
|
```sh
|
||||||
audita config show --scope app --config config.yml --overlay runtime-glossary \
|
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:
|
From `examples/prompt-edit`, inspect the operator replacement:
|
||||||
|
|
||||||
```sh
|
```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
|
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;
|
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
|
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
|
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
|
## Shared glossary library
|
||||||
|
|
||||||
From `examples/campaigns`, `first.yml` and `second.yml` each consume the common
|
From `examples/campaigns`, `first.yml` and `second.yml` explicitly select the
|
||||||
`shared.yml` through the companion `glossary.yml`. Inspect each configuration:
|
[shared multi-collection file](campaigns/glossary.yml), which imports the
|
||||||
|
[synthetic party and spell data](campaigns/shared.yml). Inspect each configuration:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
audita config validate --config first.yml
|
audita config validate --config first.yml --glossary-file glossary.yml
|
||||||
audita config validate --config second.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:
|
With a local service configured, process either campaign:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
audita process --config first.yml --output first-output.json transcript.json
|
audita process --config first.yml --glossary-file glossary.yml --output first-output.json transcript.json
|
||||||
audita process --config second.yml --output second-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
|
Edit `prompts.yml` for a local service before processing either campaign. The
|
||||||
first uses separate party and spell corrections; the second selects only party.
|
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.
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ config:
|
|||||||
imports:
|
imports:
|
||||||
- path: shared.yml
|
- path: shared.yml
|
||||||
required: true
|
required: true
|
||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
|||||||
8
examples/campaigns/party.yml
Normal file
8
examples/campaigns/party.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
party:
|
||||||
|
entries:
|
||||||
|
- id: lyra
|
||||||
|
name: Lyra
|
||||||
|
category: character
|
||||||
|
description: A fictional adventurer.
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
collections:
|
||||||
party:
|
party:
|
||||||
entries:
|
entries:
|
||||||
- id: lyra
|
- id: lyra
|
||||||
@@ -5,8 +6,11 @@ party:
|
|||||||
category: character
|
category: character
|
||||||
description: A fictional adventurer.
|
description: A fictional adventurer.
|
||||||
spells:
|
spells:
|
||||||
|
provenance: {id: synthetic-spells, title: Synthetic spell catalog, version: "1"}
|
||||||
entries:
|
entries:
|
||||||
- id: shield
|
- id: shield
|
||||||
name: Shield
|
name: Shield
|
||||||
category: spell
|
category: spell
|
||||||
aliases: [Ward]
|
aliases: [Ward]
|
||||||
|
casting_time: one reaction
|
||||||
|
rank: 1
|
||||||
|
|||||||
11
examples/campaigns/spells.yml
Normal file
11
examples/campaigns/spells.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
spells:
|
||||||
|
provenance: {id: synthetic-spells, title: Synthetic spell catalog, version: "1"}
|
||||||
|
entries:
|
||||||
|
- id: shield
|
||||||
|
name: Shield
|
||||||
|
category: spell
|
||||||
|
aliases: [Ward]
|
||||||
|
casting_time: one reaction
|
||||||
|
rank: 1
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
party:
|
party:
|
||||||
entries:
|
entries:
|
||||||
- id: jesters
|
- id: jesters
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
party:
|
party:
|
||||||
entries:
|
entries:
|
||||||
- id: jesters
|
- id: jesters
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
incoming:
|
incoming:
|
||||||
instruction: Use the speaker's preferred spelling when supported by context.
|
|
||||||
entries:
|
entries:
|
||||||
- id: speaker
|
- id: speaker
|
||||||
name: Mira Chen
|
name: Mira Chen
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"gitea.maximumdirect.net/eric/audita/v4/internal/appconfig/sharedglossary"
|
||||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
||||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/responseschema"
|
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/responseschema"
|
||||||
"gitea.maximumdirect.net/eric/audita/v4/internal/prompts"
|
"gitea.maximumdirect.net/eric/audita/v4/internal/prompts"
|
||||||
@@ -48,18 +51,6 @@ type GlossaryInputError struct{ Err error }
|
|||||||
func (e *GlossaryInputError) Error() string { return e.Err.Error() }
|
func (e *GlossaryInputError) Error() string { return e.Err.Error() }
|
||||||
func (e *GlossaryInputError) Unwrap() error { return e.Err }
|
func (e *GlossaryInputError) Unwrap() error { return e.Err }
|
||||||
|
|
||||||
const glossaryImports = `config:
|
|
||||||
imports:
|
|
||||||
- path: glossary.yml
|
|
||||||
required: false
|
|
||||||
destination: [glossary_collections]
|
|
||||||
- dir: glossary
|
|
||||||
required: false
|
|
||||||
recursive: true
|
|
||||||
pattern: ["*.yml", "*.yaml"]
|
|
||||||
destination: [glossary_collections]
|
|
||||||
`
|
|
||||||
|
|
||||||
const operatorImports = `config:
|
const operatorImports = `config:
|
||||||
imports:
|
imports:
|
||||||
- path: prompts.yml
|
- path: prompts.yml
|
||||||
@@ -112,14 +103,7 @@ func Load(ctx context.Context, input ck.Input, options Options) (*Acquisition, *
|
|||||||
}
|
}
|
||||||
inputs[i] = ck.Input{Source: ck.File(absolute), Imports: true}
|
inputs[i] = ck.Input{Source: ck.File(absolute), Imports: true}
|
||||||
}
|
}
|
||||||
underlays := make([]ck.Underlay, 0, len(inputs)-1)
|
glossaries, err := sharedglossary.Load(ctx, inputs)
|
||||||
for _, item := range inputs[:len(inputs)-1] {
|
|
||||||
underlays = append(underlays, ck.Underlay{Inputs: []ck.Input{item}})
|
|
||||||
}
|
|
||||||
glossaries, err := ck.LoadLayered(inputs[len(inputs)-1], ck.LayeredOptions[map[string]any]{
|
|
||||||
Definition: ck.Definition[map[string]any]{SequenceIdentities: []ck.SequenceIdentity{config.GlossaryEntryIdentity(nil)}},
|
|
||||||
Underlays: underlays,
|
|
||||||
})
|
|
||||||
if canceled := ctx.Err(); canceled != nil {
|
if canceled := ctx.Err(); canceled != nil {
|
||||||
return nil, report, errors.Join(err, canceled)
|
return nil, report, errors.Join(err, canceled)
|
||||||
}
|
}
|
||||||
@@ -131,7 +115,13 @@ func Load(ctx context.Context, input ck.Input, options Options) (*Acquisition, *
|
|||||||
glossarySources = append(glossarySources, source.Path)
|
glossarySources = append(glossarySources, source.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
overrides = append(overrides, ck.Override{Path: ck.Keys("glossary_collections"), Value: glossaries.Config, Flag: "--glossary-file"})
|
collections := glossaries.Config["collections"].(map[string]any)
|
||||||
|
projected := make(map[string]any, len(collections))
|
||||||
|
for name, value := range collections {
|
||||||
|
collection := value.(map[string]any)
|
||||||
|
projected[name] = map[string]any{"entries": collection["entries"]}
|
||||||
|
}
|
||||||
|
overrides = append(overrides, glossaryOverrides(projected, options.Overrides)...)
|
||||||
}
|
}
|
||||||
embedded, err := pk.FilesystemInputs("Audita embedded prompts", prompts.Filesystem(), prompts.AssetRoot)
|
embedded, err := pk.FilesystemInputs("Audita embedded prompts", prompts.Filesystem(), prompts.AssetRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -155,7 +145,6 @@ func Load(ctx context.Context, input ck.Input, options Options) (*Acquisition, *
|
|||||||
pk.BundledOpenRouterUnderlay(),
|
pk.BundledOpenRouterUnderlay(),
|
||||||
{Inputs: embedded},
|
{Inputs: embedded},
|
||||||
{Inputs: []ck.Input{
|
{Inputs: []ck.Input{
|
||||||
{Source: ck.Bytes("Audita glossary imports", []byte(glossaryImports)), Imports: true, MainRelative: ck.MainRelative()},
|
|
||||||
{Source: ck.Bytes("Audita automatic prompt imports", []byte(operatorImports)), Destination: ck.Keys("promptkit"), Imports: true, MainRelative: ck.MainRelative()},
|
{Source: ck.Bytes("Audita automatic prompt imports", []byte(operatorImports)), Destination: ck.Keys("promptkit"), Imports: true, MainRelative: ck.MainRelative()},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
@@ -168,3 +157,30 @@ func Load(ctx context.Context, input ck.Input, options Options) (*Acquisition, *
|
|||||||
}
|
}
|
||||||
return &Acquisition{Result: result, GlossarySources: glossarySources}, report, nil
|
return &Acquisition{Result: result, GlossarySources: glossarySources}, report, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func glossaryOverrides(projected map[string]any, supplied []ck.Override) []ck.Override {
|
||||||
|
if len(projected) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
root := ck.Keys("glossary_collections")
|
||||||
|
for _, override := range supplied {
|
||||||
|
path := override.Path.String()
|
||||||
|
if path != root.String() && !strings.HasPrefix(path, root.String()+"/") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Only split when caller overrides need to share this namespace. The
|
||||||
|
// usual batch keeps one native record regardless of collection count.
|
||||||
|
names := make([]string, 0, len(projected))
|
||||||
|
for name := range projected {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
sort.Strings(names)
|
||||||
|
result := make([]ck.Override, 0, len(names))
|
||||||
|
for _, name := range names {
|
||||||
|
entries := projected[name].(map[string]any)["entries"]
|
||||||
|
result = append(result, ck.Override{Path: root.Key(name).Key("entries"), Value: entries, Flag: "--glossary-file"})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return []ck.Override{{Path: root, Value: projected, Flag: "--glossary-file"}}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
ck "go.maximumdirect.net/configkit"
|
ck "go.maximumdirect.net/configkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGlossarySourcesComposeAndRetainExtensions(t *testing.T) {
|
func TestGlossaryFilesRequireExplicitSelection(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
write := func(name, data string) {
|
write := func(name, data string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
@@ -22,73 +22,43 @@ func TestGlossarySourcesComposeAndRetainExtensions(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write("config.yml", `version: 3
|
write("config.yml", "version: 3\nglossary_collections:\n party:\n entries: [{id: configured, name: Configured, category: person}]\n")
|
||||||
config:
|
write("glossary.yml", "invalid: [\n")
|
||||||
imports: []
|
write("glossary/nested/spells.yaml", "invalid: [\n")
|
||||||
glossary_collections:
|
main := ck.Input{Source: ck.SearchConfig("audita", ck.SearchDirectory(dir))}
|
||||||
party:
|
result, _, err := Load(context.Background(), main, Options{})
|
||||||
entries:
|
|
||||||
- id: hero
|
|
||||||
name: Revised
|
|
||||||
category: character
|
|
||||||
level: 5
|
|
||||||
`)
|
|
||||||
write("glossary.yml", `config:
|
|
||||||
imports:
|
|
||||||
- path: shared/extra.yml
|
|
||||||
required: true
|
|
||||||
party:
|
|
||||||
instruction: Use established names.
|
|
||||||
entries:
|
|
||||||
- id: hero
|
|
||||||
name: Original
|
|
||||||
category: character
|
|
||||||
aliases: [Old]
|
|
||||||
- id: other
|
|
||||||
name: Other
|
|
||||||
category: place
|
|
||||||
`)
|
|
||||||
write("shared/extra.yml", "lore:\n entries:\n - id: hero\n name: Ancient\n category: lore\n")
|
|
||||||
write("glossary/nested/spells.yaml", "spells:\n entries:\n - id: bolt\n name: Bolt\n category: spell\n aliases: [Spark]\n plural: Bolts\n extra: {rank: 2}\n")
|
|
||||||
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, Options{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%v: %+v", err, err.(*ck.LoadError).Diagnostics())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
party := result.Config.Application.GlossaryCollections["party"].Entries
|
if len(result.Config.Application.GlossaryCollections) != 1 || result.Config.Application.GlossaryCollections["party"].Entries[0].ID != "configured" {
|
||||||
if got := result.Config.Application.GlossaryCollections["party"].Instruction; got != "Use established names." {
|
t.Fatalf("unexpected vocabulary: %+v", result.Config.Application.GlossaryCollections)
|
||||||
t.Fatalf("instruction not inherited: %q", got)
|
|
||||||
}
|
}
|
||||||
if len(party) != 2 || party[0].Name != "Revised" || len(party[0].Aliases) != 0 || party[1].ID != "other" {
|
write("glossary.yml", `config:
|
||||||
t.Fatalf("party=%+v", party)
|
imports: [{path: shared/extra.yml, required: true}]
|
||||||
}
|
schema_version: maximumdirect.glossary.v1
|
||||||
if party[0].Extra["level"] == nil {
|
collections:
|
||||||
t.Fatalf("extension missing: %+v", party[0])
|
party:
|
||||||
}
|
entries: [{id: selected, name: Selected, category: person}]
|
||||||
if got := result.Config.Application.GlossaryCollections["lore"].Entries; len(got) != 1 || got[0].ID != "hero" {
|
`)
|
||||||
t.Fatalf("lore=%+v", got)
|
write("shared/extra.yml", "collections:\n lore:\n entries: [{id: lore, name: Lore, category: topic}]\n")
|
||||||
}
|
write("glossary/nested/spells.yaml", "schema_version: maximumdirect.glossary.v1\ncollections:\n spells:\n entries: [{id: bolt, name: Bolt, category: spell}]\n")
|
||||||
discovered, _, err := Load(context.Background(), ck.Input{Source: ck.SearchConfig("audita", ck.SearchDirectory(dir))}, Options{})
|
paths := []string{filepath.Join(dir, "glossary.yml"), filepath.Join(dir, "glossary/nested/spells.yaml")}
|
||||||
if err != nil || len(discovered.Config.Application.GlossaryCollections["party"].Entries) != 2 {
|
result, _, err = Load(context.Background(), main, Options{GlossaryFiles: paths})
|
||||||
t.Fatalf("discovered glossary: %+v %v", discovered, err)
|
if err != nil {
|
||||||
}
|
t.Fatal(err)
|
||||||
spells := result.Config.Application.GlossaryCollections["spells"].Entries
|
|
||||||
if len(spells) != 1 || spells[0].Plural == nil || *spells[0].Plural != "Bolts" || spells[0].Extra["extra"] == nil {
|
|
||||||
t.Fatalf("spells=%+v", spells)
|
|
||||||
}
|
|
||||||
var paths []string
|
|
||||||
for _, source := range result.Sources() {
|
|
||||||
if source.Kind == ck.SourceKindFile {
|
|
||||||
paths = append(paths, source.Path)
|
|
||||||
}
|
}
|
||||||
|
collections := result.Config.Application.GlossaryCollections
|
||||||
|
if collections["party"].Entries[0].ID != "selected" || len(collections["lore"].Entries) != 1 || len(collections["spells"].Entries) != 1 {
|
||||||
|
t.Fatalf("explicit vocabulary = %+v", collections)
|
||||||
}
|
}
|
||||||
for _, name := range []string{"glossary.yml", "shared/extra.yml", "glossary/nested/spells.yaml"} {
|
for _, name := range []string{"glossary.yml", "shared/extra.yml", "glossary/nested/spells.yaml"} {
|
||||||
if !slices.Contains(paths, filepath.Join(dir, name)) {
|
if !slices.Contains(result.GlossarySources, filepath.Join(dir, name)) {
|
||||||
t.Errorf("missing source %s: %v", name, paths)
|
t.Errorf("missing source %s: %v", name, result.GlossarySources)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGlossaryValidationAndPeerConflicts(t *testing.T) {
|
func TestInlineGlossaryValidation(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
main := filepath.Join(dir, "config.yml")
|
main := filepath.Join(dir, "config.yml")
|
||||||
write := func(path, data string) {
|
write := func(path, data string) {
|
||||||
@@ -117,15 +87,7 @@ func TestGlossaryValidationAndPeerConflicts(t *testing.T) {
|
|||||||
t.Fatalf("accepted %q", data)
|
t.Fatalf("accepted %q", data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write(main, "version: 3\n")
|
|
||||||
write(filepath.Join(dir, "glossary.yml"), "x:\n entries:\n - {id: same, name: One, category: C}\n")
|
|
||||||
if err := os.Mkdir(filepath.Join(dir, "glossary"), 0755); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
write(filepath.Join(dir, "glossary", "other.yml"), "x:\n entries:\n - {id: same, name: Two, category: C}\n")
|
|
||||||
if _, _, err := Load(context.Background(), ck.Input{Source: ck.File(main)}, Options{}); err == nil {
|
|
||||||
t.Fatal("peer conflict accepted")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGlossaryUnderlaySkipsAbsentMain(t *testing.T) {
|
func TestGlossaryUnderlaySkipsAbsentMain(t *testing.T) {
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package appconfig
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -28,17 +30,23 @@ glossary_collections:
|
|||||||
`,
|
`,
|
||||||
"first.yml": `config:
|
"first.yml": `config:
|
||||||
imports: [{path: imported.yml, required: true}]
|
imports: [{path: imported.yml, required: true}]
|
||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
party:
|
party:
|
||||||
|
instruction: {not: executable}
|
||||||
entries:
|
entries:
|
||||||
- {id: shared, name: Old, category: person, aliases: [Former]}
|
- {id: shared, name: Old, category: person, aliases: [Former]}
|
||||||
- {id: retained, name: Retained, category: person}
|
- {id: retained, name: Retained, category: person}
|
||||||
`,
|
`,
|
||||||
"imported.yml": `other:
|
"imported.yml": `collections:
|
||||||
|
other:
|
||||||
entries: [{id: imported, name: Imported, category: lore}]
|
entries: [{id: imported, name: Imported, category: lore}]
|
||||||
`,
|
`,
|
||||||
"last.yml": `party:
|
"last.yml": `schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
party:
|
||||||
entries:
|
entries:
|
||||||
- {id: shared, name: New, category: person, note: kept}
|
- {id: shared, name: New, category: person, note: kept, aliases: null, plural: null}
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
for name, contents := range files {
|
for name, contents := range files {
|
||||||
@@ -103,15 +111,41 @@ func TestRuntimeGlossaryLoadErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRuntimeGlossaryLargeCollectionBatch(t *testing.T) {
|
||||||
|
collections := make(map[string]any)
|
||||||
|
for i := range 1100 {
|
||||||
|
collections[fmt.Sprintf("collection-%d", i)] = map[string]any{"entries": []any{}}
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(map[string]any{"schema_version": "maximumdirect.glossary.v1", "collections": collections})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
file := filepath.Join(t.TempDir(), "shared.json")
|
||||||
|
if err := os.WriteFile(file, data, 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
got, _, err := Load(context.Background(), ck.Input{Source: ck.NoSource()}, Options{
|
||||||
|
GlossaryFiles: []string{file},
|
||||||
|
Overrides: []ck.Override{{Path: ck.Keys("context", "description"), Value: "batch", Flag: "--set"}},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if len(got.Config.Application.GlossaryCollections) != len(collections) {
|
||||||
|
t.Fatalf("loaded %d collections, want %d", len(got.Config.Application.GlossaryCollections), len(collections))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRuntimeGlossaryPresence(t *testing.T) {
|
func TestRuntimeGlossaryPresence(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
name, body string
|
name, body string
|
||||||
wantInstruction string
|
valid bool
|
||||||
wantEntries int
|
wantEntries int
|
||||||
}{
|
}{
|
||||||
{"omitted", "party: {}\n", "original", 1},
|
{"empty", "party: {entries: []}", true, 0},
|
||||||
{"empty", "party: {instruction: '', entries: []}\n", "", 0},
|
{"missing entries", "party: {}", false, 0},
|
||||||
{"null entries", "party: {entries: null}\n", "original", 0},
|
{"null entries", "party: {entries: null}", false, 0},
|
||||||
|
{"empty collections", "", true, 1},
|
||||||
} {
|
} {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
@@ -120,15 +154,28 @@ func TestRuntimeGlossaryPresence(t *testing.T) {
|
|||||||
if err := os.WriteFile(main, []byte("glossary_collections:\n party:\n instruction: original\n entries: [{id: a, name: A, category: C}]\n"), 0644); err != nil {
|
if err := os.WriteFile(main, []byte("glossary_collections:\n party:\n instruction: original\n entries: [{id: a, name: A, category: C}]\n"), 0644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(incoming, []byte(tc.body), 0644); err != nil {
|
body := "schema_version: maximumdirect.glossary.v1\ncollections:"
|
||||||
|
if tc.body == "" {
|
||||||
|
body += " {}\n"
|
||||||
|
} else {
|
||||||
|
body += "\n " + tc.body + "\n"
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(incoming, []byte(body), 0644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
got, _, err := Load(context.Background(), ck.Input{Source: ck.File(main)}, Options{GlossaryFiles: []string{incoming}})
|
got, _, err := Load(context.Background(), ck.Input{Source: ck.File(main)}, Options{GlossaryFiles: []string{incoming}})
|
||||||
|
if !tc.valid {
|
||||||
|
var inputErr *GlossaryInputError
|
||||||
|
if !errors.As(err, &inputErr) {
|
||||||
|
t.Fatalf("expected glossary input error, got %v", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%v: %+v", err, err.(*ck.LoadError).Diagnostics())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
party := got.Config.Application.GlossaryCollections["party"]
|
party := got.Config.Application.GlossaryCollections["party"]
|
||||||
if party.Instruction != tc.wantInstruction || len(party.Entries) != tc.wantEntries {
|
if party.Instruction != "original" || len(party.Entries) != tc.wantEntries {
|
||||||
t.Fatalf("party = %+v", party)
|
t.Fatalf("party = %+v", party)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Upstream compatibility guidance
|
||||||
|
|
||||||
|
See the [compatibility guide from the selected schemas distribution](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/compatibility.md).
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Upstream validation guidance
|
||||||
|
|
||||||
|
See the [validation guide from the selected schemas distribution](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/validation.md).
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
campaign:
|
||||||
|
entries:
|
||||||
|
- id: lighthouse
|
||||||
|
name: Glass Lantern
|
||||||
|
category: place
|
||||||
|
aliases: [The Lantern]
|
||||||
|
description: A fictional lighthouse at the entrance to the bay.
|
||||||
|
spells:
|
||||||
|
provenance:
|
||||||
|
id: lantern-coast-original
|
||||||
|
title: Synthetic campaign spells
|
||||||
|
version: "1"
|
||||||
|
license: CC0-1.0
|
||||||
|
entries:
|
||||||
|
- id: ember-veil
|
||||||
|
name: Ember Veil
|
||||||
|
category: spell
|
||||||
|
aliases: [Veil of Embers]
|
||||||
|
casting_time: one action
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
clubs:
|
||||||
|
sport: association football
|
||||||
|
entries:
|
||||||
|
- id: harbour
|
||||||
|
name: Harbour Wanderers
|
||||||
|
category: club
|
||||||
|
aliases: []
|
||||||
|
plural: null
|
||||||
|
home_ground: Lantern Park
|
||||||
|
venues:
|
||||||
|
entries:
|
||||||
|
- id: harbour
|
||||||
|
name: Lantern Park
|
||||||
|
category: venue
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"schema_version": "maximumdirect.glossary.v1",
|
||||||
|
"collections": {
|
||||||
|
"measurements": {
|
||||||
|
"unit_system": "metric",
|
||||||
|
"entries": [
|
||||||
|
{"id": "temperature", "name": "Air temperature", "category": "measurement", "aliases": ["Temperature"], "unit": "degree Celsius"},
|
||||||
|
{"id": "precipitation", "name": "Precipitation", "category": "measurement", "aliases": null, "unit": "millimetre"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
measurements:
|
||||||
|
unit_system: metric
|
||||||
|
entries:
|
||||||
|
- id: temperature
|
||||||
|
name: Air temperature
|
||||||
|
category: measurement
|
||||||
|
aliases: [Temperature]
|
||||||
|
unit: degree Celsius
|
||||||
|
- id: precipitation
|
||||||
|
name: Precipitation
|
||||||
|
category: measurement
|
||||||
|
aliases: null
|
||||||
|
unit: millimetre
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
|
"$id": "https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json",
|
||||||
|
"title": "MAXIMUMDIRECT Glossary v1",
|
||||||
|
"type": "object",
|
||||||
|
"required": ["schema_version", "collections"],
|
||||||
|
"properties": {
|
||||||
|
"schema_version": {"const": "maximumdirect.glossary.v1"},
|
||||||
|
"collections": {
|
||||||
|
"type": "object",
|
||||||
|
"propertyNames": {"minLength": 1},
|
||||||
|
"additionalProperties": {"$ref": "#/$defs/collection"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$defs": {
|
||||||
|
"text": {"type": "string", "minLength": 1},
|
||||||
|
"aliases": {"type": ["array", "null"], "items": {"$ref": "#/$defs/text"}},
|
||||||
|
"entry": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "name", "category"],
|
||||||
|
"properties": {
|
||||||
|
"id": {"$ref": "#/$defs/text"},
|
||||||
|
"name": {"$ref": "#/$defs/text"},
|
||||||
|
"category": {"$ref": "#/$defs/text"},
|
||||||
|
"description": {"type": "string"},
|
||||||
|
"aliases": {"$ref": "#/$defs/aliases"},
|
||||||
|
"plural": {"type": ["string", "null"], "minLength": 1}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"provenance": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {"$ref": "#/$defs/text"},
|
||||||
|
"title": {"$ref": "#/$defs/text"},
|
||||||
|
"version": {"type": "string"},
|
||||||
|
"url": {"type": "string"},
|
||||||
|
"license": {"type": "string"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"partialCollection": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {"type": "array", "items": {"$ref": "#/$defs/entry"}},
|
||||||
|
"provenance": {"$ref": "#/$defs/provenance"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"collection": {
|
||||||
|
"allOf": [{"$ref": "#/$defs/partialCollection"}, {"required": ["entries"]}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# Glossary contract
|
||||||
|
|
||||||
|
## Native loading boundary
|
||||||
|
|
||||||
|
Full conformance includes acquisition through the public mapping-root handoff of
|
||||||
|
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
|
||||||
|
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
|
||||||
|
controls, numeric binding, and resource limits, including its 8 MiB source limit.
|
||||||
|
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
|
||||||
|
authored decimal precision is not guaranteed. Preserve supported resolved values.
|
||||||
|
`extends` is structural input and source-root `config` is a control namespace;
|
||||||
|
nested ordinary `config` follows upstream rules. Other supported domain extensions
|
||||||
|
remain permitted. Schema validation adds no trimming, case folding, or defaults.
|
||||||
|
Structural validation alone does not prove native loading compatibility. The
|
||||||
|
pinned upstream contract defines this version's boundary independently of later
|
||||||
|
changes to the repository's general guidance.
|
||||||
|
|
||||||
|
Contract: `maximumdirect.glossary.v1`. [Schema](schema.json).
|
||||||
|
The [validation profile](../../docs/validation.md) and [compatibility rules](../../docs/compatibility.md)
|
||||||
|
apply. Start with [campaign vocabulary](examples/glossary.yml),
|
||||||
|
[weather](examples/weather.yml), or [sports](examples/sports.yml).
|
||||||
|
|
||||||
|
| Field | Required | Meaning |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `schema_version` | Yes | Exactly `maximumdirect.glossary.v1`. |
|
||||||
|
| `collections` | Yes | Mapping of nonempty collection names to collections; may be empty. |
|
||||||
|
| `collections.<name>.entries` | Yes | List of entries; may be empty. |
|
||||||
|
| `entries[].id` | Yes | Stable, nonempty identity unique within this collection. |
|
||||||
|
| `entries[].name` | Yes | Nonempty canonical display name. |
|
||||||
|
| `entries[].category` | Yes | Nonempty domain-defined category. |
|
||||||
|
| `entries[].description` | No | Description; an empty string is valid. |
|
||||||
|
| `entries[].aliases` | No | Alternative names for the same entity. May be null, empty, or a list of nonempty strings. |
|
||||||
|
| `entries[].plural` | No | Nonempty plural display form, or null. |
|
||||||
|
| `collections.<name>.provenance` | No | Source metadata object, possibly empty. Optional `id` and `title` are nonempty strings; optional `version`, `url`, and `license` are strings that may be empty. |
|
||||||
|
|
||||||
|
All objects permit extensions. Optional fields accept omission; only `aliases`
|
||||||
|
and `plural` additionally accept null. Supported resolved values are preserved; schema validation adds no trimming,
|
||||||
|
case folding, coercion, or defaults. IDs and names compare exactly. Distinct
|
||||||
|
collections can reuse an ID. Display names, aliases, and categories need not be
|
||||||
|
unique. Lists retain their authored order but establish no precedence or execution
|
||||||
|
order. Collection names and categories are strings chosen by the domain, not a
|
||||||
|
fixed set of D&D labels.
|
||||||
|
|
||||||
|
For example, `spells` entries contain names, aliases, and optionally extended
|
||||||
|
domain information such as `casting_time`. Their collection's provenance can
|
||||||
|
identify a source catalog. Domain-specific metadata can use extension fields.
|
||||||
|
Provenance describes origin and applicability;
|
||||||
|
it is not transcript evidence or a spell rule. If different source contexts
|
||||||
|
matter, use separately named collections with their own provenance. A consumer
|
||||||
|
can derive its recognition input from these entries instead of requiring a second
|
||||||
|
operator-maintained spell list. Embedded vocabulary, source precedence,
|
||||||
|
normalization, inference, and conflicts remain consumer policy.
|
||||||
|
|
||||||
|
Entry-ID uniqueness is a semantic rule checked separately from JSON Schema.
|
||||||
|
The [validator](../../docs/validation.md) performs both checks. No cross-document identity or
|
||||||
|
reference-resolution check is part of this initial contract.
|
||||||
|
|
||||||
|
## Extensions and task instructions
|
||||||
|
|
||||||
|
Extensions describe domain information. Consumers forwarding a shared document
|
||||||
|
should retain them; task-specific projections may intentionally omit them.
|
||||||
|
Acceptance and preservation do not claim interpretation. Defined fields retain
|
||||||
|
their schema constraints in an extended document.
|
||||||
|
|
||||||
|
Task instructions belong to consumer configuration. `instruction` is not a
|
||||||
|
defined field in this contract. Like other unknown fields, it can be retained
|
||||||
|
without acquiring instruction semantics. Maintained examples contain domain
|
||||||
|
data only.
|
||||||
|
|
||||||
|
## Authoring contributions
|
||||||
|
|
||||||
|
`#/$defs/partialCollection` is an editor-assistance definition with optional
|
||||||
|
`entries`. `#/$defs/entry` and `#/$defs/collection` assist entry and complete
|
||||||
|
collection editing. A partial contribution is not a standalone valid domain
|
||||||
|
document. ConfigKit owns imports, inheritance, and composition before validation
|
||||||
|
of the complete envelope.
|
||||||
|
|
||||||
|
## Differences from the reference catalog and Audita v4.2
|
||||||
|
|
||||||
|
The old format maps collection names directly at the root. The shared format
|
||||||
|
requires `schema_version` and `collections`. It removes defined collection
|
||||||
|
instructions, permits structural extensions, and adds defined provenance.
|
||||||
|
Existing consumers must explicitly adopt this envelope and its semantics.
|
||||||
77
internal/appconfig/sharedglossary/load.go
Normal file
77
internal/appconfig/sharedglossary/load.go
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
package sharedglossary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/santhosh-tekuri/jsonschema/v6"
|
||||||
|
|
||||||
|
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
||||||
|
ck "go.maximumdirect.net/configkit"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Load composes ordered shared documents and validates the completed envelope.
|
||||||
|
// A nil result means no documents were supplied.
|
||||||
|
func Load(ctx context.Context, inputs []ck.Input) (*ck.Result[map[string]any], error) {
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(inputs) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
validator, err := NewValidator()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
underlays := make([]ck.Underlay, 0, len(inputs)-1)
|
||||||
|
for _, input := range inputs[:len(inputs)-1] {
|
||||||
|
input.Imports = true
|
||||||
|
underlays = append(underlays, ck.Underlay{Inputs: []ck.Input{input}})
|
||||||
|
}
|
||||||
|
main := inputs[len(inputs)-1]
|
||||||
|
main.Imports = true
|
||||||
|
result, err := ck.LoadLayered(main, ck.LayeredOptions[map[string]any]{
|
||||||
|
Definition: ck.Definition[map[string]any]{
|
||||||
|
SequenceIdentities: []ck.SequenceIdentity{config.GlossaryEntryIdentity(ck.SequenceSelector{ck.SequenceLiteralKey("collections")})},
|
||||||
|
Validate: func(document *map[string]any, validation *ck.Validation) {
|
||||||
|
if err := validator.Validate(*document, "input"); err != nil {
|
||||||
|
var schemaError *jsonschema.ValidationError
|
||||||
|
if errors.As(err, &schemaError) {
|
||||||
|
reportSchemaError(validation, schemaError)
|
||||||
|
} else {
|
||||||
|
validation.Error(ck.Keys(), err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Underlays: underlays,
|
||||||
|
})
|
||||||
|
if canceled := ctx.Err(); canceled != nil {
|
||||||
|
return nil, errors.Join(err, canceled)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func reportSchemaError(validation *ck.Validation, err *jsonschema.ValidationError) {
|
||||||
|
if len(err.Causes) > 0 {
|
||||||
|
for _, cause := range err.Causes {
|
||||||
|
reportSchemaError(validation, cause)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
path := ck.Keys()
|
||||||
|
if len(err.InstanceLocation) > 0 {
|
||||||
|
segments := make([]string, len(err.InstanceLocation))
|
||||||
|
for i, segment := range err.InstanceLocation {
|
||||||
|
segments[i] = strings.ReplaceAll(strings.ReplaceAll(segment, "~", "~0"), "/", "~1")
|
||||||
|
}
|
||||||
|
// Escaped instance segments always form a valid JSON Pointer. Parsing
|
||||||
|
// leaves numeric keys/indexes for ConfigKit to resolve against the data.
|
||||||
|
path, _ = ck.ParsePath("/" + strings.Join(segments, "/"))
|
||||||
|
}
|
||||||
|
validation.Error(path, err.Error())
|
||||||
|
}
|
||||||
223
internal/appconfig/sharedglossary/load_test.go
Normal file
223
internal/appconfig/sharedglossary/load_test.go
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
package sharedglossary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
ck "go.maximumdirect.net/configkit"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestLoadComposition(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
files := map[string]string{
|
||||||
|
"first.yml": `config:
|
||||||
|
imports: [{path: fragment.yml, required: true}]
|
||||||
|
schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
people:
|
||||||
|
entries:
|
||||||
|
- {id: one, name: Old, category: person}
|
||||||
|
- {id: two, name: Two, category: person}
|
||||||
|
places:
|
||||||
|
entries: []
|
||||||
|
`,
|
||||||
|
"fragment.yml": `collections:
|
||||||
|
lore:
|
||||||
|
entries: [{id: lore, name: Lore, category: topic}]
|
||||||
|
`,
|
||||||
|
"second.yml": `schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
people:
|
||||||
|
entries: [{id: one, name: New, category: person}]
|
||||||
|
`,
|
||||||
|
"third.json": `{"schema_version":"maximumdirect.glossary.v1","collections":{"spells":{"entries":[{"id":"one","name":"Spell","category":"spell"}]}}}`,
|
||||||
|
}
|
||||||
|
for name, body := range files {
|
||||||
|
if err := os.WriteFile(filepath.Join(dir, name), []byte(body), 0644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, tc := range []struct {
|
||||||
|
name string
|
||||||
|
files []string
|
||||||
|
collections []string
|
||||||
|
}{
|
||||||
|
{"one multi collection file", []string{"first.yml"}, []string{"people", "places", "lore"}},
|
||||||
|
{"multiple single collection files", []string{"second.yml", "third.json"}, []string{"people", "spells"}},
|
||||||
|
{"mixed files", []string{"first.yml", "second.yml", "third.json"}, []string{"people", "places", "lore", "spells"}},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
var inputs []ck.Input
|
||||||
|
for _, name := range tc.files {
|
||||||
|
inputs = append(inputs, ck.Input{Source: ck.File(filepath.Join(dir, name))})
|
||||||
|
}
|
||||||
|
result, err := Load(context.Background(), inputs)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
collections := result.Config["collections"].(map[string]any)
|
||||||
|
for _, name := range tc.collections {
|
||||||
|
if _, ok := collections[name]; !ok {
|
||||||
|
t.Errorf("missing collection %s in %v", name, collections)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if slices.Contains(tc.files, "first.yml") {
|
||||||
|
var paths []string
|
||||||
|
for _, source := range result.Sources() {
|
||||||
|
paths = append(paths, source.Path)
|
||||||
|
}
|
||||||
|
if !slices.Contains(paths, filepath.Join(dir, "fragment.yml")) {
|
||||||
|
t.Errorf("missing imported source: %v", paths)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if slices.Contains(tc.files, "first.yml") && slices.Contains(tc.files, "second.yml") {
|
||||||
|
entries := collections["people"].(map[string]any)["entries"].([]any)
|
||||||
|
if len(entries) != 2 || entries[0].(map[string]any)["name"] != "New" {
|
||||||
|
t.Fatalf("layered entries = %#v", entries)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadErrorsAndEmptyInput(t *testing.T) {
|
||||||
|
result, err := Load(context.Background(), nil)
|
||||||
|
if err != nil || result != nil {
|
||||||
|
t.Fatalf("no inputs = %v, %v", result, err)
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
cancel()
|
||||||
|
if _, err := Load(ctx, nil); !errors.Is(err, context.Canceled) {
|
||||||
|
t.Fatalf("cancellation = %v", err)
|
||||||
|
}
|
||||||
|
dir := t.TempDir()
|
||||||
|
for _, tc := range []struct{ name, body, contains string }{
|
||||||
|
{"duplicates", "schema_version: maximumdirect.glossary.v1\ncollections:\n people:\n entries: [{id: a, name: A, category: person}, {id: a, name: B, category: person}]\n", "a"},
|
||||||
|
{"missing marker", "collections: {}\n", "schema_version"},
|
||||||
|
{"invalid type", "schema_version: maximumdirect.glossary.v1\ncollections: []\n", "collections"},
|
||||||
|
{"unsupported input", "schema_version: !!str maximumdirect.glossary.v1\ncollections: {}\n", ""},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
path := filepath.Join(dir, strings.ReplaceAll(tc.name, " ", "_")+".yml")
|
||||||
|
if err := os.WriteFile(path, []byte(tc.body), 0644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
_, err := Load(context.Background(), []ck.Input{{Source: ck.File(path)}})
|
||||||
|
var loadErr *ck.LoadError
|
||||||
|
if !errors.As(err, &loadErr) {
|
||||||
|
t.Fatalf("expected native load error, got %v", err)
|
||||||
|
}
|
||||||
|
var messages []string
|
||||||
|
for _, diagnostic := range loadErr.Diagnostics() {
|
||||||
|
messages = append(messages, diagnostic.Message)
|
||||||
|
}
|
||||||
|
if !strings.Contains(strings.Join(messages, " "), tc.contains) {
|
||||||
|
t.Fatalf("diagnostics = %v", messages)
|
||||||
|
}
|
||||||
|
var paths []string
|
||||||
|
for _, source := range loadErr.Sources() {
|
||||||
|
paths = append(paths, source.Path)
|
||||||
|
}
|
||||||
|
if !slices.Contains(paths, path) {
|
||||||
|
t.Fatalf("missing source context: %v", paths)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSchemaFailureUsesContributingSource(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
first := filepath.Join(dir, "first.yml")
|
||||||
|
last := filepath.Join(dir, "last.yml")
|
||||||
|
if err := os.WriteFile(last, []byte("schema_version: maximumdirect.glossary.v1\ncollections: {}\n"), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, tc := range []struct{ name, entry, path string }{
|
||||||
|
{"invalid value", "{id: a, name: 17, category: person}", "/collections/7~1~0/entries/0/name"},
|
||||||
|
{"missing field", "{id: a, category: person}", "/collections/7~1~0/entries/0"},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
body := "schema_version: maximumdirect.glossary.v1\ncollections:\n '7/~':\n entries: [" + tc.entry + "]\n"
|
||||||
|
if err := os.WriteFile(first, []byte(body), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
_, err := Load(context.Background(), []ck.Input{{Source: ck.File(first)}, {Source: ck.File(last)}})
|
||||||
|
var loadErr *ck.LoadError
|
||||||
|
if !errors.As(err, &loadErr) {
|
||||||
|
t.Fatalf("expected native load error, got %v", err)
|
||||||
|
}
|
||||||
|
sources := make(map[string]string)
|
||||||
|
for _, source := range loadErr.Sources() {
|
||||||
|
sources[source.ID] = source.Path
|
||||||
|
}
|
||||||
|
diagnostics := loadErr.Diagnostics()
|
||||||
|
if len(diagnostics) != 1 || diagnostics[0].Path.String() != tc.path {
|
||||||
|
t.Fatalf("unexpected diagnostics: %+v", diagnostics)
|
||||||
|
}
|
||||||
|
location := diagnostics[0].Primary
|
||||||
|
if location == nil || sources[location.SourceID] != first {
|
||||||
|
t.Fatalf("diagnostic points to %v with sources %v", location, sources)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadResolvesInheritanceAndPreservesExtensions(t *testing.T) {
|
||||||
|
path := filepath.Join(t.TempDir(), "shared.yml")
|
||||||
|
body := `schema_version: maximumdirect.glossary.v1
|
||||||
|
custom: {revision: 1, ratio: 1.5}
|
||||||
|
collections:
|
||||||
|
original:
|
||||||
|
provenance: {title: Synthetic source, custom: true}
|
||||||
|
entries: [{id: a, name: Alpha, category: spell, rank: 1}]
|
||||||
|
derived:
|
||||||
|
extends: original
|
||||||
|
instruction: {text: data}
|
||||||
|
`
|
||||||
|
if err := os.WriteFile(path, []byte(body), 0644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
result, err := Load(context.Background(), []ck.Input{{Source: ck.File(path)}})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
collections := result.Config["collections"].(map[string]any)
|
||||||
|
derived := collections["derived"].(map[string]any)
|
||||||
|
entries := derived["entries"].([]any)
|
||||||
|
if len(entries) != 1 || entries[0].(map[string]any)["rank"] != int64(1) || derived["provenance"].(map[string]any)["title"] != "Synthetic source" || derived["instruction"].(map[string]any)["text"] != "data" {
|
||||||
|
t.Fatalf("resolved data = %#v", result.Config)
|
||||||
|
}
|
||||||
|
custom := result.Config["custom"].(map[string]any)
|
||||||
|
if custom["revision"] != int64(1) || custom["ratio"] != 1.5 {
|
||||||
|
t.Fatalf("extensions = %#v", custom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestEquivalentYAMLAndJSON(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
documents := map[string]string{
|
||||||
|
"input.yml": "schema_version: maximumdirect.glossary.v1\ncollections:\n terms:\n entries: [{id: a, name: Alpha, category: term}, {id: A, name: Alpha, category: term}]\n",
|
||||||
|
"input.json": `{"schema_version":"maximumdirect.glossary.v1","collections":{"terms":{"entries":[{"id":"a","name":"Alpha","category":"term"},{"id":"A","name":"Alpha","category":"term"}]}}}`,
|
||||||
|
}
|
||||||
|
var results []map[string]any
|
||||||
|
for name, body := range documents {
|
||||||
|
path := filepath.Join(dir, name)
|
||||||
|
if err := os.WriteFile(path, []byte(body), 0644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
result, err := Load(context.Background(), []ck.Input{{Source: ck.File(path)}})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
results = append(results, result.Config)
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(results[0], results[1]) {
|
||||||
|
t.Fatalf("documents differ: %#v, %#v", results[0], results[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
52
internal/appconfig/sharedglossary/schema.go
Normal file
52
internal/appconfig/sharedglossary/schema.go
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// Package sharedglossary implements the boundary for shared glossary documents.
|
||||||
|
package sharedglossary
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/santhosh-tekuri/jsonschema/v6"
|
||||||
|
)
|
||||||
|
|
||||||
|
const schemaID = "https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json"
|
||||||
|
|
||||||
|
//go:embed assets/glossary/v0.2.0/schema.json
|
||||||
|
var schemaData []byte
|
||||||
|
|
||||||
|
// Validator validates completed shared glossary envelopes.
|
||||||
|
type Validator struct {
|
||||||
|
schema *jsonschema.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewValidator compiles the locally bundled schema for reuse.
|
||||||
|
func NewValidator() (*Validator, error) {
|
||||||
|
var document any
|
||||||
|
if err := json.Unmarshal(schemaData, &document); err != nil {
|
||||||
|
return nil, fmt.Errorf("decode shared glossary schema: %w", err)
|
||||||
|
}
|
||||||
|
compiler := jsonschema.NewCompiler()
|
||||||
|
compiler.UseLoader(offlineLoader{})
|
||||||
|
if err := compiler.AddResource(schemaID, document); err != nil {
|
||||||
|
return nil, fmt.Errorf("register shared glossary schema: %w", err)
|
||||||
|
}
|
||||||
|
schema, err := compiler.Compile(schemaID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("compile shared glossary schema: %w", err)
|
||||||
|
}
|
||||||
|
return &Validator{schema: schema}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate checks an envelope without modifying it, retaining source context.
|
||||||
|
func (v *Validator) Validate(document map[string]any, source string) error {
|
||||||
|
if err := v.schema.Validate(document); err != nil {
|
||||||
|
return fmt.Errorf("shared glossary %s: %w", source, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type offlineLoader struct{}
|
||||||
|
|
||||||
|
func (offlineLoader) Load(url string) (any, error) {
|
||||||
|
return nil, fmt.Errorf("unregistered schema resource %q", url)
|
||||||
|
}
|
||||||
81
internal/appconfig/sharedglossary/schema_test.go
Normal file
81
internal/appconfig/sharedglossary/schema_test.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package sharedglossary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"go.yaml.in/yaml/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestValidate(t *testing.T) {
|
||||||
|
validator, err := NewValidator()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, tc := range []struct {
|
||||||
|
name, document, location string
|
||||||
|
valid bool
|
||||||
|
}{
|
||||||
|
{"ordinary", `{"schema_version":"maximumdirect.glossary.v1","collections":{"terms":{"entries":[{"id":"one","name":"One","category":"number"}]}}}`, "", true},
|
||||||
|
{"empty collections", `{"schema_version":"maximumdirect.glossary.v1","collections":{}}`, "", true},
|
||||||
|
{"nullable and extensions", `{"schema_version":"maximumdirect.glossary.v1","extra":true,"collections":{"terms":{"instruction":42,"provenance":{"extra":true},"entries":[{"id":"one","name":"One","category":"number","aliases":null,"plural":null,"extra":{"n":1}}]}}}`, "", true},
|
||||||
|
{"missing marker", `{"collections":{}}`, "schema_version", false},
|
||||||
|
{"wrong marker", `{"schema_version":"wrong","collections":{}}`, "schema_version", false},
|
||||||
|
{"missing entries", `{"schema_version":"maximumdirect.glossary.v1","collections":{"terms":{}}}`, "entries", false},
|
||||||
|
{"invalid name", `{"schema_version":"maximumdirect.glossary.v1","collections":{"terms":{"entries":[{"id":"one","name":3,"category":"number"}]}}}`, "name", false},
|
||||||
|
{"invalid aliases", `{"schema_version":"maximumdirect.glossary.v1","collections":{"terms":{"entries":[{"id":"one","name":"One","category":"number","aliases":3}]}}}`, "aliases", false},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
var document, before map[string]any
|
||||||
|
if err := json.Unmarshal([]byte(tc.document), &document); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal([]byte(tc.document), &before); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
err := validator.Validate(document, "example.yml")
|
||||||
|
if (err == nil) != tc.valid {
|
||||||
|
t.Fatalf("Validate() = %v", err)
|
||||||
|
}
|
||||||
|
if !tc.valid && (!strings.Contains(err.Error(), "example.yml") || !strings.Contains(err.Error(), tc.location)) {
|
||||||
|
t.Fatalf("error lacks source or field location: %v", err)
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(document, before) {
|
||||||
|
t.Fatal("validation modified the document")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBundledExamples(t *testing.T) {
|
||||||
|
validator, err := NewValidator()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, name := range []string{"glossary.yml", "sports.yml", "weather.yml", "weather.json"} {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
path := filepath.Join("assets", "glossary", "v0.2.0", "examples", name)
|
||||||
|
data, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var document map[string]any
|
||||||
|
if err := yaml.Unmarshal(data, &document); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := validator.Validate(document, path); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestOfflineLoader(t *testing.T) {
|
||||||
|
if _, err := (offlineLoader{}).Load("https://example.invalid/schema.json"); err == nil {
|
||||||
|
t.Fatal("unregistered resource was accepted")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,7 +101,7 @@ func buildApplication(extra ...commandkit.Declaration) (*commandkit.App, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildApplicationWithClient(client *http.Client, extra ...commandkit.Declaration) (*commandkit.App, error) {
|
func buildApplicationWithClient(client *http.Client, extra ...commandkit.Declaration) (*commandkit.App, error) {
|
||||||
selector := commandkit.RepeatFlag(commandkit.FlagMeta{Name: "glossary-file", Usage: "Runtime glossary file (repeatable)."}, nil, func(s string) (string, error) { return s, nil }, func(in *acquisitionInput, value commandkit.Supplied[[]string]) { in.GlossaryFiles = value.Value })
|
selector := commandkit.RepeatFlag(commandkit.FlagMeta{Name: "glossary-file", Usage: "Shared glossary YAML or JSON file (repeatable)."}, nil, func(s string) (string, error) { return s, nil }, func(in *acquisitionInput, value commandkit.Supplied[[]string]) { in.GlossaryFiles = value.Value })
|
||||||
appScope := ckconfig.FromConfigKit("app", "Audita application settings.", loadApplication)
|
appScope := ckconfig.FromConfigKit("app", "Audita application settings.", loadApplication)
|
||||||
appScope.Features.Overrides = true
|
appScope.Features.Overrides = true
|
||||||
appScope = shareComparisonGlossaries(withBootstrapContext(appScope))
|
appScope = shareComparisonGlossaries(withBootstrapContext(appScope))
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ func TestPromptEngineCacheIncludesRuntimeGlossaryInput(t *testing.T) {
|
|||||||
main := filepath.Join(dir, "main.yml")
|
main := filepath.Join(dir, "main.yml")
|
||||||
first := filepath.Join(dir, "first.yml")
|
first := filepath.Join(dir, "first.yml")
|
||||||
second := filepath.Join(dir, "second.yml")
|
second := filepath.Join(dir, "second.yml")
|
||||||
for path, contents := range map[string]string{main: "version: 3\n", first: "one: {entries: []}\n", second: "two: {entries: []}\n"} {
|
for path, contents := range map[string]string{main: "version: 3\n", first: "schema_version: maximumdirect.glossary.v1\ncollections: {one: {entries: []}}\n", second: "schema_version: maximumdirect.glossary.v1\ncollections: {two: {entries: []}}\n"} {
|
||||||
if err := os.WriteFile(path, []byte(contents), 0600); err != nil {
|
if err := os.WriteFile(path, []byte(contents), 0600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -63,7 +64,11 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
|
|||||||
t.Setenv("AUDITA_EXAMPLE_KEY", "")
|
t.Setenv("AUDITA_EXAMPLE_KEY", "")
|
||||||
main = filepath.Join(dir, "config.yml")
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -159,7 +164,7 @@ func TestExamplePromptEditIsCapturedOnNextLoad(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
inspect := func() string {
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -251,10 +256,36 @@ func TestRuntimeGlossaryExampleWorkflow(t *testing.T) {
|
|||||||
args = append([]string{"process"}, common...)
|
args = append([]string{"process"}, common...)
|
||||||
args = append(args, "--output", filepath.Join(dir, "output.json"), filepath.Join(dir, "transcript.json"))
|
args = append(args, "--output", filepath.Join(dir, "output.json"), filepath.Join(dir, "transcript.json"))
|
||||||
result = app.Execute(context.Background(), args, commandkit.Streams{Out: &out, Err: &stderr})
|
result = app.Execute(context.Background(), args, commandkit.Streams{Out: &out, Err: &stderr})
|
||||||
if result.Status != 0 || !strings.Contains(seen, "Mira Chen") || !strings.Contains(seen, "North Observatory") || !strings.Contains(seen, "speaker's preferred spelling") || !strings.Contains(seen, "Preserve established place names") {
|
if result.Status != 0 || !strings.Contains(seen, "Mira Chen") || !strings.Contains(seen, "North Observatory") || !strings.Contains(seen, "Preserve established place names") {
|
||||||
t.Fatalf("processing %d seen=%s stderr=%s", result.Status, seen, stderr.String())
|
t.Fatalf("processing %d seen=%s stderr=%s", result.Status, seen, stderr.String())
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(filepath.Join(dir, "output.json")); err != nil {
|
if _, err := os.Stat(filepath.Join(dir, "output.json")); err != nil {
|
||||||
t.Fatal(err)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func TestPreflightBindingsAndRunAlias(t *testing.T) {
|
|||||||
for name, contents := range map[string]string{
|
for name, contents := range map[string]string{
|
||||||
"config.yml": "version: 3\npipeline: {stages: []}\nreporting: {enabled: false}\n",
|
"config.yml": "version: 3\npipeline: {stages: []}\nreporting: {enabled: false}\n",
|
||||||
"transcript.json": `[{"speaker":"Alice","start":0,"end":1,"text":"hello"}]`,
|
"transcript.json": `[{"speaker":"Alice","start":0,"end":1,"text":"hello"}]`,
|
||||||
"glossary.yml": "party: {entries: [{id: alice, name: Alice, category: person}]}\n",
|
"glossary.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: [{id: alice, name: Alice, category: person}]}}\n",
|
||||||
"overlays/local.yml": "context: {description: Local example}\n",
|
"overlays/local.yml": "context: {description: Local example}\n",
|
||||||
} {
|
} {
|
||||||
path := filepath.Join(dir, name)
|
path := filepath.Join(dir, name)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type processInput struct {
|
|||||||
func processingFlags() []commandkit.Flag[processInput] {
|
func processingFlags() []commandkit.Flag[processInput] {
|
||||||
stringValue := func(s string) (string, error) { return s, nil }
|
stringValue := func(s string) (string, error) { return s, nil }
|
||||||
flags := []commandkit.Flag[processInput]{
|
flags := []commandkit.Flag[processInput]{
|
||||||
commandkit.RepeatFlag(commandkit.FlagMeta{Name: "glossary-file", Usage: "Runtime glossary file (repeatable)."}, nil, stringValue, func(in *processInput, v commandkit.Supplied[[]string]) { in.GlossaryFiles = v.Value }),
|
commandkit.RepeatFlag(commandkit.FlagMeta{Name: "glossary-file", Usage: "Shared glossary YAML or JSON file (repeatable)."}, nil, stringValue, func(in *processInput, v commandkit.Supplied[[]string]) { in.GlossaryFiles = v.Value }),
|
||||||
commandkit.ValueFlag(commandkit.FlagMeta{Name: "config", Usage: "Application configuration file."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Config = v }),
|
commandkit.ValueFlag(commandkit.FlagMeta{Name: "config", Usage: "Application configuration file."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Config = v }),
|
||||||
commandkit.ValueFlag(commandkit.FlagMeta{Name: "overlay", Usage: "Configuration overlay."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Overlay = v }),
|
commandkit.ValueFlag(commandkit.FlagMeta{Name: "overlay", Usage: "Configuration overlay."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Overlay = v }),
|
||||||
commandkit.ValueFlag(commandkit.FlagMeta{Name: "output", Usage: "Transcript output file."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Output = v }),
|
commandkit.ValueFlag(commandkit.FlagMeta{Name: "output", Usage: "Transcript output file."}, (*string)(nil), stringValue, func(in *processInput, v commandkit.Supplied[string]) { in.Output = v }),
|
||||||
|
|||||||
@@ -72,11 +72,6 @@ func TestProcessingUsesPerEntryProfilesInOrder(t *testing.T) {
|
|||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
files := map[string]string{
|
files := map[string]string{
|
||||||
"config.yml": `version: 3
|
"config.yml": `version: 3
|
||||||
glossary_collections:
|
|
||||||
party:
|
|
||||||
entries: [{id: alice, name: Alice, category: person}]
|
|
||||||
spells:
|
|
||||||
entries: [{id: shield, name: Shield, category: spell}]
|
|
||||||
protected_terms: [party, spells]
|
protected_terms: [party, spells]
|
||||||
llm: {validation_profile: review}
|
llm: {validation_profile: review}
|
||||||
pipeline:
|
pipeline:
|
||||||
@@ -92,6 +87,15 @@ pipeline:
|
|||||||
- module: grammar
|
- module: grammar
|
||||||
glossaries: [party, spells]
|
glossaries: [party, spells]
|
||||||
llm: {proposal_profile: three}
|
llm: {proposal_profile: three}
|
||||||
|
`,
|
||||||
|
"shared.yml": `schema_version: maximumdirect.glossary.v1
|
||||||
|
collections:
|
||||||
|
party:
|
||||||
|
entries: [{id: alice, name: Alice, category: person}]
|
||||||
|
spells:
|
||||||
|
entries: [{id: shield, name: Shield, category: spell}]
|
||||||
|
unused:
|
||||||
|
entries: [{id: unused, name: Unselected, category: topic}]
|
||||||
`,
|
`,
|
||||||
"prompts.yml": fmt.Sprintf("profiles:\n - {id: one, endpoint: %q, model: model-one, api_key_required: false}\n - {id: two, endpoint: %q, model: model-two, api_key_required: false}\n - {id: three, endpoint: %q, model: model-three, api_key_required: false}\n - {id: review, endpoint: %q, model: review, api_key_required: false}\n", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1"),
|
"prompts.yml": fmt.Sprintf("profiles:\n - {id: one, endpoint: %q, model: model-one, api_key_required: false}\n - {id: two, endpoint: %q, model: model-two, api_key_required: false}\n - {id: three, endpoint: %q, model: model-three, api_key_required: false}\n - {id: review, endpoint: %q, model: review, api_key_required: false}\n", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1", "https://example.invalid/v1"),
|
||||||
"transcript.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Alyce casts Sheeld."}]`,
|
"transcript.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Alyce casts Sheeld."}]`,
|
||||||
@@ -101,7 +105,7 @@ pipeline:
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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, "shared.yml")}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -121,6 +125,19 @@ pipeline:
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer prepared.Prepared.Output.Close()
|
defer prepared.Prepared.Output.Close()
|
||||||
|
specs := prepared.Invocation.Plan.Specs
|
||||||
|
if len(specs[0].Glossary) != 1 || specs[0].Glossary[0].Name != "Alice" || len(specs[1].Glossary) != 1 || specs[1].Glossary[0].Name != "Shield" {
|
||||||
|
t.Fatalf("selected glossary views: %+v %+v", specs[0].Glossary, specs[1].Glossary)
|
||||||
|
}
|
||||||
|
protectedShield := false
|
||||||
|
for _, term := range specs[0].ProtectedTerms {
|
||||||
|
if term.Spelling == "Shield" && !term.Exempt {
|
||||||
|
protectedShield = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !protectedShield {
|
||||||
|
t.Fatalf("missing protected spell: %+v", specs[0].ProtectedTerms)
|
||||||
|
}
|
||||||
result, err := executePipeline(context.Background(), prepared, func(error) {}, nil)
|
result, err := executePipeline(context.Background(), prepared, func(error) {}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ func TestProcessProtectsRuntimeGlossarySources(t *testing.T) {
|
|||||||
files := map[string]string{
|
files := map[string]string{
|
||||||
"config.yml": "version: 3\nllm: {proposal_profile: fixture}\npipeline: {stages: [{module: grammar}]}\n",
|
"config.yml": "version: 3\nllm: {proposal_profile: fixture}\npipeline: {stages: [{module: grammar}]}\n",
|
||||||
"input.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Hello."}]`,
|
"input.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Hello."}]`,
|
||||||
"runtime.yml": fmt.Sprintf("config:\n imports: [{path: %s, required: true}]\nparty: {entries: []}\n", imported),
|
"runtime.yml": fmt.Sprintf("config:\n imports: [{path: %s, required: true}]\nschema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: []}}\n", imported),
|
||||||
imported: "reference: {entries: []}\n",
|
imported: "collections: {reference: {entries: []}}\n",
|
||||||
"prompts.yml": fmt.Sprintf("profiles:\n - id: fixture\n endpoint: %s/v1\n model: test\n api_key_required: false\n", server.URL),
|
"prompts.yml": fmt.Sprintf("profiles:\n - id: fixture\n endpoint: %s/v1\n model: test\n api_key_required: false\n", server.URL),
|
||||||
}
|
}
|
||||||
for name, data := range files {
|
for name, data := range files {
|
||||||
@@ -70,7 +70,7 @@ func TestProcessProtectsRuntimeGlossarySources(t *testing.T) {
|
|||||||
|
|
||||||
func TestProcessRuntimeGlossaryFailures(t *testing.T) {
|
func TestProcessRuntimeGlossaryFailures(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
files := map[string]string{"config.yml": "version: 3\nglossaries: [party]\npipeline: {stages: [{module: glossary}]}\n", "input.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Hello."}]`, "empty.yml": "party: {entries: []}\n", "bad.yml": "party: [\n"}
|
files := map[string]string{"config.yml": "version: 3\nglossaries: [party]\npipeline: {stages: [{module: glossary}]}\n", "input.json": `[{"speaker":"Alice","start":0,"end":1,"text":"Hello."}]`, "empty.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: []}}\n", "bad.yml": "party: [\n"}
|
||||||
for name, data := range files {
|
for name, data := range files {
|
||||||
if err := os.WriteFile(filepath.Join(dir, name), []byte(data), 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(dir, name), []byte(data), 0600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -104,8 +104,11 @@ func TestNativeCommandsUseRuntimeGlossary(t *testing.T) {
|
|||||||
for name, data := range map[string]string{
|
for name, data := range map[string]string{
|
||||||
"left.yml": "version: 3\ncontext: {description: left}\nglossary_collections: {party: {entries: [{id: a, name: Left, category: C}]}}\n",
|
"left.yml": "version: 3\ncontext: {description: left}\nglossary_collections: {party: {entries: [{id: a, name: Left, category: C}]}}\n",
|
||||||
"right.yml": "version: 3\ncontext: {description: right}\nglossary_collections: {party: {entries: [{id: b, name: Right, category: C}]}}\n",
|
"right.yml": "version: 3\ncontext: {description: right}\nglossary_collections: {party: {entries: [{id: b, name: Right, category: C}]}}\n",
|
||||||
"input.yml": "party: {entries: [{id: c, name: Runtime, category: C}]}\n",
|
"input.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: [{id: c, name: Runtime, category: C}]}}\n",
|
||||||
"bad.yml": "party: [\n",
|
"bad.yml": "party: [\n",
|
||||||
|
"invalid.yml": "schema_version: wrong\ncollections: {}\n",
|
||||||
|
"empty-shared.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {}\n",
|
||||||
|
"additional.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {extra: {entries: [{id: d, name: Additional, category: C}]}}\n",
|
||||||
} {
|
} {
|
||||||
if err := os.WriteFile(filepath.Join(dir, name), []byte(data), 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(dir, name), []byte(data), 0600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -123,15 +126,16 @@ func TestNativeCommandsUseRuntimeGlossary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
main := filepath.Join(dir, "left.yml")
|
main := filepath.Join(dir, "left.yml")
|
||||||
file := filepath.Join(dir, "input.yml")
|
file := filepath.Join(dir, "input.yml")
|
||||||
code, out, stderr := run("config", "show", "--scope=app", "--config", main, "--glossary-file", file)
|
additional := filepath.Join(dir, "additional.yml")
|
||||||
if code != 0 || !strings.Contains(out, "Runtime") || strings.Contains(out, "name: Left") {
|
code, out, stderr := run("config", "show", "--scope=app", "--config", main, "--glossary-file", file, "--glossary-file", additional)
|
||||||
|
if code != 0 || !strings.Contains(out, "Runtime") || !strings.Contains(out, "Additional") || strings.Contains(out, "name: Left") {
|
||||||
t.Fatalf("show %d %s %s", code, out, stderr)
|
t.Fatalf("show %d %s %s", code, out, stderr)
|
||||||
}
|
}
|
||||||
code, out, stderr = run("config", "explain", "--scope=app", "--config", main, "--glossary-file", file, "--path=/glossary_collections/party/entries")
|
code, out, stderr = run("config", "explain", "--scope=app", "--config", main, "--glossary-file", file, "--path=/glossary_collections/party/entries")
|
||||||
if code != 0 || !strings.Contains(out, "--glossary-file") {
|
if code != 0 || !strings.Contains(out, "--glossary-file") {
|
||||||
t.Fatalf("explain %d %s %s", code, out, stderr)
|
t.Fatalf("explain %d %s %s", code, out, stderr)
|
||||||
}
|
}
|
||||||
code, out, stderr = run("config", "diff", "--details", "--scope=app", "--config", main, "--against-config", filepath.Join(dir, "right.yml"), "--glossary-file", file)
|
code, out, stderr = run("config", "diff", "--details", "--scope=app", "--config", main, "--against-config", filepath.Join(dir, "right.yml"), "--glossary-file", file, "--glossary-file", additional)
|
||||||
if code != 0 || !strings.Contains(out, "left") || !strings.Contains(out, "right") || strings.Contains(out, "glossary_collections") {
|
if code != 0 || !strings.Contains(out, "left") || !strings.Contains(out, "right") || strings.Contains(out, "glossary_collections") {
|
||||||
t.Fatalf("diff %d %s %s", code, out, stderr)
|
t.Fatalf("diff %d %s %s", code, out, stderr)
|
||||||
}
|
}
|
||||||
@@ -147,6 +151,17 @@ func TestNativeCommandsUseRuntimeGlossary(t *testing.T) {
|
|||||||
t.Fatalf("%v: %d %s", args, code, stderr)
|
t.Fatalf("%v: %d %s", args, code, stderr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
code, _, stderr = run("config", "show", "--scope=app", "--config", main, "--glossary-file", filepath.Join(dir, "empty-shared.yml"))
|
||||||
|
if code != 0 {
|
||||||
|
t.Fatalf("empty shared inspection: %d %s", code, stderr)
|
||||||
|
}
|
||||||
|
for _, args := range [][]string{{"config", "show", "--scope=app"}, {"promptkit", "list", "prompts"}} {
|
||||||
|
args = append(args, "--config", main, "--glossary-file", filepath.Join(dir, "invalid.yml"))
|
||||||
|
code, _, stderr = run(args...)
|
||||||
|
if code != 2 || !strings.Contains(stderr, "invalid.yml") || !strings.Contains(stderr, "schema_version") {
|
||||||
|
t.Fatalf("invalid shared data %v: %d %s", args, code, stderr)
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, args := range [][]string{{"--help"}, {"version"}, {"config", "scopes"}, {"promptkit", "--help"}} {
|
for _, args := range [][]string{{"--help"}, {"version"}, {"config", "scopes"}, {"promptkit", "--help"}} {
|
||||||
code, _, stderr = run(args...)
|
code, _, stderr = run(args...)
|
||||||
if code != 0 {
|
if code != 0 {
|
||||||
@@ -170,8 +185,8 @@ func TestRuntimeGlossaryUsesInvocationDirectory(t *testing.T) {
|
|||||||
filepath.Join(project, "secrets", "AUDITA_GLOSSARY_CONTEXT_TEST"): "loaded",
|
filepath.Join(project, "secrets", "AUDITA_GLOSSARY_CONTEXT_TEST"): "loaded",
|
||||||
filepath.Join(project, "glossary.yml"): "reference: {entries: [{id: r, name: Companion, category: C}]}\n",
|
filepath.Join(project, "glossary.yml"): "reference: {entries: [{id: r, name: Companion, category: C}]}\n",
|
||||||
filepath.Join(project, "overlays", "chosen.yml"): "context: {description: overlay}\n",
|
filepath.Join(project, "overlays", "chosen.yml"): "context: {description: overlay}\n",
|
||||||
filepath.Join(invocation, "input.yml"): "config: {imports: [{path: imported.yml}]}\nparty: {entries: [{id: a, name: Incoming, category: C}]}\n",
|
filepath.Join(invocation, "input.yml"): "config: {imports: [{path: imported.yml}]}\nschema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: [{id: a, name: Incoming, category: C}]}}\n",
|
||||||
filepath.Join(invocation, "imported.yml"): "lore: {entries: [{id: b, name: Imported, category: C}]}\n",
|
filepath.Join(invocation, "imported.yml"): "collections: {lore: {entries: [{id: b, name: Imported, category: C}]}}\n",
|
||||||
}
|
}
|
||||||
for path, data := range files {
|
for path, data := range files {
|
||||||
if err := os.WriteFile(path, []byte(data), 0600); err != nil {
|
if err := os.WriteFile(path, []byte(data), 0600); err != nil {
|
||||||
@@ -181,7 +196,102 @@ func TestRuntimeGlossaryUsesInvocationDirectory(t *testing.T) {
|
|||||||
t.Chdir(invocation)
|
t.Chdir(invocation)
|
||||||
var out, stderr bytes.Buffer
|
var out, stderr bytes.Buffer
|
||||||
code := Run(context.Background(), []string{"config", "show", "--scope=app", "--config", filepath.Join(project, "config.yml"), "--overlay", "chosen", "--glossary-file", "input.yml"}, &out, &stderr)
|
code := Run(context.Background(), []string{"config", "show", "--scope=app", "--config", filepath.Join(project, "config.yml"), "--overlay", "chosen", "--glossary-file", "input.yml"}, &out, &stderr)
|
||||||
if code != 0 || !strings.Contains(out.String(), "Incoming") || !strings.Contains(out.String(), "Imported") || !strings.Contains(out.String(), "Companion") || !strings.Contains(out.String(), "overlay") || os.Getenv("AUDITA_GLOSSARY_CONTEXT_TEST") != "loaded" {
|
if code != 0 || !strings.Contains(out.String(), "Incoming") || !strings.Contains(out.String(), "Imported") || strings.Contains(out.String(), "Companion") || !strings.Contains(out.String(), "overlay") || os.Getenv("AUDITA_GLOSSARY_CONTEXT_TEST") != "loaded" {
|
||||||
t.Fatalf("status=%d out=%s err=%s", code, out.String(), stderr.String())
|
t.Fatalf("status=%d out=%s err=%s", code, out.String(), stderr.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSharedGlossaryReadinessBeforeRequests(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
var calls atomic.Int32
|
||||||
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
calls.Add(1)
|
||||||
|
fmt.Fprint(w, `{"choices":[{"message":{"content":"{\"corrections\":[]}"}}]}`)
|
||||||
|
}))
|
||||||
|
defer server.Close()
|
||||||
|
files := map[string]string{
|
||||||
|
"config.yml": "version: 3\nglossaries: [party]\nllm: {proposal_profile: fixture, validation_profile: fixture}\npipeline: {stages: [{module: glossary}]}\nreporting: {enabled: false}\n",
|
||||||
|
"prompts.yml": fmt.Sprintf("profiles: [{id: fixture, endpoint: '%s/v1', model: fixture, api_key_required: false}]\n", server.URL),
|
||||||
|
"input.json": `[{"speaker":"A","start":0,"end":1,"text":"hello"}]`,
|
||||||
|
"good.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: [{id: a, name: Alice, category: person}]}, other: {entries: []}}\n",
|
||||||
|
"empty.yml": "schema_version: maximumdirect.glossary.v1\ncollections: {party: {entries: []}}\n",
|
||||||
|
"invalid.yml": "schema_version: wrong\ncollections: {}\n",
|
||||||
|
}
|
||||||
|
for name, body := range files {
|
||||||
|
if err := os.WriteFile(filepath.Join(dir, name), []byte(body), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, command := range []string{"preflight", "process"} {
|
||||||
|
for _, tc := range []struct {
|
||||||
|
file string
|
||||||
|
extra []string
|
||||||
|
wantStatus int
|
||||||
|
}{
|
||||||
|
{"invalid.yml", nil, 2},
|
||||||
|
{"empty.yml", nil, 2},
|
||||||
|
{"good.yml", []string{"--glossaries", `["missing"]`}, 2},
|
||||||
|
} {
|
||||||
|
args := []string{command, "--config", filepath.Join(dir, "config.yml"), "--glossary-file", filepath.Join(dir, tc.file), "--output", filepath.Join(dir, "out.json")}
|
||||||
|
args = append(args, tc.extra...)
|
||||||
|
args = append(args, filepath.Join(dir, "input.json"))
|
||||||
|
var stdout, stderr bytes.Buffer
|
||||||
|
if status := Run(context.Background(), args, &stdout, &stderr); status != tc.wantStatus || calls.Load() != 0 {
|
||||||
|
t.Fatalf("%s %s: status=%d calls=%d stderr=%s", command, tc.file, status, calls.Load(), stderr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var stdout, stderr bytes.Buffer
|
||||||
|
status := Run(context.Background(), []string{"preflight", "--smoke=false", "--config", filepath.Join(dir, "config.yml"), "--glossary-file", filepath.Join(dir, "good.yml"), "--output", filepath.Join(dir, "out.json"), filepath.Join(dir, "input.json")}, &stdout, &stderr)
|
||||||
|
if status != 0 || calls.Load() != 0 {
|
||||||
|
t.Fatalf("local preflight: status=%d calls=%d stderr=%s", status, calls.Load(), stderr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSharedGlossaryWithDisjointNativeOverrides(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
main := filepath.Join(dir, "config.yml")
|
||||||
|
if err := os.WriteFile(main, []byte("version: 3\nglossary_collections:\n people:\n entries: [{id: configured, name: Configured, category: person}]\n"), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, tc := range []struct{ name, collections, wantName string }{
|
||||||
|
{"populated", "{people: {entries: [{id: a, name: Alice, category: person}]}}", "Alice"},
|
||||||
|
{"empty", "{}", "Configured"},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
file := filepath.Join(dir, tc.name+".yml")
|
||||||
|
if err := os.WriteFile(file, []byte("schema_version: maximumdirect.glossary.v1\ncollections: "+tc.collections+"\n"), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
common := []string{"--scope=app", "--config", main, "--glossary-file", file, "--set", `/glossary_collections/other/entries=[{"id":"b","name":"Bob","category":"person"}]`}
|
||||||
|
var out, stderr bytes.Buffer
|
||||||
|
if code := Run(context.Background(), append([]string{"config", "show"}, common...), &out, &stderr); code != 0 || !strings.Contains(out.String(), "name: "+tc.wantName) || !strings.Contains(out.String(), "name: Bob") {
|
||||||
|
t.Fatalf("show: code=%d out=%s stderr=%s", code, out.String(), stderr.String())
|
||||||
|
}
|
||||||
|
for _, origin := range []struct{ path, flag string }{
|
||||||
|
{"/glossary_collections/other/entries", "--set"},
|
||||||
|
{"/glossary_collections/people/entries", "--glossary-file"},
|
||||||
|
} {
|
||||||
|
if tc.name == "empty" && origin.flag == "--glossary-file" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
out.Reset()
|
||||||
|
stderr.Reset()
|
||||||
|
args := append([]string{"config", "explain"}, common...)
|
||||||
|
args = append(args, "--path", origin.path)
|
||||||
|
if code := Run(context.Background(), args, &out, &stderr); code != 0 || !strings.Contains(out.String(), origin.flag) {
|
||||||
|
t.Fatalf("explain: code=%d out=%s stderr=%s", code, out.String(), stderr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if tc.name == "populated" {
|
||||||
|
out.Reset()
|
||||||
|
stderr.Reset()
|
||||||
|
args := append([]string{"config", "show"}, common...)
|
||||||
|
args = append(args, "--set", `/glossary_collections/people={"entries":[]}`)
|
||||||
|
if code := Run(context.Background(), args, &out, &stderr); code != 2 || !strings.Contains(stderr.String(), "override.overlap") {
|
||||||
|
t.Fatalf("overlap: code=%d stderr=%s", code, stderr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user