TestAnEncryptedDatabaseKeepsItsDocumentsOffTheDisk
(internal/store/dump_test.go:417) writes 50 documents to an encrypted database, takes the
durable image, and asserts that six plaintext strings do not appear anywhere in it:
// dump_test.go:448
for _, text := range []string{"Secret number 7", "author", "ann", "articles", "by_author", "s07"} {
if bytes.Contains(image, []byte(text)) {
t.Errorf("the file holds %q in the open", text)
}
}
Two of the six are three characters: "ann" and "s07". In a
buffer of random bytes, a given three-byte sequence turns up by chance often enough to matter, and the
page nonces come from crypto/rand, not from the simulated disk's seed — so the
ciphertext differs on every run even though vfs.NewSim(66, …) looks
deterministic.
go test -run 'TestAnEncryptedDatabaseKeepsItsDocumentsOffTheDisk$' -count=2000
./internal/store/ → 13 failures in 2000 runs
(≈ 0.65%)."ann" and "s07". Neither of the four longer strings failed once.-count=200 passed clean, which is the point: at this rate a developer
will see it perhaps once a month and read it as noise, and CI will see it about once in every 150
runs of that package.Does it lose data, break a promise on a public surface, or stop somebody installing and running? No, to all three. The product is correct: the encryption works, and the test is the thing that is wrong. Nobody installing sapedb runs this.
Defer. It is worth saying why this feels wrong and still is not a 1.0.0 item: the assertion it flakes on is a security claim, and a security test that goes red at random is the kind people learn to re-run. But the triage question is about the shipped artifact, and by that question this does not qualify. The fix is also a two-line edit that can land any time, which is an argument for doing it soon — not for making it a release gate.
"ann" → the full author value, "s07" → the full slug with its
field name).