Expand description
Manifest-with-global-index merge per ADR-020 §4.
Given a global index (GlobalIndex) and a per-project manifest
(ProjectManifest), the merge function produces a single
resolved view per declared path: which entry “wins”, which fields
came from the manifest’s [overrides] block, and what the final
metadata is.
§Precedence
For each path mentioned in the manifest’s required or optional
list, the resolver applies precedence rules straight from ADR-020 §4:
- If the path appears as
[secret."<path>"]in the manifest, its metadata is read from the manifest only — the path is project-local. - Otherwise, metadata is read from the global index. If the
manifest has an
[overrides."<path>"]block, the listed behavioural fields override the index values. - If a path appears in
required/optionaland exists in neither the global index nor as[secret."..."], the merge fails withMergeError::UnknownPath— theE_SECRET_UNKNOWN_PATHerror from the ADR.
E_OVERRIDE_FIELD_NOT_ALLOWED (the ADR’s name for “you tried to
override a non-behavioural field”) is already enforced at parse
time by deny_unknown_fields on OverrideEntry — it surfaces
through ManifestError::Parse
during loading, not here.
§Warnings (advisory)
The merge also emits non-fatal warnings, returned alongside the
resolved view. doctor consumes them; the loader itself accepts
the manifest. Cases:
MergeWarningKind::NoOpOverride— an[overrides]field is set to the same value as the global. The override is harmless but adds noise; suggest removal.MergeWarningKind::OverrideForUndeclaredPath— an[overrides."x"]block exists for a path that is not inrequired/optional. Possibly a typo or a leftover; the override is unused.MergeWarningKind::ProjectLocalForUndeclaredPath— a[secret."x"]block exists for a path that is not inrequired/optional. Same shape as the previous warning; metadata is registered but no caller depends on it.
Structs§
- Merge
Output - Output of
merge_manifest— the resolved view plus advisory warnings. - Merge
Warning - Advisory warning emitted by the merge.
- Resolved
Secret - Resolved view of a single declared path — final metadata plus provenance.
Enums§
- Merge
Error - Fatal merge errors.
- Merge
Warning Kind - Categories of advisory warnings — see the module-level doc for detailed descriptions.
- Override
Field - Which behavioural field of a global entry was replaced by the
project’s
[overrides]block. - Secret
Origin - Where the resolved metadata for a path came from.
Functions§
- merge_
manifest - Merge the per-project manifest with the global index per ADR-020 §4.