Publish inspection through one frozen history model

This commit is contained in:
2026-10-26 17:36:36 +00:00
parent 8155465322
commit 12fd0a7191
20 changed files with 203 additions and 247 deletions

View File

@@ -76,8 +76,9 @@ func TestLoadRunsRecordedResolutionWithMapWriteback(t *testing.T) {
"/artifacts/first/output", "/artifacts/first/timeout",
"/artifacts/second/output", "/artifacts/second/timeout", "/timeout",
}
gotOrder := make([]string, len(result.resolution))
for index, snapshot := range result.resolution {
snapshots := result.history.resolutionPayload.snapshots
gotOrder := make([]string, len(snapshots))
for index, snapshot := range snapshots {
gotOrder[index] = snapshot.change.Path.String()
}
if !reflect.DeepEqual(gotOrder, wantOrder) {
@@ -179,11 +180,12 @@ func TestResolutionContainerRecordCoversSubtreeRemovalAndSnapshotsAreDetached(t
if _, ok := result.Metadata().Lookup(Keys("items", "remove")); ok {
t.Fatal("removed entry remains effective metadata")
}
if len(result.resolution) != 1 || result.resolution[0].before == nil || result.resolution[0].after == nil {
t.Fatalf("snapshots = %#v", result.resolution)
snapshots := result.history.resolutionPayload.snapshots
if len(snapshots) != 1 || snapshots[0].before == nil || snapshots[0].after == nil {
t.Fatalf("snapshots = %#v", snapshots)
}
result.Config.Items["keep"] = item{Value: "changed"}
if mappingValue(t, result.resolution[0].after, "keep").Mapping[0].Value.Text != "yes" {
if mappingValue(t, snapshots[0].after, "keep").Mapping[0].Value.Text != "yes" {
t.Fatal("caller mutation changed private resolution snapshot")
}
}
@@ -383,8 +385,9 @@ func TestResolutionPresenceUsesEntryShapeAcrossDynamicChanges(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if len(result.resolution) != 2 || result.resolution[1].change.Origin.Operation != ChangeDerivedDefault {
t.Fatalf("resolution records = %#v", result.resolution)
snapshots := result.history.resolutionPayload.snapshots
if len(snapshots) != 2 || snapshots[1].change.Origin.Operation != ChangeDerivedDefault {
t.Fatalf("resolution records = %#v", snapshots)
}
})
}