Skip to content

test(memory): add unit tests for SqliteStore tier DB methods#2097

Merged
bug-ops merged 1 commit intomainfrom
feat/issue-2094/sqlitestore-tier-db-tests
Mar 21, 2026
Merged

test(memory): add unit tests for SqliteStore tier DB methods#2097
bug-ops merged 1 commit intomainfrom
feat/issue-2094/sqlitestore-tier-db-tests

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 21, 2026

Closes #2094.

Summary

Test plan

  • Happy path for every method
  • Empty input guards (fetch_tiers(&[]), manual_promote(&[]), promote_to_semantic(…, &[]))
  • Already-promoted rows (idempotency, exclusion from candidates)
  • Soft-deleted rows excluded from counts and tier queries
  • Nonexistent IDs handled without error
  • find_promotion_candidates respects batch_size and session_count threshold
  • promote_to_semantic atomically creates semantic fact and soft-deletes originals
  • Migration 042 schema defaults verified by direct INSERT without tier/session_count columns
  • cargo nextest run --workspace --features full --lib --bins6362 tests passed
  • cargo clippy --workspace --features full -- -D warnings — clean
  • cargo +nightly fmt --check — clean

@bug-ops bug-ops enabled auto-merge (squash) March 21, 2026 23:28
@github-actions github-actions bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes tests Test-related changes size/L Large PR (201-500 lines) labels Mar 21, 2026
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
@bug-ops bug-ops force-pushed the feat/issue-2094/sqlitestore-tier-db-tests branch from e6b4b91 to 4f3aefe Compare March 21, 2026 23:28
@github-actions github-actions bot removed the tests Test-related changes label Mar 21, 2026
@bug-ops bug-ops merged commit 49901d0 into main Mar 21, 2026
25 checks passed
@bug-ops bug-ops deleted the feat/issue-2094/sqlitestore-tier-db-tests branch March 21, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(memory): add unit tests for SqliteStore tier DB methods

1 participant