Report effective resource contributors without superseded definitions

This commit is contained in:
2026-11-18 03:59:09 +00:00
parent ba9079ee74
commit 5d62f9a88b
4 changed files with 58 additions and 2 deletions

View File

@@ -119,6 +119,9 @@ overlay and its file, selected campaign, party source, and digest. The
remaining tab-separated records are sorted as `path`, `role`, and `source`. remaining tab-separated records are sorted as `path`, `role`, and `source`.
Roles distinguish root, import, overlay, normalization, centralized default, Roles distinguish root, import, overlay, normalization, centralized default,
campaign, party, and generated family ownership. Records labeled campaign, party, and generated family ownership. Records labeled
`resolution` retain their effective pre-normalization source contributors;
superseded definitions remain historical evidence in the artifact catalog.
Records labeled
`empty_import` identify the source-local declaration path, selector, and `empty_import` identify the source-local declaration path, selector, and
location of an optional import that selected no sources. A generated party member has location of an optional import that selected no sources. A generated party member has
one family record and one party record at the same logical path. The output one family record and one party record at the same logical path. The output

View File

@@ -24,6 +24,9 @@ opportunities. This document implements none of their fixes.
## 1. P2: Distinguish effective resource origins from superseded history ## 1. P2: Distinguish effective resource origins from superseded history
Status: Complete. Native pre-resolution Previous evidence supplies current
contributors; regression coverage includes overlay replacement and inheritance.
Stage: 9, with documentation coverage in Stage 11. Stage: 9, with documentation coverage in Stage 11.
Location: `internal/config/effective_pipeline.go:274–280`, Location: `internal/config/effective_pipeline.go:274–280`,

View File

@@ -273,9 +273,17 @@ func effectivePipelineOwners(cfg *PipelineConfig) (map[string][]string, error) {
sources = ownershipSources(info.Origin, pathsByID) sources = ownershipSources(info.Origin, pathsByID)
if info.Origin.Layer == configkit.LayerResolution { if info.Origin.Layer == configkit.LayerResolution {
for _, change := range cfg.resolution.configkitMetadata.History(configkit.Keys(value.segments...)) { for _, change := range cfg.resolution.configkitMetadata.History(configkit.Keys(value.segments...)) {
if change.Origin.Layer == configkit.LayerMain || change.Origin.Layer == configkit.LayerOverlay { if change.Origin.Layer != configkit.LayerResolution {
sources = append(sources, ownershipSources(change.Origin, pathsByID)...) continue
} }
// Native Previous evidence identifies the input immediately before
// resolution, including composite and inherited origins.
for _, previous := range change.Previous {
if previous.Layer == configkit.LayerMain || previous.Layer == configkit.LayerOverlay {
sources = append(sources, ownershipSources(previous, pathsByID)...)
}
}
break
} }
sources = nonEmptySortedStrings(sources) sources = nonEmptySortedStrings(sources)
} }

View File

@@ -0,0 +1,42 @@
package config
import (
"path/filepath"
"testing"
)
func TestEffectiveResourceSourcesExcludeSupersededDefinitions(t *testing.T) {
dir := t.TempDir()
root := writePipelineFixture(t, dir, "pipeline.yml", "config:\n imports:\n - path: shared.yml\nnotarius:\n extends: audita\n")
writePipelineFixture(t, dir, "shared.yml", "audita: {config_path: old.yml}\n")
overlayPath := writePipelineFixture(t, dir, "overlays/testing.yml", "audita: {config_path: replacement.yml}\n")
overlay := "testing"
cfg, err := LoadPipelineWithOptions(root, PipelineLoadOptions{Overlay: &overlay})
if err != nil {
t.Fatal(err)
}
records, err := EffectivePipelineSources(cfg, ResolvedParty{})
if err != nil {
t.Fatal(err)
}
for _, path := range []string{"audita.config_path", "notarius.config_path"} {
foundOverlay, foundResolution := false, false
for _, record := range records {
if record.Path != path {
continue
}
if record.Role == "overlay" && record.Source == overlayPath {
foundOverlay = true
}
if record.Role == "resolution" {
foundResolution = true
}
if record.Source == filepath.Join(dir, "shared.yml") {
t.Fatalf("superseded source for %s: %#v", path, record)
}
}
if !foundOverlay || !foundResolution {
t.Fatalf("missing effective evidence for %s: %#v", path, records)
}
}
}