Preserve derived publication and preparation evidence

This commit is contained in:
2026-11-20 04:49:29 +00:00
parent 065a615e5f
commit b537cb38ae
23 changed files with 135 additions and 100 deletions

View File

@@ -46,37 +46,26 @@ func finalizePipelineResolution(cfg *PipelineConfig) error {
return recomputePipelineEffectiveDigest(cfg)
}
// recomputePipelineEffectiveDigest is the single package-owned hook for
// refreshing provenance after later resolution expands concrete pipeline
// values. Loader directives and runtime provenance are not serialized.
// recomputePipelineEffectiveDigest records informational configuration identity.
// Derived domain products are not part of this configuration projection.
func recomputePipelineEffectiveDigest(cfg *PipelineConfig) error {
if cfg == nil || cfg.resolution == nil {
return fmt.Errorf("pipeline resolution metadata is required")
}
snapshot, err := newPipelineInspection(cfg)
if err != nil {
return err
}
canonical, err := projectionJSON(snapshot.Config)
canonical, err := projectionJSON(projectEffectivePipeline(cfg))
if err != nil {
return err
}
digestInput := append([]byte(effectivePipelineDigestVersion), canonical...)
digest := sha256.Sum256(digestInput)
cfg.resolution.effectiveDigest = hex.EncodeToString(digest[:])
cfg.resolution.inspection = snapshot
return nil
}
func newPipelineInspection(cfg *PipelineConfig) (*configkit.Result[effectivePipelineProjection], error) {
projection := projectEffectivePipeline(cfg)
return configkit.Load(configkit.NoSource(), configkit.Options[effectivePipelineProjection]{Definition: configkit.Definition[effectivePipelineProjection]{Defaults: func() effectivePipelineProjection { return projection }}})
}
// DiffEffectivePipelines compares frozen final-domain snapshots.
// DiffEffectivePipelines compares the authoritative native load results.
func DiffEffectivePipelines(left, right *PipelineConfig) ([]configkit.Difference, error) {
if left == nil || right == nil || left.resolution == nil || right.resolution == nil {
if left == nil || right == nil || left.ConfigKitResult() == nil || right.ConfigKitResult() == nil {
return nil, fmt.Errorf("resolved pipelines are required")
}
return configkit.Diff(left.resolution.inspection, right.resolution.inspection)
return configkit.Diff(left.ConfigKitResult(), right.ConfigKitResult())
}