CultLib/packages/cultcache-ts/CHANGELOG.md
Meta Vens 1a3780621e cultcache-ts: the whole-store writer decodes the stamp with the decoder a read uses
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-22 23:40:21 +02:00

2 KiB

Changelog

All notable changes to @gamecult/cultcache-ts are recorded here, following Keep a Changelog.

[0.14.2]

Added

  • SingleFileMessagePackBackingStore takes a cross-process write lock on <file>.lock, interoperable with the C# and Rust runtimes (flock on Unix, LockFileEx on Windows). push and delete read the current file, merge and replace it under the lock, so concurrent TypeScript and Rust writers no longer lose each other's records across those calls. A full pushAll still replaces the whole store, so records a concurrent writer added are lost to it. C# writes are not all alike: a conditional commit on a clean store lands onto the file as it is, but C# writers can still overwrite records a concurrent TypeScript writer added.
  • The staged file is fsynced before the replace, and on Unix the directory after it. A directory sync failure after the replace is reported as replaced but not durable.

Changed

  • The Windows replace is a POSIX-semantics rename first (it lands while C# and Rust readers hold the store open), falling back to a write-through MoveFileExW, with 25 attempts 20 ms apart on errors 5, 32 and 33. Writers wait up to 30 s for the lock.
  • Opening a legacy store that needs healing rewrites it under the lock, from a read taken under the lock.

Fixed

  • A full pushAll reads the store's header under the lock first and refuses a store format this runtime does not read (the same error a read gives), leaving the file as it was. A file with no readable stamp is still replaced, so a whole write heals it. Soft pushAll is unchanged. The stamp is decoded by the decoder a read uses, so a stamp followed by bytes that are not UTF-8 is refused by a whole write as a read refuses it.

Dependencies

  • koffi 3.3.0, loaded only on the first write.

[0.14.1]

Added

  • checkPayloadDepth is re-exported from @gamecult/cultcache-ts/document, so dependents (cultnet-ts/content) bound payload nesting with the same check the cache applies on decode.