Document shared source version checks
This commit is contained in:
@@ -306,6 +306,61 @@ error without reporting one, ConfigKit emits a generic `version.hook_failed`
|
||||
diagnostic and suppresses the returned error text. Warnings alone are retained on a
|
||||
successful result. Callback panics remain programming failures.
|
||||
|
||||
#### Shared source-version checks
|
||||
|
||||
`Options.SourceVersionMode` and `LayeredOptions.SourceVersionMode` select how
|
||||
one `Definition.Version` policy applies across source documents. The zero value
|
||||
`SourceVersionModeDefault` preserves the existing main-only check at its
|
||||
effective path and existing protected-path behavior. `SourceVersionModeIfPresent`
|
||||
checks each participating document that declares a version and permits absent
|
||||
non-main declarations. `SourceVersionModeRequired` rejects a participating
|
||||
document without a declaration. Enabled modes require a usable `VersionRule`
|
||||
and checker; an unknown mode or unusable rule is an options error before source
|
||||
access or callbacks.
|
||||
|
||||
In enabled modes, `Definition.Version.Path` is interpreted in each acquired
|
||||
document's own coordinates, before placement and composition. The main document,
|
||||
direct underlay documents, imported documents (including transitive and glob
|
||||
matches), and the selected overlay participate. `NoSource`, absent optional
|
||||
imports, empty underlay groups, defaults, resolution output, inheritance, and
|
||||
synthetic CLI overrides are not documents to check. An absent declaration in an
|
||||
actual main document still reaches the checker in if-present mode; required mode
|
||||
rejects it first. With `NoSource`, the existing single absent-main checker
|
||||
behavior remains in both enabled modes. If-present omissions in non-main
|
||||
documents skip the checker. Explicit null is present and reaches the checker;
|
||||
unsupported selected values produce `version.type`. No equality with the main
|
||||
declaration or non-null rule is imposed. Acceptance establishes only that the
|
||||
declaration is accepted by the consumer's checker; it does not establish that
|
||||
each fragment conforms to a complete application schema. Final assembled
|
||||
decoding and application validation still run once.
|
||||
|
||||
Accepted non-main declarations are consumed from their owned payload before
|
||||
composition; their authored ancestors remain, even if empty. The main
|
||||
declaration remains in the application. Ordinary release metadata should use a
|
||||
different path. Enabled main protection uses the main input's effective path:
|
||||
its `Destination` prefixed to the source-local `VersionRule.Path`. This protects
|
||||
the remaining payload against imports, underlays, inheritance, and CLI
|
||||
overrides. Thus a mounted main looks up a local header while ownership checks
|
||||
protect its destination-prefixed application path. Main checker diagnostics and
|
||||
declaration locations use source-local coordinates; ordinary payload
|
||||
diagnostics continue to use effective paths. Default-mode diagnostics are
|
||||
unchanged.
|
||||
|
||||
`SourceInfo.VersionCheck` is nil when enabled declaration processing did not
|
||||
occur. Otherwise it records a source-local `Path`, the observed `Version` state
|
||||
(`Present`, `Null`, and, when disclosed, exact `Text`), an actual or nearest
|
||||
available `Location`, and whether text was redacted. A non-nil record with
|
||||
`Present == false` records observed absence; it does not say the checker ran or
|
||||
accepted a declaration. During callbacks and in failed-load source records,
|
||||
text is conservatively withheld because final classification may not be
|
||||
available. Successful final source records reflect completed sensitivity
|
||||
classification at the declaration's mounted path and ancestors, including
|
||||
historical classification. Redaction empties `Text` while retaining presence
|
||||
and null state. Returned copies are detached; evidence does not reopen inputs.
|
||||
Consult [ADR 0013](adr/0013-shared-source-version-checks.md) for the accepted
|
||||
decision and the [source-version roadmap](roadmap/source-version-checks.md) for
|
||||
its implementation record.
|
||||
|
||||
### Layered metadata
|
||||
|
||||
`Result.Metadata` describes every final canonical path. Queries retain explicit
|
||||
|
||||
Reference in New Issue
Block a user