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

@@ -156,7 +156,7 @@ func TestHistorySelectionMatchesDeepSidesOfAncestorShapeChange(t *testing.T) {
}
}
func TestHistoryModelFinalizesLocationSensitivityAndDocumentReaders(t *testing.T) {
func TestHistoryModelFinalizesLocationAndSensitivityWithoutRetainingInventoryTrees(t *testing.T) {
t.Parallel()
root := parseDocumentForDecode(t, "shape: {'0': {value: old}}\n")
@@ -189,11 +189,11 @@ func TestHistoryModelFinalizesLocationSensitivityAndDocumentReaders(t *testing.T
})
model := builder.freeze()
if got := model.documentRoots(); len(got) == 0 || got[0] != root {
t.Fatalf("document roots = %#v, want registered root", got)
if got := model.documentRoots(); len(got) != 0 {
t.Fatalf("inventory-only document was retained: %#v", got)
}
if got, ok := model.documentAt(root, Keys("shape", "0")); !ok || got.Kind != document.Mapping {
t.Fatalf("indexed document lookup = %#v, %v", got, ok)
if got, ok := model.documentAt(root, Keys("shape", "0")); ok || got != nil {
t.Fatalf("lookup retained an inventory-only document = %#v, %v", got, ok)
}
if got, ok := model.latestHistoricalLocation(keyPath); !ok || got.SourceID != "base.yml" || got.Line != 4 || got.Column != 2 {
t.Fatalf("latest historical location = %#v, %v", got, ok)
@@ -213,9 +213,6 @@ func TestHistoryModelFinalizesLocationSensitivityAndDocumentReaders(t *testing.T
if !sawCandidate {
t.Fatal("sensitivity candidate omitted the concrete historical path")
}
if got, found := model.documentAt(root, Keys("shape", "missing")); found || got != nil {
t.Fatalf("lookup for missing value = %#v, %v", got, found)
}
}
func TestHistoryBuilderScratchUsesOneDetachedWorkingDocument(t *testing.T) {