test(memory): add unit tests for SqliteStore tier DB methods#2097
Merged
test(memory): add unit tests for SqliteStore tier DB methods#2097
Conversation
Closes #2094. Adds 29 inline tests in sqlite/messages/tests.rs covering all tier DB methods introduced in the AOI three-layer memory epic (#1839, #2092): - fetch_tiers: empty input, default episodic tier, nonexistent IDs, tier value after manual_promote - count_messages_by_tier: empty DB, all-episodic, post-promotion counts, soft-deleted rows excluded - find_promotion_candidates: empty when session_count below threshold, returns rows meeting threshold, excludes semantic rows, respects batch_size - promote_to_semantic: creates semantic message, soft-deletes originals, new ID greater than originals, empty-ids error, tier count update - manual_promote: empty input no-op, sets tier to semantic, does not delete original, idempotent (0 rows affected on second call), skips nonexistent IDs - migration 042 schema defaults: tier defaults to 'episodic', session_count defaults to 0 for rows inserted without those columns
e6b4b91 to
4f3aefe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2094.
Summary
#[tokio::test]tests incrates/zeph-memory/src/sqlite/messages/tests.rsfetch_tiers,count_messages_by_tier,find_promotion_candidates,promote_to_semantic,manual_promotetier = 'episodic',session_count = 0)Test plan
fetch_tiers(&[]),manual_promote(&[]),promote_to_semantic(…, &[]))find_promotion_candidatesrespectsbatch_sizeandsession_countthresholdpromote_to_semanticatomically creates semantic fact and soft-deletes originalscargo nextest run --workspace --features full --lib --bins— 6362 tests passedcargo clippy --workspace --features full -- -D warnings— cleancargo +nightly fmt --check— clean