Single-file and directory snapshot reads judge the format stamp before parsing the body; a flush heals an empty or truncated file

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-22 17:30:57 +02:00
commit 39e8ab5efd
5 changed files with 157 additions and 31 deletions

View file

@ -96,14 +96,15 @@ All notable changes to this package are documented in this file.
1.0.x. CultMesh single-file reads, the directory store and CultNet refuse a variant
record by name; only the C# CultCache resolves variants.
- A plain flush (`SingleFileBackingStore.PushAll`) reads the file under the lock before it
rewrites it, by the same rule attach and conditional commit use, and throws
rewrites it, by the same rule attach and conditional commit use (the format stamp in
the header decides, before the body is parsed), and throws
`NotSupportedException` instead of writing when the store is one this runtime
refuses to read: stamped by another process with a newer format, or with a header the
refuses to read: stamped by another process with a newer format, or with a stamp the
reader refuses. A read that fails with an I/O or access error also refuses. It used to
overwrite the file from this cache's older view. A directory store throws the same
exception, from the manifest parse every write already ran, for a manifest stamped
`cultcache.store.v<N>` with N > 4 (it threw `InvalidOperationException`). A file that
merely cannot be parsed (empty, corrupt) is not a newer format, and a flush still
`cultcache.store.v<N>` with N > 4 (it threw `InvalidOperationException`). A file with no
readable stamp at all (empty, truncated, or not a snapshot) is not a newer format, and a flush
rewrites it.
- `CultMesh.WriteSingleFileDocument` and `WriteSingleFileDocumentPayload` read the
file they replace, under the store's `<path>.lock`, and refuse (without touching