feat(snapshot): schema_version field + zstd at-rest compression
schema_version (int=1): - Added to SnapshotDict TypedDict and SnapshotRecord dataclass - Persisted in every new snapshot file; defaults to 1 when reading pre-migration files that lack the key - Intentionally excluded from the snapshot-ID hash — it is metadata, not content; changing schema_version never invalidates a snapshot ID - Constant _SNAPSHOT_SCHEMA_VERSION = 1 (bump only on breaking layout changes)
zstd at-rest compression: - Added zstandard>=0.22.0 to pyproject.toml core dependencies - _zstd_compress / zstd_decompress_if_needed helpers in store.py - _write_msgpack_atomic gains compress=True flag; write_snapshot passes it - Files are compressed only when packed msgpack exceeds _ZSTD_COMPRESS_THRESHOLD (8 KB) — tiny snapshots stay as raw msgpack, no overhead for small repos - Detection is self-describing via 4-byte zstd magic (\x28\xb5\x2f\xfd) so all existing uncompressed snapshot files remain readable without migration - _read_msgpack calls zstd_decompress_if_needed transparently before unpacking - Both raw GC snapshot reads in gc.py updated to decompress before unpackb
Indices dir: reserved; not yet used for snapshot indexing.
Tests: test_snapshot_schema_version_and_compression.py — 33 tests across unit, integration, E2E, stress, state, integrity, performance, security tiers
0 comments
muse hub commit comment sha256:3a73d3b15384972008e0fb501f92506d480b1f493570cfeeee607996b71de437 --body "your comment"
No comments yet. Be the first to start the discussion.