Skip to content

Give commissionees at least ScanMaxTimeSeconds when asking for network scans. #40711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bzbarsky-apple
Copy link
Contributor

We were just doing the 30-second default instead of checking what ScanMaxTimeSeconds is.

Testing

Manual for now; we have no good way to test things with specific ScanMaxTimeSeconds values.

…k scans.

We were just doing the 30-second default instead of checking what
ScanMaxTimeSeconds is.
@Copilot Copilot AI review requested due to automatic review settings August 22, 2025 21:15
Copy link
Contributor

@Copilot 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

This PR fixes the commissioning process to properly respect the ScanMaxTimeSeconds attribute when performing network scans, instead of using a hardcoded 30-second default timeout.

  • Adds reading of the ScanMaxTimeSeconds attribute during commissioning info collection
  • Implements proper timeout handling for network scan operations based on the retrieved values
  • Fixes a typo in an error message

Reviewed Changes

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

File Description
src/controller/CommissioningDelegate.h Adds maxScanTime field to NetworkClusterInfo struct to store scan timeout values
src/controller/CHIPDeviceController.cpp Implements reading of ScanMaxTimeSeconds attribute and fixes error message typo
src/controller/AutoCommissioner.cpp Uses the retrieved scan timeout values for kScanNetworks commissioning stage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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 correctly implements the use of ScanMaxTimeSeconds from the commissionee for network scans, replacing the previous hardcoded timeout. The changes are logical and well-contained. I have one suggestion to improve maintainability by refactoring duplicated code in src/controller/CHIPDeviceController.cpp.

Copy link

github-actions bot commented Aug 22, 2025

PR #40711: Size comparison from f1631b6 to bde2d56

Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section f1631b6 bde2d56 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1105874 1105874 0 0.0
RAM 179018 179018 0 0.0
bl702 lighting-app bl702+eth FLASH 659208 659208 0 0.0
RAM 135025 135025 0 0.0
bl702+wifi FLASH 836380 836380 0 0.0
RAM 124509 124509 0 0.0
bl706+mfd+rpc+littlefs FLASH 1068388 1068388 0 0.0
RAM 117349 117349 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 897826 897826 0 0.0
RAM 105660 105660 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 981540 981540 0 0.0
RAM 109844 109844 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 768324 768324 0 0.0
RAM 103392 103392 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 779944 779944 0 0.0
RAM 108560 108560 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 725548 725548 0 0.0
RAM 96932 96932 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 710024 710024 0 0.0
RAM 97140 97140 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 552246 552246 0 0.0
RAM 205120 205120 0 0.0
lock CC3235SF_LAUNCHXL FLASH 584562 584562 0 0.0
RAM 205352 205352 0 0.0
efr32 lock-app BRD4187C FLASH 959824 959824 0 0.0
RAM 126408 126408 0 0.0
BRD4338a FLASH 755272 755264 -8 -0.0
RAM 255732 255732 0 0.0
window-app BRD4187C FLASH 1053940 1053940 0 0.0
RAM 122604 122604 0 0.0
esp32 all-clusters-app c3devkit DRAM 102536 102536 0 0.0
FLASH 1769494 1769494 0 0.0
IRAM 83862 83862 0 0.0
m5stack DRAM 121388 121388 0 0.0
FLASH 1716750 1716750 0 0.0
IRAM 117051 117051 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 912220 912220 0 0.0
RAM 152898 152898 0 0.0
nxp contact mcxw71+release FLASH 632472 632472 0 0.0
RAM 64124 64124 0 0.0
lock mcxw71+release FLASH 742264 742264 0 0.0
RAM 65200 65200 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1661588 1661588 0 0.0
RAM 211216 211216 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1582916 1582916 0 0.0
RAM 208480 208480 0 0.0
light cy8ckit_062s2_43012 FLASH 1453876 1453876 0 0.0
RAM 197200 197200 0 0.0
lock cy8ckit_062s2_43012 FLASH 1486204 1486204 0 0.0
RAM 224920 224920 0 0.0
qpg lighting-app qpg6200+debug FLASH 820984 820984 0 0.0
RAM 127644 127644 0 0.0
lock-app qpg6200+debug FLASH 758316 758316 0 0.0
RAM 118604 118604 0 0.0
realtek light-switch-app rtl8777g FLASH 704040 704040 0 0.0
RAM 106676 106676 0 0.0
lighting-app rtl8777g FLASH 755624 755624 0 0.0
RAM 127056 127056 0 0.0
stm32 light STM32WB5MM-DK FLASH 468060 468060 0 0.0
RAM 141400 141400 0 0.0
telink bridge-app tl7218x FLASH 709988 709988 0 0.0
RAM 93472 93472 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 798900 798900 0 0.0
RAM 44032 44032 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 790114 790114 0 0.0
RAM 100776 100776 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 716272 716272 0 0.0
RAM 54260 54260 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 749628 749628 0 0.0
RAM 77408 77408 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 726418 726418 0 0.0
RAM 37008 37008 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 606406 606406 0 0.0
RAM 112584 112584 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 822834 822838 4 0.0
RAM 99172 99172 0 0.0

Copy link

codecov bot commented Aug 22, 2025

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.73%. Comparing base (6e50acf) to head (bde2d56).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
src/controller/CHIPDeviceController.cpp 0.00% 19 Missing ⚠️
src/controller/AutoCommissioner.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40711      +/-   ##
==========================================
+ Coverage   50.71%   50.73%   +0.01%     
==========================================
  Files        1355     1356       +1     
  Lines       99303    99358      +55     
  Branches    12877    12873       -4     
==========================================
+ Hits        50366    50409      +43     
- Misses      48937    48949      +12     

☔ 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.

}
return return_err;
}

CHIP_ERROR DeviceCommissioner::ParseNetworkCommissioningTimeouts(NetworkClusterInfo & networkInfo, const char * networkType)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the network type string ? It's used for logging info. Is it safe to use if a non null terminated buffer is passed

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.

2 participants