Skip to content

test(memory): add rollback test for apply_consolidation_merge on mid-tx error #2359

@bug-ops

Description

@bug-ops

Context

apply_consolidation_merge in crates/zeph-memory/src/consolidation.rs uses a SQLite transaction. BLOCKER-01 from the architect critique was addressed (transaction wrapping), but the failure/rollback path has no automated test.

What to test

Inject a failure mid-transaction (e.g., mock pool to return an error after the first INSERT) and assert:

  • The memory_consolidation_sources table has no rows for the attempted merge
  • The original messages have consolidated = false
  • The function returns Err, not Ok

Acceptance criteria

A #[tokio::test] in consolidation.rs that exercises the rollback path and passes.

Discovered in PR #2358 tester review.

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitymemoryzeph-memory crate (SQLite)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions