Skip to content

fix(transaction-log): prevent retry format drift - #459

Merged
yordis merged 1 commit into
masterfrom
yordis/fix-preserve-prepare-version
Aug 15, 2026
Merged

fix(transaction-log): prevent retry format drift#459
yordis merged 1 commit into
masterfrom
yordis/fix-preserve-prepare-version

Conversation

@yordis

@yordis yordis commented Aug 15, 2026

Copy link
Copy Markdown
Member
  • Retried prepares must retain their persisted format so chunk-boundary rewrites cannot silently change record encoding.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches transaction-log persistence encoding on retry paths used by the storage writer; wrong version could corrupt or misread records, but the change is a one-line fix with targeted tests.

Overview
PrepareLogRecord.CopyForRetry now passes prepareRecordVersion: Version into the new record so a retry keeps the same on-disk encoding (V0 vs V1) instead of defaulting to the current prepare format.

That matters because WriteTo chooses int vs long for expected version based on version; chunk-boundary rewrites after a failed write could otherwise change encoding silently.

Adds PrepareLogRecordTests.copy_for_retry_preserves_record_version for V0 and V1, including write/parse round-trip.

Reviewed by Cursor Bugbot for commit b369071. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c8e8b4a-62ee-47a9-9bbf-c3e3a9128a6f

📥 Commits

Reviewing files that changed from the base of the PR and between 8046703 and b369071.

📒 Files selected for processing (2)
  • src/EventStore.Core.XUnit.Tests/TransactionLog/LogRecords/PrepareLogRecordTests.cs
  • src/EventStore.Core/TransactionLog/LogRecords/PrepareLogRecord.cs

Walkthrough

CopyForRetry now preserves the source PrepareLogRecord version. New parameterized tests cover V0 and V1 records before and after serialization.

Changes

Prepare record retry version

Layer / File(s) Summary
Preserve version during retry copies
src/EventStore.Core/TransactionLog/LogRecords/PrepareLogRecord.cs, src/EventStore.Core.XUnit.Tests/TransactionLog/LogRecords/PrepareLogRecordTests.cs
CopyForRetry passes the source Version to the copied record. Tests verify V0 and V1 versions on the copy and after serialization and deserialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to b3690

The change preserves the persisted format for retried prepares and includes targeted tests; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

I’m a rabbit with records tucked tight,
V0 and V1 now copy just right.
Through retry and serialization’s trail,
Their versions stay true without fail.
Hop, hop—consistent data prevails!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the transaction-log fix and the prevention of format drift during retries.
Description check ✅ Passed The description directly explains that retried prepares retain their persisted format to prevent encoding changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/fix-preserve-prepare-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yordis
yordis merged commit a47fb58 into master Aug 15, 2026
23 checks passed
@yordis
yordis deleted the yordis/fix-preserve-prepare-version branch August 15, 2026 07:42
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