Skip to content

TC-ICDB-2.2/2.4: fix check-in resume wait#72728

Open
raul-marquez-csa wants to merge 5 commits into
project-chip:masterfrom
raul-marquez-csa:tc-icdb-2.2-2.4-checkin-wait-fix
Open

TC-ICDB-2.2/2.4: fix check-in resume wait#72728
raul-marquez-csa wants to merge 5 commits into
project-chip:masterfrom
raul-marquez-csa:tc-icdb-2.2-2.4-checkin-wait-fix

Conversation

@raul-marquez-csa

Copy link
Copy Markdown
Contributor

Summary

Addresses:
[Test] TC-ICDB-2.4 / TC-ICDB-2.2: post-subscription-shutdown check-in wait is too short (ignores MaxInterval + MRP), flaky vs. spec-compliant DUT
#72668

TC-ICDB-2.4

Before

After a client's subscription was turned off, the test waited a fixed single cycle and read one device-wide counter, expecting it to tick up: once for the first dropped client, at least twice to conclude both were checked in. So "each client got a check-in" was inferred from a single shared number, within one cycle.

This caused spec-compliant devices to wrongly fail: the spec lets a device space out check-ins and only detect a dropped subscription after its next report fails, so a compliant device often didn't tick the shared counter enough within that one cycle.

After

Now the test confirms each client actually receives its own check-in, on its own fabric, instead of reading a shared counter. It also waits long enough to cover the time the device needs to detect the dropped subscription plus one resume cycle, rather than a fixed single cycle, so a compliant device that spaces out its check-ins still passes.

TC-ICDB-2.2

Before

After the client's subscription was turned off, the test waited a fixed single cycle and then read the counter once, expecting it to have ticked up to show a check-in had resumed.

This caused spec-compliant devices to wrongly fail: the device only detects a dropped subscription after its next report fails, then resumes check-ins a cycle later, so within that one fixed cycle the counter often had not ticked yet.

After

Now the test waits long enough to cover the time the device needs to detect the dropped subscription plus one resume cycle, then reads the counter. It waits quietly the whole time, because repeatedly reading the device would keep it awake and stop it from ever sending the check-in.

Updates performed

support_modules/icd_support.py

  • Add checkin_resume_wait_s, derives the post-shutdown wait from the DUT's mode durations.
  • Add assert_checkin_received, waits for a check-in on a given fabric.
  • Import ScopedNodeId, WaitForCheckIn.

TC_ICDB_2_4.py

  • Register both clients at commissioning so their check-ins can be observed.
  • Steps 1 - 2: read and verify the registration instead of sending the register command.
  • Steps 6 - 7: confirm each fabric's check-in directly, with the derived wait, replacing the "counter ticks up ≥2 in one cycle" check.
  • Raise default_timeout.
  • Drop now-unused imports.

TC_ICDB_2_1_2_2.py

  • Step 8: replace the fixed one-cycle wait with the derived silent wait, then read the counter once.
  • Add unregister_all_clients() cleanup at the end of 2.2.
  • Raise default_timeout.

Testing

@github-actions github-actions Bot added the tests label Jun 25, 2026

@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 refactors ICD (Intermittent Connected Device) test cases to register ICD clients during commissioning rather than explicitly sending RegisterClient commands during the test steps. It also updates the verification logic to wait for and assert actual check-in messages received from the DUT using a new helper method assert_checkin_received and a dynamically calculated timeout checkin_resume_wait_s. Feedback is provided to cast the float timeout to an integer when calling WaitForCheckIn to prevent potential type or truncation issues in the underlying bindings.

Comment thread src/python_testing/support_modules/icd_support.py
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.79%. Comparing base (f8ed35e) to head (f89223a).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #72728      +/-   ##
==========================================
- Coverage   56.86%   56.79%   -0.08%     
==========================================
  Files        1639     1642       +3     
  Lines      112757   112757              
  Branches    13123    13139      +16     
==========================================
- Hits        64119    64040      -79     
- Misses      48638    48717      +79     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

PR #72728: Size comparison from b13372f to 7c39724

Full report (30 builds for cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
platform target config section b13372f 7c39724 change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777352 777352 0 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 790096 790096 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 739368 739368 0 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719540 719540 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569646 569646 0 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 597198 597198 0 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1094924 1094924 0 0.0
RAM 135256 135256 0 0.0
lock-app BRD4187C FLASH 995152 995152 0 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799793 799793 0 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99556 99556 0 0.0
FLASH 1626112 1626112 0 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 844732 844732 0 0.0
RAM 157771 157771 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1750708 1750708 0 0.0
RAM 215492 215492 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1626532 1626532 0 0.0
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470844 1470844 0 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1504292 1504292 0 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 843140 843140 0 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 782976 782976 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 689344 689344 0 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 730288 730288 0 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478968 478968 0 0.0
RAM 141492 141492 0 0.0
telink all-devices-app tl7218x FLASH 851100 851100 0 0.0
RAM 99060 99060 0 0.0
tlsr9118bdk40d FLASH 642700 642700 0 0.0
RAM 120192 120192 0 0.0
bridge-app tl7218x FLASH 734136 734136 0 0.0
RAM 97700 97700 0 0.0
light-app-ota-compress-lzma-factory-data tl3218x FLASH 800666 800666 0 0.0
RAM 42380 42380 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl7218x FLASH 845806 845806 0 0.0
RAM 101492 101492 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 734688 734688 0 0.0
RAM 57824 57824 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 795776 795776 0 0.0
RAM 75176 75176 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 734604 734604 0 0.0
RAM 34480 34480 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 615198 615198 0 0.0
RAM 118508 118508 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 842022 842026 4 0.0
RAM 97376 97376 0 0.0

@Apollon77 Apollon77 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.

Thanks for tackling this — the direction is right and matches the issue diagnosis: assert each fabric's check-in directly, derive the wait from the DUT's own timing values, and keep the wait silent so the device can actually go idle. APIs all check out and the refactor reads cleanly.

Two things from the issue thread didn't make it into the implementation, and one of them looks like it can re-introduce the flake we were trying to remove:

  1. MaximumCheckInBackoff is missing from the wait formula (the thread converged on MaxInterval + MRP + max(FullCycle, MaximumCheckInBackoff)). This matters in 2.4 step 7 — see inline comment. The step-3 comment was also updated to say the attribute is read, but it isn't.
  2. MRP is modelled as a second FullCycle rather than a bounded retransmission value. It over-waits, so probably not flaky, but the docstring describes it as something it isn't — see inline.

Also: the gemini-code-assist suggestion to cast the timeout to int should not be applied — WaitForCheckIn(timeoutSeconds: float) feeds asyncio.wait_for(timeout=...), which takes a float; an int would truncate sub-second precision.

Details inline.

Comment thread src/python_testing/support_modules/icd_support.py Outdated
Comment thread src/python_testing/support_modules/icd_support.py Outdated
Comment thread src/python_testing/TC_ICDB_2_4.py
Comment thread src/python_testing/TC_ICDB_2_4.py
Comment thread src/python_testing/TC_ICDB_2_4.py
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

PR #72728: Size comparison from b13372f to f89223a

Increases above 0.2%:

platform target config section b13372f f89223a change % change
telink all-devices-app tl7218x FLASH 851100 881716 30616 3.6
RAM 99060 99716 656 0.7
tlsr9118bdk40d FLASH 642700 673322 30622 4.8
RAM 120192 120848 656 0.5
Full report (33 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
platform target config section b13372f f89223a change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1098908 1099176 268 0.0
RAM 133418 133418 0 0.0
bl702 lighting-app bl702+eth FLASH 1085716 1085726 10 0.0
RAM 109029 109029 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 882208 882218 10 0.0
RAM 108596 108596 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777352 777368 16 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 790096 790120 24 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 739368 739376 8 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719540 719548 8 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569646 569654 8 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 597198 597214 16 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1094924 1094924 0 0.0
RAM 135256 135256 0 0.0
lock-app BRD4187C FLASH 995152 995184 32 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799793 799809 16 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99556 99556 0 0.0
FLASH 1626112 1626146 34 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 844732 844772 40 0.0
RAM 157771 157771 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1750708 1750756 48 0.0
RAM 215492 215492 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1626532 1626548 16 0.0
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470844 1470860 16 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1504292 1504308 16 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 843140 843156 16 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 782976 782976 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 689344 689368 24 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 730288 730304 16 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478968 478976 8 0.0
RAM 141492 141492 0 0.0
telink all-devices-app tl7218x FLASH 851100 881716 30616 3.6
RAM 99060 99716 656 0.7
tlsr9118bdk40d FLASH 642700 673322 30622 4.8
RAM 120192 120848 656 0.5
bridge-app tl7218x FLASH 734136 734156 20 0.0
RAM 97700 97700 0 0.0
light-app-ota-compress-lzma-factory-data tl3218x FLASH 800666 800682 16 0.0
RAM 42380 42380 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl7218x FLASH 845806 845822 16 0.0
RAM 101492 101492 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 734688 734714 26 0.0
RAM 57824 57824 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 795776 795802 26 0.0
RAM 75176 75176 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 734604 734630 26 0.0
RAM 34480 34480 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 615198 615214 16 0.0
RAM 118508 118508 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 842022 842042 20 0.0
RAM 97376 97376 0 0.0

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