Skip to content

fix(tests): commissioning + mdns helper compile against current API#455

Closed
glennswest wants to merge 2 commits into
project-chip:mainfrom
glennswest:fix/commissioning-test-api-drift
Closed

fix(tests): commissioning + mdns helper compile against current API#455
glennswest wants to merge 2 commits into
project-chip:mainfrom
glennswest:fix/commissioning-test-api-drift

Conversation

@glennswest
Copy link
Copy Markdown

Summary

The commissioning integration test currently fails to build on main when the astro-dnssd feature is selected — three compile errors from API drift between the test helpers and the library.

Repro (verified on main):

cargo test -p rs-matter --test commissioning \
  --no-default-features \
  --features 'std,rustcrypto,log,astro-dnssd' --no-run
error[E0061]: this method takes 1 argument but 0 were supplied
  (AstroMdnsResponder::run)
error[E0308]: mismatched types
  expected `u16`, found `&CommissionableFilter`

Fix

  1. rs-matter/tests/common/mdns.rsAstroMdnsResponder moved from ::new(matter).run() to ::new().run(matter). The test helper still used the old shape.
  2. rs-matter/tests/commissioning.rs — the discover_device helper kept a u16 discriminator parameter for the astro-dnssd build while the caller now passes &CommissionableFilter (matching the zbus/zeroconf build). Also: the astro-dnssd branch was internally re-constructing a filter from only the discriminator, silently dropping any other filter fields the caller specified.

Unified discover_device(filter: &CommissionableFilter, timeout_ms: u32) across both feature variants — caller now passes the full filter through to astro::discover_commissionable.

Test plan

  • cargo test -p rs-matter --test commissioning --no-default-features --features 'std,rustcrypto,log,astro-dnssd' --no-run — builds clean after the patch (failed cleanly on main before).

Copy link
Copy Markdown
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 refactors device discovery by replacing the single discriminator parameter with a comprehensive CommissionableFilter in the discover_device function, allowing for more flexible search criteria. It also updates the AstroMdnsResponder API usage in the test suite. Feedback suggests enhancing the diagnostic warning message in discover_device to log the entire filter object instead of only the discriminator field, which provides better context when discovery fails.

Comment thread rs-matter/tests/commissioning.rs Outdated

devices.into_iter().next().ok_or_else(|| {
warn!("No devices found matching discriminator {discriminator}");
warn!("No devices found matching discriminator {:?}", filter.discriminator);
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.

medium

Since the discover_device function now accepts a full CommissionableFilter and passes it to the discovery process, the warning message should reflect the entire filter criteria rather than just the discriminator. This provides better diagnostic information if discovery fails due to other filter fields (like Vendor ID or Product ID) that might have been specified by the caller.

Suggested change
warn!("No devices found matching discriminator {:?}", filter.discriminator);
warn!("No devices found matching filter {:?}", filter);

@github-actions
Copy link
Copy Markdown

PR #455: Size comparison from da2d79e to 75db789

Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
platform target config section da2d79e 75db789 change % change
(core) riscv32imac-unknown-none-elf infodefmt-optz-ltofat FLASH 436352 436352 0 0.0
RAM 70944 70944 0 0.0
thumbv6m-none-eabi infodefmt-optz-ltofat FLASH 354420 354420 0 0.0
RAM 66660 66660 0 0.0
thumbv7em-none-eabi infodefmt-optz-ltofat FLASH 332688 332688 0 0.0
RAM 66428 66428 0 0.0
x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 859667 859667 0 0.0
RAM 71258 71258 0 0.0
dimmable-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1987104 1987104 0 0.0
RAM 60616 60616 0 0.0
onoff-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1913920 1913920 0 0.0
RAM 59776 59776 0 0.0
onoff-light-bt x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 3355296 3355296 0 0.0
RAM 5776 5776 0 0.0
speaker x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1950360 1950360 0 0.0
RAM 5472 5472 0 0.0

The 'commissioning' integration test fails to build on main with three
errors when the astro-dnssd feature is selected:

  1. rs-matter/tests/common/mdns.rs: AstroMdnsResponder constructor
     changed from new(matter) -> new() with matter passed to run(matter).
     The test helper still calls the old shape.

  2. rs-matter/tests/commissioning.rs: the test's local discover_device
     helper still takes a u16 discriminator, but its caller now passes
     a &CommissionableFilter (matching the zbus/zeroconf variant). The
     astro-dnssd variant also internally constructs a filter from just
     the discriminator, dropping any other filter fields the caller
     specified.

Repro on main (verified):

    cargo test -p rs-matter --test commissioning \
      --no-default-features \
      --features 'std,rustcrypto,log,astro-dnssd' --no-run

    error[E0308]: mismatched types ... expected u16, found &CommissionableFilter
    error[E0061]: this method takes 1 argument but 0 were supplied (AstroMdnsResponder::run)

Fix
---
- mdns.rs: use the current AstroMdnsResponder::new().run(matter) shape.
- commissioning.rs: unify discover_device(...) across feature variants
  to take &CommissionableFilter directly, so the caller's full filter
  passes through and both branches have the same signature.

After this patch the test builds clean under astro-dnssd.
@glennswest glennswest force-pushed the fix/commissioning-test-api-drift branch from 75db789 to f7df677 Compare May 18, 2026 15:28
@github-actions
Copy link
Copy Markdown

PR #455: Size comparison from da2d79e to f7df677

Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
platform target config section da2d79e f7df677 change % change
(core) riscv32imac-unknown-none-elf infodefmt-optz-ltofat FLASH 436352 436352 0 0.0
RAM 70944 70944 0 0.0
thumbv6m-none-eabi infodefmt-optz-ltofat FLASH 354420 354420 0 0.0
RAM 66660 66660 0 0.0
thumbv7em-none-eabi infodefmt-optz-ltofat FLASH 332688 332688 0 0.0
RAM 66428 66428 0 0.0
x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 859667 859667 0 0.0
RAM 71258 71258 0 0.0
dimmable-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1987104 1987104 0 0.0
RAM 60616 60616 0 0.0
onoff-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1913920 1913920 0 0.0
RAM 59776 59776 0 0.0
onoff-light-bt x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 3355296 3355296 0 0.0
RAM 5776 5776 0 0.0
speaker x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1950360 1950360 0 0.0
RAM 5472 5472 0 0.0

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 18, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

PR #455: Size comparison from da2d79e to 86dc302

Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
platform target config section da2d79e 86dc302 change % change
(core) riscv32imac-unknown-none-elf infodefmt-optz-ltofat FLASH 436352 436352 0 0.0
RAM 70944 70944 0 0.0
thumbv6m-none-eabi infodefmt-optz-ltofat FLASH 354420 354420 0 0.0
RAM 66660 66660 0 0.0
thumbv7em-none-eabi infodefmt-optz-ltofat FLASH 332688 332688 0 0.0
RAM 66428 66428 0 0.0
x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 859667 859667 0 0.0
RAM 71258 71258 0 0.0
dimmable-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1987104 1987104 0 0.0
RAM 60616 60616 0 0.0
onoff-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1913920 1913920 0 0.0
RAM 59776 59776 0 0.0
onoff-light-bt x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 3355296 3355296 0 0.0
RAM 5776 5776 0 0.0
speaker x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1950360 1950360 0 0.0
RAM 5472 5472 0 0.0

@ivmarkov
Copy link
Copy Markdown
Contributor

Same here - please assess the code review feedback from Gemini, then I'll review.

@ivmarkov
Copy link
Copy Markdown
Contributor

No reply from author, closing.

@ivmarkov ivmarkov closed this May 26, 2026
glennswest added a commit to glennswest/rs-matter that referenced this pull request May 29, 2026
Addresses Gemini review (project-chip#455): the no-devices-found warning printed only
filter.discriminator; now logs the entire CommissionableFilter so vendor/
product/other criteria are visible when discovery fails.
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.

3 participants