Skip to content

Don't stop trying BLE if mDNS commissioning fails #fixes 43364#43527

Open
woody-apple wants to merge 8 commits intoproject-chip:masterfrom
woody-apple:issue/43364
Open

Don't stop trying BLE if mDNS commissioning fails #fixes 43364#43527
woody-apple wants to merge 8 commits intoproject-chip:masterfrom
woody-apple:issue/43364

Conversation

@woody-apple
Copy link
Contributor

Summary

Starting BLE scan:
2026-02-27 09:23:47.274055-0500 0x97808 Default 0x227995 201 0 homed: (Matter) [com.csa.matter:Default] Pre-warming done

Appears over mDNS
2026-02-27 09:23:49.363666-0500 0x97813 Default 0x0 201 0 homed: (Matter) [com.csa.matter:Discovery] Resolve type=_matterc._udp name=27A648528C4C6BBC domain=local. interface=15

Appears over BLE
2026-02-27 09:23:53.831386-0500 0x9755E Default 0x0 201 0 homed: (Matter) [com.csa.matter:Controller] Discovered device to be commissioned over BLE[11:22 AM]The SDK waits a little bit for BLE, and we also do some “pre-warming” on the iOS side, to bring the BLE radio up as soon as the UI appears, instead of when we just start startcommissioning (to give BLE even more time).

Proposal:

Basically, if we fail-out DNS-SD, and then the discriminator is avaiable on BLE, try BLE. This is the same as saying "try all colliding discriminator/VID/PID over every transport" which is supposed to help reliability

Related issues

#43364

Testing

Manual

Readability checklist

The checklist below will help the reviewer finish PR review in time and keep the
code readable:

  • PR title is
    descriptive
  • Apply the
    “When in Rome…”
    rule (coding style)
  • PR size is short
  • Try to avoid "squashing" and "force-update" in commit history
  • CI time didn't increase

See: Pull Request Guidelines

Copy link
Contributor

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

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 improves the reliability of the commissioning process by allowing discovery on other transports (like BLE) to continue even if one transport (like mDNS) fails or is slow to establish a PASE session. The changes correctly modify the discovery timeout and error handling logic to be more resilient. A new helper function StopPairingIfTransportsExhausted is introduced to centralize the logic for failing the pairing process, which is a good improvement. My only feedback is a minor one on a comment that could be more accurate.

Note: Security Review is unavailable for this PR.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

PR #43527: Size comparison from 6d0caa2 to 400474a

Full report (6 builds for cc32xx, nrfconnect, realtek, stm32)
platform target config section 6d0caa2 400474a change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 558130 558130 0 0.0
RAM 204504 204504 0 0.0
lock CC3235SF_LAUNCHXL FLASH 591262 591262 0 0.0
RAM 204744 204744 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 857656 857656 0 0.0
RAM 161999 161999 0 0.0
realtek light-switch-app rtl8777g FLASH 720776 720776 0 0.0
RAM 113448 113448 0 0.0
lighting-app rtl8777g FLASH 767984 767984 0 0.0
RAM 114688 114688 0 0.0
stm32 light STM32WB5MM-DK FLASH 478904 478904 0 0.0
RAM 141324 141324 0 0.0

@mergify mergify bot added the conflict label Mar 11, 2026
@jtung-apple jtung-apple marked this pull request as ready for review March 11, 2026 21:15
Copilot AI review requested due to automatic review settings March 11, 2026 21:15
@mergify mergify bot removed the conflict label Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates controller setup-code pairing logic so a DNS-SD discovery timeout won’t prematurely stop physical-proximity transports (BLE / Wi‑Fi PAF / NFC) when a PASE attempt is already underway, improving commissioning reliability when mDNS-based attempts fail.

Changes:

  • Adjust discovery-timeout handling to stop DNS-SD only (when PASE is in progress) and introduce a helper to fail only when all transports are exhausted.
  • Stop DNS-SD after a DNS-SD-triggered PASE attempt completes to avoid discovery being “stuck on” indefinitely.
  • Add unit tests and a test-access helper to validate timeout behavior and transport state preservation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/controller/SetUpCodePairer.cpp Refines timeout/transport-stop logic; adds “transports exhausted” failure path; stops DNS-SD after IP PASE attempts.
src/controller/SetUpCodePairer.h Adds friend test accessor and declares StopPairingIfTransportsExhausted.
src/controller/tests/BUILD.gn Registers new SetUpCodePairer unit test and test-access header.
src/controller/tests/TestSetUpCodePairer.cpp Adds tests for timeout behavior with/without PASE in progress.
src/controller/tests/SetUpCodePairerTestAccess.h Provides controlled access to SetUpCodePairer internals for tests.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 12, 2026 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

@mergify mergify bot removed the conflict label Mar 12, 2026
@github-actions
Copy link

PR #43527: Size comparison from e39dcc1 to 3731169

Full report (5 builds for cc32xx, realtek, stm32)
platform target config section e39dcc1 3731169 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 558106 558106 0 0.0
RAM 204504 204504 0 0.0
lock CC3235SF_LAUNCHXL FLASH 591230 591230 0 0.0
RAM 204744 204744 0 0.0
realtek light-switch-app rtl8777g FLASH 720520 720520 0 0.0
RAM 113448 113448 0 0.0
lighting-app rtl8777g FLASH 767736 767736 0 0.0
RAM 114688 114688 0 0.0
stm32 light STM32WB5MM-DK FLASH 478820 478820 0 0.0
RAM 141324 141324 0 0.0

Copilot AI review requested due to automatic review settings March 12, 2026 19:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

PR #43527: Size comparison from e39dcc1 to 85ece64

Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section e39dcc1 85ece64 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1089396 1089396 0 0.0
RAM 144762 144762 0 0.0
bl616 lighting-app bl616+thread FLASH 1100324 1100324 0 0.0
RAM 104184 104184 0 0.0
bl616+wifi+shell FLASH 1586916 1586916 0 0.0
RAM 98080 98080 0 0.0
bl702 lighting-app bl702+eth FLASH 1052752 1052752 0 0.0
RAM 108357 108357 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 890764 890764 0 0.0
RAM 105748 105748 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 779164 779164 0 0.0
RAM 103324 103324 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786528 786528 0 0.0
RAM 108508 108508 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 732724 732724 0 0.0
RAM 97316 97316 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 716160 716160 0 0.0
RAM 97476 97476 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 558106 558106 0 0.0
RAM 204504 204504 0 0.0
lock CC3235SF_LAUNCHXL FLASH 591230 591230 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 971196 971196 0 0.0
RAM 125796 125796 0 0.0
BRD4338a FLASH 769284 769260 -24 -0.0
RAM 236528 236544 16 0.0
window-app BRD4187C FLASH 1074656 1074656 0 0.0
RAM 126440 126440 0 0.0
esp32 all-clusters-app c3devkit DRAM 98356 98356 0 0.0
FLASH 1596564 1596564 0 0.0
IRAM 93514 93514 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 857588 857588 0 0.0
RAM 161999 161999 0 0.0
nxp contact mcxw71+release FLASH 735808 735808 0 0.0
RAM 66936 66936 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1708508 1708508 0 0.0
RAM 213940 213940 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1607180 1607180 0 0.0
RAM 210812 210812 0 0.0
light cy8ckit_062s2_43012 FLASH 1470412 1470412 0 0.0
RAM 196988 196988 0 0.0
lock cy8ckit_062s2_43012 FLASH 1497092 1497092 0 0.0
RAM 224732 224732 0 0.0
qpg lighting-app qpg6200+debug FLASH 840636 840636 0 0.0
RAM 127780 127780 0 0.0
lock-app qpg6200+debug FLASH 779312 779312 0 0.0
RAM 118728 118728 0 0.0
realtek light-switch-app rtl8777g FLASH 720520 720520 0 0.0
RAM 113448 113448 0 0.0
lighting-app rtl8777g FLASH 767736 767736 0 0.0
RAM 114688 114688 0 0.0
stm32 light STM32WB5MM-DK FLASH 478820 478820 0 0.0
RAM 141324 141324 0 0.0
telink bridge-app tl7218x FLASH 728648 728648 0 0.0
RAM 95760 95760 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 852792 852792 0 0.0
RAM 44176 44176 0 0.0
tl7218x FLASH 844196 844196 0 0.0
RAM 99564 99564 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 725462 725462 0 0.0
RAM 55740 55740 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 788030 788030 0 0.0
RAM 74916 74916 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 725458 725458 0 0.0
RAM 33220 33220 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 616200 616200 0 0.0
RAM 118232 118232 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 842966 842970 4 0.0
RAM 97272 97272 0 0.0

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.16%. Comparing base (e39dcc1) to head (2aa13fd).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/controller/SetUpCodePairer.cpp 71.42% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43527      +/-   ##
==========================================
+ Coverage   54.07%   54.16%   +0.08%     
==========================================
  Files        1548     1548              
  Lines      106701   106709       +8     
  Branches    13309    13281      -28     
==========================================
+ Hits        57699    57799     +100     
+ Misses      49002    48910      -92     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings March 12, 2026 22:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


You can also share your feedback on Copilot code review. Take the survey.

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

PR #43527: Size comparison from e39dcc1 to 2aa13fd

Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section e39dcc1 2aa13fd change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1089396 1089396 0 0.0
RAM 144762 144762 0 0.0
bl616 lighting-app bl616+thread FLASH 1100324 1100324 0 0.0
RAM 104184 104184 0 0.0
bl616+wifi+shell FLASH 1586916 1586916 0 0.0
RAM 98080 98080 0 0.0
bl702 lighting-app bl702+eth FLASH 1052752 1052752 0 0.0
RAM 108357 108357 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 890764 890764 0 0.0
RAM 105748 105748 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 779164 779164 0 0.0
RAM 103324 103324 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786528 786528 0 0.0
RAM 108508 108508 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 732724 732724 0 0.0
RAM 97316 97316 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 716160 716160 0 0.0
RAM 97476 97476 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 558106 558106 0 0.0
RAM 204504 204504 0 0.0
lock CC3235SF_LAUNCHXL FLASH 591230 591230 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 971196 971196 0 0.0
RAM 125796 125796 0 0.0
BRD4338a FLASH 769284 769260 -24 -0.0
RAM 236528 236544 16 0.0
window-app BRD4187C FLASH 1074656 1074656 0 0.0
RAM 126440 126440 0 0.0
esp32 all-clusters-app c3devkit DRAM 98356 98356 0 0.0
FLASH 1596564 1596564 0 0.0
IRAM 93514 93514 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 857588 857588 0 0.0
RAM 161999 161999 0 0.0
nxp contact mcxw71+release FLASH 735808 735808 0 0.0
RAM 66936 66936 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1708508 1708508 0 0.0
RAM 213940 213940 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1607180 1607180 0 0.0
RAM 210812 210812 0 0.0
light cy8ckit_062s2_43012 FLASH 1470412 1470412 0 0.0
RAM 196988 196988 0 0.0
lock cy8ckit_062s2_43012 FLASH 1497092 1497092 0 0.0
RAM 224732 224732 0 0.0
qpg lighting-app qpg6200+debug FLASH 840636 840636 0 0.0
RAM 127780 127780 0 0.0
lock-app qpg6200+debug FLASH 779312 779312 0 0.0
RAM 118728 118728 0 0.0
realtek light-switch-app rtl8777g FLASH 720520 720520 0 0.0
RAM 113448 113448 0 0.0
lighting-app rtl8777g FLASH 767736 767736 0 0.0
RAM 114688 114688 0 0.0
stm32 light STM32WB5MM-DK FLASH 478820 478820 0 0.0
RAM 141324 141324 0 0.0
telink bridge-app tl7218x FLASH 728648 728648 0 0.0
RAM 95760 95760 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 852792 852792 0 0.0
RAM 44176 44176 0 0.0
tl7218x FLASH 844196 844196 0 0.0
RAM 99564 99564 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 725462 725462 0 0.0
RAM 55740 55740 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 788030 788030 0 0.0
RAM 74916 74916 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 725458 725458 0 0.0
RAM 33220 33220 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 616200 616200 0 0.0
RAM 118232 118232 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 842966 842970 4 0.0
RAM 97272 97272 0 0.0

@jtung-apple jtung-apple requested a review from andy31415 March 13, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants