π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(vecdb): invalidate snapshots using the old slot mapping
laurenspriemb6c6f5232dfb
diff --git a/rust/crates/vecdb/src/snapshot.rs b/rust/crates/vecdb/src/snapshot.rsindex 8e5a095794..d54a509713 100644--- a/rust/crates/vecdb/src/snapshot.rs+++ b/rust/crates/vecdb/src/snapshot.rs@@ -8,7 +8,7 @@ use super::graph::{Graph, GraphNodeParts};use super::log::{remove_if_present, rename_with_windows_fallback, sync_parent_dir};const MAGIC: [u8; 4] = *b"EVDG";-const FORMAT_VERSION: u16 = 1;+const FORMAT_VERSION: u16 = 2;const NO_ENTRY_POINT: u32 = u32::MAX;const CRC_LEN: usize = 4;const FIXED_PREFIX_LEN: usize = 47;@@ -267,13 +267,13 @@ mod tests {use super::*;const GOLDEN: [u8; 94] = [- 0x45, 0x56, 0x44, 0x47, 0x01, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,+ 0x45, 0x56, 0x44, 0x47, 0x02, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00,0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,- 0x10, 0xe9, 0x5e, 0xe7,+ 0xef, 0xb9, 0xf3, 0x93,];fn golden_generation() -> [u8; 16] {@@ -411,7 +411,7 @@ mod tests {}#[test]- fn golden_bytes_pin_format_v1() {+ fn golden_bytes_pin_format_v2() {let dir = TempDir::new().unwrap();let written_path = dir.path().join("written");write_snapshot(&written_path, golden_generation(), 300, &golden_graph()).unwrap();@@ -616,9 +616,17 @@ mod tests {}#[test]- fn bad_version_is_discarded() {+ fn future_version_is_discarded() {assert_discarded(|bytes| {- bytes[4..6].copy_from_slice(&2u16.to_le_bytes());+ bytes[4..6].copy_from_slice(&(FORMAT_VERSION + 1).to_le_bytes());+ refresh_crc(bytes);+ });+ }++ #[test]+ fn old_slot_mapping_version_is_discarded() {+ assert_discarded(|bytes| {+ bytes[4..6].copy_from_slice(&1u16.to_le_bytes());refresh_crc(bytes);});}