diff --git a/crates/kebab-store-sqlite/tests/corpus_revision.rs b/crates/kebab-store-sqlite/tests/corpus_revision.rs index e590543..2ba6026 100644 --- a/crates/kebab-store-sqlite/tests/corpus_revision.rs +++ b/crates/kebab-store-sqlite/tests/corpus_revision.rs @@ -20,23 +20,26 @@ fn open_store(tmp: &TempDir) -> SqliteStore { store } -/// Fresh store seeds `corpus_revision = 0` (per V004 INSERT). +/// Fresh store baseline: V004 seeds `corpus_revision = 0`, then V009 +/// migration bumps it by one to invalidate any pre-V009 LRU cache — +/// so a fresh store after `run_migrations()` reads back as `1`. #[test] -fn fresh_store_starts_at_zero() { +fn fresh_store_starts_at_post_migration_baseline() { let tmp = TempDir::new().unwrap(); let store = open_store(&tmp); - assert_eq!(store.corpus_revision(), 0); + assert_eq!(store.corpus_revision(), 1); } -/// Each `bump_corpus_revision` returns the new value monotonically. +/// Each `bump_corpus_revision` returns the new value monotonically +/// from the post-migration baseline. #[test] fn bump_increments_monotonically() { let tmp = TempDir::new().unwrap(); let store = open_store(&tmp); - assert_eq!(store.bump_corpus_revision().unwrap(), 1); assert_eq!(store.bump_corpus_revision().unwrap(), 2); assert_eq!(store.bump_corpus_revision().unwrap(), 3); - assert_eq!(store.corpus_revision(), 3); + assert_eq!(store.bump_corpus_revision().unwrap(), 4); + assert_eq!(store.corpus_revision(), 4); } /// `corpus_revision` survives a store re-open (persisted in SQLite). @@ -49,6 +52,6 @@ fn revision_persists_across_reopen() { store.bump_corpus_revision().unwrap(); } // store dropped — file closed let store = open_store(&tmp); - assert_eq!(store.corpus_revision(), 2); - assert_eq!(store.bump_corpus_revision().unwrap(), 3); + assert_eq!(store.corpus_revision(), 3); + assert_eq!(store.bump_corpus_revision().unwrap(), 4); }