Skip to content

fix(journal): close the region in Stop when the final flush or MarkClean fails - #106

Merged
mattmattox merged 1 commit into
mainfrom
claude/journal-stop-close
Nov 13, 2026
Merged

mattmattox merged 1 commit into
mainfrom
claude/journal-stop-close

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

This is the follow-up from #31. When the final batch flush or MarkClean failed, Stop returned without calling region.Close(). Now it always closes the region and joins the errors.

No leak today: Region.Close does nothing, because the device belongs to the caller. This change makes sure a future Close can't be skipped. No test can observe the close itself.

Test: TestStopReportsFailedBatchFlush covers the failure path of Stop, which had no test before:

  • The failed final flush is returned from Stop.
  • The waiting batched commit receives the same error.
  • A second Stop returns nil.

The test passes on main as well, because the behavior it checks didn't change.

🤖 Generated with Claude Code

…ean fails

Stop returned early on those paths without calling region.Close. Close
does nothing today, since the caller owns the device, so nothing leaked;
Stop now always closes and joins the errors so a future Close cannot be
skipped. A new test covers the failed-flush path of Stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 57d7b72 into main Nov 13, 2026
13 checks passed
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