Rust: a whole-store flush reads the on-disk header first and refuses one it cannot read
push_all overwrote a v9, variant-v2 or variant store with a v1 file, dropping its variants; TypeScript and Python refuse. The rewrite header now comes from the file's own prefix and shares one readable-format rule with the decoder. TypeScript pullAll resets its header when the file is gone, empty or legacy, as Python does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6a7d17bdda
commit
591eeff70d
4 changed files with 91 additions and 15 deletions
|
|
@ -44,6 +44,8 @@ export class SingleFileMessagePackBackingStore implements CacheBackingStore {
|
|||
}
|
||||
|
||||
async pullAll(): Promise<CultCacheEnvelope[]> {
|
||||
// The disk decides the header: a file that is gone, empty or legacy is not marked.
|
||||
this.#format = STORE_FORMAT_VERSION;
|
||||
try {
|
||||
const data = await readFile(this.filePath);
|
||||
if (data.length === 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue