Skip to content

[meshcop] adding SteeringData::MergeBloomFilterWith() - #12145

Merged
jwhui merged 1 commit into
openthread:mainfrom
abtink:ba/bloom-filter-combine
Nov 21, 2025
Merged

[meshcop] adding SteeringData::MergeBloomFilterWith()#12145
jwhui merged 1 commit into
openthread:mainfrom
abtink:ba/bloom-filter-combine

Conversation

@abtink

@abtink abtink commented Nov 13, 2025

Copy link
Copy Markdown
Member

This commit adds a new method, MergeBloomFilterWith(), to SteeringData to allow combining two Bloom filters.

The method performs a bitwise OR operation between the current Steering Data Bloom filter and a given one. It handles cases where the given filter to merge has a shorter length than the target Bloom filter. It requires the target filter's length to be a multiple of the source's length.

A new unit test, TestSteeringDataBloomFilterMerge(), is included to validate the merge logic with various filter length combinations.

@abtink

abtink commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new method MergeBloomFilterWith() to the SteeringData class for combining Bloom filters, along with a corresponding unit test. The implementation of the merge logic is correct and handles error conditions appropriately. The addition of ToString() for SteeringData is also a nice improvement for debugging and testing.

My review includes a couple of suggestions for the new unit test to improve its robustness by covering more failure scenarios and a minor cleanup for an unused header. Overall, the changes are well-implemented.

Comment thread tests/unit/test_meshcop.cpp Outdated
Comment thread tests/unit/test_meshcop.cpp
@github-actions

github-actions Bot commented Nov 13, 2025

Copy link
Copy Markdown

Merging #12145 into main

name branch text data bss total
ot-cli-ftd b81c0e5 481080 860 66580 548520
9e7463b 481080 860 66580 548520
+/- +0 +0 +0 +0
ot-ncp-ftd b81c0e5 447020 764 61824 509608
9e7463b 447020 764 61824 509608
+/- +0 +0 +0 +0
ot-cli-mtd b81c0e5 373248 764 51052 425064
9e7463b 373248 764 51052 425064
+/- +0 +0 +0 +0
ot-ncp-mtd b81c0e5 354228 764 46320 401312
9e7463b 354228 764 46320 401312
+/- +0 +0 +0 +0
ot-cli-ftd-br b81c0e5 585624 868 136444 722936
9e7463b 585624 868 136444 722936
+/- +0 +0 +0 +0
ot-rcp b81c0e5 63200 568 20804 84572
9e7463b 63200 568 20804 84572
+/- +0 +0 +0 +0
Library files
name branch text data bss total
libopenthread-ftd.a b81c0e5 248015 95 40358 288468
9e7463b 248155 95 40358 288608
+/- +140 +0 +0 +140
libopenthread-cli-ftd.a b81c0e5 61459 0 8083 69542
9e7463b 61459 0 8083 69542
+/- +0 +0 +0 +0
libopenthread-ncp-ftd.a b81c0e5 33581 0 5948 39529
9e7463b 33581 0 5948 39529
+/- +0 +0 +0 +0
libopenthread-mtd.a b81c0e5 166089 0 24854 190943
9e7463b 166229 0 24854 191083
+/- +140 +0 +0 +140
libopenthread-cli-mtd.a b81c0e5 41414 0 8059 49473
9e7463b 41414 0 8059 49473
+/- +0 +0 +0 +0
libopenthread-ncp-mtd.a b81c0e5 25805 0 5948 31753
9e7463b 25805 0 5948 31753
+/- +0 +0 +0 +0
libopenthread-ftd-br.a b81c0e5 354583 100 110190 464873
9e7463b 354723 100 110190 465013
+/- +140 +0 +0 +140
libopenthread-cli-ftd-br.a b81c0e5 79460 0 8115 87575
9e7463b 79460 0 8115 87575
+/- +0 +0 +0 +0
libopenthread-rcp.a b81c0e5 9944 0 5060 15004
9e7463b 9944 0 5060 15004
+/- +0 +0 +0 +0
libopenthread-radio.a b81c0e5 19479 0 238 19717
9e7463b 19479 0 238 19717
+/- +0 +0 +0 +0

@codecov

codecov Bot commented Nov 13, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.83%. Comparing base (b81c0e5) to head (90ea747).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12145      +/-   ##
==========================================
+ Coverage   72.18%   73.83%   +1.64%     
==========================================
  Files         673      670       -3     
  Lines      101749    94635    -7114     
==========================================
- Hits        73449    69870    -3579     
+ Misses      28300    24765    -3535     
Files with missing lines Coverage Δ
src/core/meshcop/meshcop.cpp 88.07% <100.00%> (+0.67%) ⬆️
src/core/meshcop/meshcop.hpp 97.05% <100.00%> (+0.08%) ⬆️
tests/unit/test_meshcop.cpp 100.00% <100.00%> (ø)

... and 267 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abtink
abtink force-pushed the ba/bloom-filter-combine branch from d789861 to c785fbd Compare November 13, 2025 17:46
@abtink
abtink marked this pull request as ready for review November 13, 2025 17:48
@github-project-automation github-project-automation Bot moved this to Under review in Enhancing MeshCoP Nov 13, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a MergeBloomFilterWith() method to the SteeringData class that enables combining two Bloom filters using a bitwise OR operation. The implementation handles cases where filters have different lengths, requiring that the source filter's length be a divisor of the target filter's length.

Key Changes

  • Added MergeBloomFilterWith() method that performs bitwise OR merge with validation for compatible filter lengths
  • Added ToString() method and supporting constants (kInfoStringSize, InfoString, kMinLength) for better debugging and output
  • Created comprehensive unit test TestSteeringDataBloomFilterMerge() to validate merge logic with various filter length combinations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/core/meshcop/meshcop.hpp Added method declarations for MergeBloomFilterWith() and ToString(), along with new constants and type definitions
src/core/meshcop/meshcop.cpp Implemented the merge logic with length validation and the string conversion method
tests/unit/test_meshcop.cpp Added new test function with multiple length combinations and updated existing tests to use constants instead of hardcoded values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/meshcop/meshcop.hpp Outdated
Comment thread tests/unit/test_meshcop.cpp Outdated
Comment thread tests/unit/test_meshcop.cpp Outdated
Comment thread tests/unit/test_meshcop.cpp Outdated
Comment thread src/core/meshcop/meshcop.hpp Outdated
Comment thread src/core/meshcop/meshcop.hpp Outdated
Comment thread src/core/meshcop/meshcop.hpp Outdated
This commit adds a new method, `MergeBloomFilterWith()`, to
`SteeringData` to allow combining two Bloom filters.

The method performs a bitwise OR operation between the current
Steering Data Bloom filter and a given one. It handles cases where
the given filter to merge has a shorter length than the target Bloom
filter. It requires the target filter's length to be a multiple of
the source's length.

A new unit test, `TestSteeringDataBloomFilterMerge()`, is included to
validate the merge logic with various filter length combinations.
@abtink
abtink force-pushed the ba/bloom-filter-combine branch from c785fbd to 90ea747 Compare November 17, 2025 21:02
@jwhui

jwhui commented Nov 20, 2025

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new method MergeBloomFilterWith() to the SteeringData class, allowing for the combination of two Bloom filters. The implementation and associated Doxygen comments are clear and correct. A new unit test is also added to validate the merge logic. The changes are well-structured and improve the functionality of the SteeringData class. I have a couple of suggestions to enhance the new unit test to cover more failure scenarios.

Comment thread tests/unit/test_meshcop.cpp
Comment thread tests/unit/test_meshcop.cpp
@jwhui
jwhui merged commit 041c25a into openthread:main Nov 21, 2025
149 of 159 checks passed
@github-project-automation github-project-automation Bot moved this from Under review to Merged in Enhancing MeshCoP Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

5 participants