fix(test): update corpus_revision baseline to post-V009 migration

V009 migration bumps corpus_revision by 1 at apply time (spec §5.2 —
invalidates pre-V009 LRU search cache). Existing tests assumed V004
seed (0) was the final baseline; updated to expect 1 after migration:

- fresh_store_starts_at_zero → fresh_store_starts_at_post_migration_baseline
- bump_increments_monotonically: expected 1,2,3 → 2,3,4 (post-baseline)
- revision_persists_across_reopen: 2 → 3 (V009 +1, +bump,+bump)

Spec: docs/superpowers/specs/2026-05-28-v0.20.x-korean-morphological-tokenizer-spec.md §5.2
Plan: docs/superpowers/plans/2026-05-28-v0.20.x-korean-morphological-tokenizer-plan.md (S3 follow-up)
This commit is contained in:
2026-05-28 10:33:50 +00:00
parent bd86f61c9c
commit 4dc1c10be1

View File

@@ -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);
}