ludic.base: an input that is itself a bake hashes by its payload, not its header - a re-bake that makes the same bytes under a new inputs hash leaves the bakes that read it current

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 18:56:50 +03:00
parent 8acce7beb9
commit d9a73d63bd
2 changed files with 35 additions and 3 deletions

View file

@ -39,6 +39,18 @@ program BakedTest {
expect(bake_inputs_hash(dir() + "/in.txt") != h1)
expect(bake_inputs_hash("") == -3750763034362895579)
}
test "an input that is itself a bake hashes by its payload, not its header" {
let p = buffer(3)
for i in 0 .. 3 { p[i] = 120 + i }
let path = dir() + "/chain.bin"
expect(bake_write(path, "terrain", 1, 7, p, 3))
let h1 = bake_inputs_hash(path)
expect(bake_write(path, "terrain", 1, 99, p, 3))
expect(bake_inputs_hash(path) == h1)
p[2] = 0
expect(bake_write(path, "terrain", 1, 99, p, 3))
expect(bake_inputs_hash(path) != h1)
}
test "a dev build says a missing bake once" (bake_st: mut BakeState) {
bake_missing(bake_st, "k")
bake_missing(bake_st, "k")