Remove superseded history attribution paths
This commit is contained in:
@@ -10,19 +10,10 @@ import (
|
||||
// it owns no source access, options, or long-lived schema state.
|
||||
type resolvedLoad[T any] struct {
|
||||
configuration T
|
||||
decoded decodedConfiguration
|
||||
metadata Metadata
|
||||
historyBuilder *historyBuilder
|
||||
final *document.Node
|
||||
snapshots []resolutionSnapshot
|
||||
applications []historyApplication
|
||||
postDecodeApps []historyApplication
|
||||
structuralInput *document.Node
|
||||
preCLI *document.Node
|
||||
preCLIOrigins map[string]Origin
|
||||
referenceInput *document.Node
|
||||
versionEvidence []*sourceVersionEvidence
|
||||
inheritance *inheritanceScope
|
||||
contexts map[string]ResourceContext
|
||||
}
|
||||
|
||||
@@ -57,10 +48,7 @@ func resolveLoadInput[T any](schema *schemaDescriptor, definition Definition[T],
|
||||
decoded := prepared.decoded
|
||||
configuration := decoded.value.Interface().(T)
|
||||
metadata := prepared.metadata
|
||||
builder := prepared.historyBuilder
|
||||
if builder == nil {
|
||||
builder = metadata.historyBuilder
|
||||
}
|
||||
builder := metadata.historyBuilder
|
||||
final := decoded.final
|
||||
referenceInput := prepared.referenceInput
|
||||
var resolutionSnapshots []resolutionSnapshot
|
||||
@@ -86,22 +74,13 @@ func resolveLoadInput[T any](schema *schemaDescriptor, definition Definition[T],
|
||||
if refreshReferenceInput {
|
||||
referenceInput = documentWithMetadataLocations(final, metadata, input.document)
|
||||
}
|
||||
applications := []historyApplication(nil)
|
||||
if input.composition != nil {
|
||||
applications = input.composition.applications
|
||||
} else if input.document != nil {
|
||||
applications = []historyApplication{{layer: LayerBase, value: input.document}}
|
||||
}
|
||||
var versionEvidence []*sourceVersionEvidence
|
||||
if input.versionState != nil {
|
||||
versionEvidence = append(versionEvidence, input.versionState.evidence...)
|
||||
}
|
||||
return resolvedLoad[T]{
|
||||
configuration: configuration, decoded: decoded, metadata: metadata, historyBuilder: builder, final: final,
|
||||
snapshots: resolutionSnapshots, applications: applications,
|
||||
postDecodeApps: prepared.postDecodeApps, structuralInput: document.Clone(prepared.structuralInput),
|
||||
preCLI: prepared.preCLI, preCLIOrigins: prepared.preCLIOrigins, referenceInput: referenceInput,
|
||||
versionEvidence: versionEvidence, inheritance: input.inheritance, contexts: input.contexts,
|
||||
configuration: configuration, metadata: metadata, final: final, referenceInput: referenceInput,
|
||||
versionEvidence: versionEvidence, contexts: input.contexts,
|
||||
}, diagnostics
|
||||
}
|
||||
|
||||
@@ -117,21 +96,7 @@ func detachLoadConfiguration[T any](schema *schemaDescriptor, configuration T, m
|
||||
|
||||
func prepareInspectionHistory[T any](resolved resolvedLoad[T], counter *retainedNodeCounter) (*Inspection, bool) {
|
||||
metadata := resolved.metadata
|
||||
if resolved.historyBuilder != nil {
|
||||
metadata.historyBuilder = resolved.historyBuilder
|
||||
} else if resolved.inheritance != nil {
|
||||
builder := newHistoryBuilder()
|
||||
if resolved.decoded.baseline != nil {
|
||||
builder.observeBaseline(resolved.decoded.baseline)
|
||||
}
|
||||
builder.setScratch(resolved.final)
|
||||
builder.observeInheritanceEvidence(resolved.inheritance.operations)
|
||||
metadata.historyBuilder = builder
|
||||
}
|
||||
finalizeMetadataPathsWithResolution(
|
||||
&metadata, resolved.final, resolved.applications, resolved.snapshots,
|
||||
resolved.decoded.baseline, resolved.structuralInput, resolved.preCLI, resolved.decoded.final,
|
||||
)
|
||||
freezeMetadataHistory(&metadata, resolved.final)
|
||||
model := metadata.historyModel
|
||||
inspection := &Inspection{
|
||||
metadata: metadata,
|
||||
@@ -152,8 +117,8 @@ func publishLoadResult[T any](schema *schemaDescriptor, definition Definition[T]
|
||||
accumulator.add(*issue)
|
||||
return nil, accumulator.loadError()
|
||||
}
|
||||
metadata, final := inspection.metadata, inspection.final
|
||||
secrets := classifySecretPathsWithEvidence(schema, definition.Secret, metadata, final, nil, resolved.versionEvidence)
|
||||
metadata := inspection.metadata
|
||||
secrets := classifySecretPathsWithEvidence(schema, definition.Secret, metadata, resolved.versionEvidence)
|
||||
sources := sourceInfosWithVersionEvidence(accumulator.sources, resolved.versionEvidence, secrets, false)
|
||||
inspection.metadata = metadata
|
||||
inspection.sources = sources
|
||||
|
||||
Reference in New Issue
Block a user