Skip to content

fix(storage): delete a session in one transaction - #541

Merged
mrnasil merged 1 commit into
mainfrom
fix/storage-delete-session-atomic
Dec 3, 2026
Merged

mrnasil merged 1 commit into
mainfrom
fix/storage-delete-session-atomic

Conversation

@mrnasil

@mrnasil mrnasil commented Dec 3, 2026

Copy link
Copy Markdown
Member

What

Database::delete_session ran four DELETE statements one by one. If one failed midway, the session stayed listed with its messages already gone. They now run in one transaction: all four commit, or none does.

Same change as the storage part of #526, with a test and without the working notes.

Test

a_failed_delete_leaves_the_session_whole drops session_chunks so the third statement fails, then checks the session row and its message are still there.

  • cargo test -p whycodes-storage: 46 passed
  • Linux line coverage of whycodes-storage: no missed lines
  • fmt, clippy -D warnings, budget scripts: ok

🤖 Generated with Claude Code

The four deletes ran one by one, so a statement failing midway left a
session listed with its messages already gone. They now commit together
or not at all.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@mrnasil
mrnasil enabled auto-merge (squash) December 3, 2026 16:44
@mrnasil
mrnasil merged commit a657992 into main Dec 3, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/storage-delete-session-atomic branch December 3, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant