Skip to main content

Module merge

Module merge 

Source
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:

  1. If the path appears as [secret."<path>"] in the manifest, its metadata is read from the manifest only — the path is project-local.
  2. Otherwise, metadata is read from the global index. If the manifest has an [overrides."<path>"] block, the listed behavioural fields override the index values.
  3. If a path appears in required / optional and exists in neither the global index nor as [secret."..."], the merge fails with MergeError::UnknownPath — the E_SECRET_UNKNOWN_PATH error 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:

Structs§

MergeOutput
Output of merge_manifest — the resolved view plus advisory warnings.
MergeWarning
Advisory warning emitted by the merge.
ResolvedSecret
Resolved view of a single declared path — final metadata plus provenance.

Enums§

MergeError
Fatal merge errors.
MergeWarningKind
Categories of advisory warnings — see the module-level doc for detailed descriptions.
OverrideField
Which behavioural field of a global entry was replaced by the project’s [overrides] block.
SecretOrigin
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.