Publish inspection through one frozen history model
This commit is contained in:
@@ -278,14 +278,13 @@ func TestProjectedSequenceHistoryAgreesAcrossMetadataAndExplanation(t *testing.T
|
||||
t.Fatalf("projected metadata omitted shifted path %s: %#v", path, metadata.HistoricalPaths())
|
||||
}
|
||||
|
||||
inspection := &Inspection{
|
||||
metadata: metadata, baseline: &document.Node{Kind: document.Mapping},
|
||||
input: composed.root, preCLI: composed.root, final: composed.root, applications: composed.applications,
|
||||
}
|
||||
inspection.metadata.historyModel = sourceHistoryModelForInspection(inspection.baseline, composed.root, composed.origins, composed.applications, composed.overlays)
|
||||
baseline := &document.Node{Kind: document.Mapping}
|
||||
model := sourceHistoryModelForInspection(baseline, composed.root, composed.origins, composed.applications, composed.overlays)
|
||||
metadata.historyModel = model
|
||||
inspection := &Inspection{metadata: metadata, history: model, final: composed.root}
|
||||
inspection.secrets = classifySecretPaths(nil, func(candidate Path) bool {
|
||||
return reflect.DeepEqual(candidate, path)
|
||||
}, metadata, composed.root, composed.applications)
|
||||
}, metadata, composed.root, nil)
|
||||
explanation, ok := inspection.Explain(path)
|
||||
if !ok || !explanation.Effective.Redacted {
|
||||
t.Fatalf("shifted explanation = %#v, %v", explanation, ok)
|
||||
@@ -326,14 +325,13 @@ func TestReplacedProjectedSensitiveRecordRemainsRedacted(t *testing.T) {
|
||||
path := Keys("records").Index(1).Key("token")
|
||||
var metadata Metadata
|
||||
finalizeMetadataPaths(&metadata, final, applications)
|
||||
inspection := &Inspection{
|
||||
metadata: metadata, baseline: &document.Node{Kind: document.Mapping},
|
||||
input: final, preCLI: final, final: final, applications: applications,
|
||||
}
|
||||
inspection.metadata.historyModel = sourceHistoryModelForInspection(inspection.baseline, final, nil, applications, nil)
|
||||
baseline := &document.Node{Kind: document.Mapping}
|
||||
model := sourceHistoryModelForInspection(baseline, final, nil, applications, nil)
|
||||
metadata.historyModel = model
|
||||
inspection := &Inspection{metadata: metadata, history: model, final: final}
|
||||
inspection.secrets = classifySecretPaths(nil, func(candidate Path) bool {
|
||||
return reflect.DeepEqual(candidate, path)
|
||||
}, metadata, final, applications)
|
||||
}, metadata, final, nil)
|
||||
explanation, ok := inspection.Explain(path)
|
||||
if !ok || explanation.Effective.Present {
|
||||
t.Fatalf("replaced shifted record explanation = %#v, %v", explanation, ok)
|
||||
@@ -353,7 +351,6 @@ func sourceHistoryModelForInspection(baseline, final *document.Node, origins map
|
||||
builder.setScratch(baseline)
|
||||
builder.observeSourceEvidence(final, origins, applications, records)
|
||||
builder.model.final = final
|
||||
builder.registerDocumentRoot(final)
|
||||
return builder.freeze()
|
||||
}
|
||||
|
||||
@@ -409,12 +406,12 @@ func TestMappedUpsertProjectsSensitiveReplacementEvidence(t *testing.T) {
|
||||
|
||||
var metadata Metadata
|
||||
finalizeMetadataPaths(&metadata, finalRoot, applications)
|
||||
inspection := &Inspection{
|
||||
metadata: metadata, baseline: &document.Node{Kind: document.Mapping},
|
||||
input: finalRoot, preCLI: finalRoot, final: finalRoot, applications: applications,
|
||||
}
|
||||
baseline := &document.Node{Kind: document.Mapping}
|
||||
model := sourceHistoryModelForInspection(baseline, finalRoot, nil, applications, nil)
|
||||
metadata.historyModel = model
|
||||
inspection := &Inspection{metadata: metadata, history: model, final: finalRoot}
|
||||
secretRule := func(candidate Path) bool { return reflect.DeepEqual(candidate, secretPath) }
|
||||
inspection.secrets = classifySecretPaths(nil, secretRule, metadata, finalRoot, applications)
|
||||
inspection.secrets = classifySecretPaths(nil, secretRule, metadata, finalRoot, nil)
|
||||
explanation, ok := inspection.Explain(secretPath)
|
||||
if !ok || !explanation.Effective.Redacted {
|
||||
t.Fatalf("mapped replacement explanation = %#v, %v", explanation, ok)
|
||||
|
||||
Reference in New Issue
Block a user