Index manifest input candidates within each operation

This commit is contained in:
2026-12-02 21:49:40 +00:00
parent 6fb15b0094
commit f7a7afe12f
14 changed files with 108 additions and 37 deletions

View File

@@ -240,3 +240,22 @@ func TestResolvePreparedGlossaryDocuments(t *testing.T) {
t.Fatalf("retired source: %v", err)
}
}
func TestInputLookupKeepsSnapshotAndRechecksFileContent(t *testing.T) {
paths, m, file, _ := preparedInputFixture(t, artifactpolicy.SourceInputParty, []byte("party: ready\n"))
m.Inputs = append(m.Inputs, manifest.InputRecord{Kind: "unrelated", Path: "../../outside"})
lookup := NewInputLookup(paths, m)
m.Inputs = nil
if _, err := ResolvePreparedInputWithLookup(paths, lookup, artifactpolicy.SourceInputParty); err != nil {
t.Fatalf("snapshot resolution: %v", err)
}
if _, err := ResolvePreparedInputWithLookup(paths, NewInputLookup(paths, m), artifactpolicy.SourceInputParty); !errors.Is(err, ErrPreparedInputAbsent) {
t.Fatalf("replaced inputs: %v", err)
}
if err := os.WriteFile(file, []byte("party: changed\n"), 0o644); err != nil {
t.Fatal(err)
}
if _, err := ResolvePreparedInputWithLookup(paths, lookup, artifactpolicy.SourceInputParty); err == nil || !strings.Contains(err.Error(), "checksum mismatch") {
t.Fatalf("changed content: %v", err)
}
}