Skip to content

Fix LocalStore::addMultipleToStore SinkToSource destructor unsoundness#513

Merged
cole-h merged 1 commit into
mainfrom
fixup-addmulti-destructor-unsoundness
Jun 17, 2026
Merged

Fix LocalStore::addMultipleToStore SinkToSource destructor unsoundness#513
cole-h merged 1 commit into
mainfrom
fixup-addmulti-destructor-unsoundness

Conversation

@cole-h

@cole-h cole-h commented Jun 17, 2026

Copy link
Copy Markdown
Member

c.f. #480 (comment)
Picked from Shopify/tecnix@08bee03

Motivation

Context


Thanks @lilyinstarlight!

Summary by CodeRabbit

  • Bug Fixes
    • Improved resource cleanup in batch storage operations for enhanced stability and reliability.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac3bb7b0-9eee-4bf9-b697-ceb2e06a7b68

📥 Commits

Reviewing files that changed from the base of the PR and between 2c7a89a and a51e93a.

📒 Files selected for processing (1)
  • src/libstore/local-store.cc

📝 Walkthrough

Walkthrough

In LocalStore::addMultipleToStore(), the worker-thread lambda now moves item->second into a local source variable at the start of the lambda body. The doAddToStore() call is updated to use this local source. This ensures the Source destructor executes when the lambda scope ends.

Changes

Source Destructor Scope Fix

Layer / File(s) Summary
Move Source into lambda scope and update doAddToStore call
src/libstore/local-store.cc
item->second is moved into a local source variable inside the worker lambda, and doAddToStore() is updated to receive the moved source, guaranteeing destructor execution at lambda scope exit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

A source was left floating, its cleanup delayed,
The lambda's scope ended but it still hadn't frayed.
Now moved to a local, it tidies up right,
Destructor runs cleanly when lambda says night.
🐇✨ Scope fixed, all hops accounted for!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a destructor issue in LocalStore::addMultipleToStore related to SinkToSource, which directly corresponds to the code change.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fixup-addmulti-destructor-unsoundness

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

@github-actions

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request June 17, 2026 17:39 Inactive
@cole-h cole-h added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit b06153a Jun 17, 2026
33 checks passed
@cole-h cole-h deleted the fixup-addmulti-destructor-unsoundness branch June 17, 2026 19:10
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.

3 participants