Skip to content

[Bugfix] Delete all bonds does not allow re-pairing.#1114

Merged
h2zero merged 1 commit intomasterfrom
bugfix/delete-all-bonds
Mar 17, 2026
Merged

[Bugfix] Delete all bonds does not allow re-pairing.#1114
h2zero merged 1 commit intomasterfrom
bugfix/delete-all-bonds

Conversation

@h2zero
Copy link
Owner

@h2zero h2zero commented Mar 17, 2026

This change iterates through each bond and unpairs it rather than just deleting the bond data in nvs, allowing a connected peer to rebond.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Bluetooth device bond management with enhanced error handling during deletion operations. Each bond is now individually validated with comprehensive failure tracking and proper error reporting.
  • Refactor

    • Optimized bond deletion workflow with granular validation and better error checking for improved system reliability.

This change iterates through each bond and unpairs it rather than just deleting the bond data in nvs, allowing a connected peer to rebond.
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f45a7f15-ee7a-48ec-8703-ac4d82f42d5e

📥 Commits

Reviewing files that changed from the base of the PR and between 2afee83 and 2d4f011.

📒 Files selected for processing (1)
  • src/NimBLEDevice.cpp

📝 Walkthrough

Walkthrough

Arr, this here change be modifyin' the deleteAllBonds() function, replacin' the bulk ble_store_clear() call with a granular loop that be deletin' each bonded address individually through deleteBond(addr). The function now iterates from the last bond backward, reportin' failure upon any hiccup in the process, yarrr!

Changes

Cohort / File(s) Summary
Bond Deletion Logic
src/NimBLEDevice.cpp
Refactored deleteAllBonds() from a single bulk clear operation to a per-bond deletion loop that iterates backward through each bonded address, enhancin' error granularity and returnin' failure status if any individual bond deletion fails.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Issue #1110: This pull request directly implements the workaround described in the related issue, replacin' the problematic ble_store_clear() bulk operation with iterative per-bond deletion via deleteBond(addr) to address the underlying concern with bulk clearing.

Poem

🏴‍☠️ A bond be deleted one by one, yarrr!
No more bulk sweepin' of the seas,
Each treasure now accountable, arr,
From stern to bow with greater ease,
The ship sails true—no bonds to flee! 🗺️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the specific bugfix: delete all bonds functionality not allowing re-pairing, which directly corresponds to the change described in the PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/delete-all-bonds
📝 Coding Plan
  • Generate coding plan for human review comments

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

@h2zero h2zero merged commit 820ef32 into master Mar 17, 2026
42 checks passed
@h2zero h2zero deleted the bugfix/delete-all-bonds branch March 17, 2026 01:08
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.

deleteAllBonds() apparently leaves stale SM state — re-pairing fails within same boot cycle (workaround: iterate deleteBond())

1 participant