Skip to content

level_control: bump TestLevelControlDeviceLogic cluster revision to 6#453

Merged
ivmarkov merged 1 commit into
project-chip:mainfrom
snabb:fix-test-level-control-revision
May 18, 2026
Merged

level_control: bump TestLevelControlDeviceLogic cluster revision to 6#453
ivmarkov merged 1 commit into
project-chip:mainfrom
snabb:fix-test-level-control-revision

Conversation

@snabb
Copy link
Copy Markdown
Contributor

@snabb snabb commented May 17, 2026

Summary

LevelControlHandler::validate() panics unless H::CLUSTER.revision == 6, and the Matter 1.5.1 IDL declares LevelControl at revision 6. The in-tree TestLevelControlDeviceLogic still declared revision 5, so any caller that exercises init() panics at startup with:

LevelControl validation: incorrect version number: expected 6 got 5

examples/src/bin/speaker.rs L99–115 hits this — it constructs the handler with new(...) + .init(...). The sibling TestOnOffDeviceLogic already tracks revision 6, so this just brings LevelControl in line.

Changes

  • rs-matter/src/dm/clusters/app/level_control.rs:1778with_revision(5)with_revision(6).
  • Same file — adds a regression test that constructs the LevelControl + OnOff handler pair the same way speaker.rs does, so future drift between TestLevelControlDeviceLogic::CLUSTER and what LevelControlHandler::validate() requires is caught at CI time rather than at first runtime use.

References

  • rs-matter/src/dm/clusters/app/level_control.rs L290–296 — validator (if H::CLUSTER.revision != 6 { panic!(...) }).
  • rs-matter-codegen/src/idl/parser/controller-clusters-V1.5.1.0.matter L557–558 — IDL says revision 6.

Test plan

  • cargo test --package rs-matter --lib dm::clusters::app::level_control::tests:: — passes.
  • Reverted the revision to 5 to confirm the new test fails with the original panic; restored.

`LevelControlHandler::validate()` panics unless `H::CLUSTER.revision`
is 6, and the Matter 1.5.1 IDL declares LevelControl at revision 6.
The in-tree `TestLevelControlDeviceLogic` still declared revision 5,
so any caller (including `examples/src/bin/speaker.rs`) that exercised
`init()` panicked at startup with "incorrect version number: expected
6 got 5". The sibling `TestOnOffDeviceLogic` already tracks revision
6; this brings LevelControl in line.

Also adds a small regression test that constructs the
LevelControl + OnOff handler pair the same way `speaker.rs` does, so
future drift between `TestLevelControlDeviceLogic::CLUSTER` and what
`LevelControlHandler::validate()` requires is caught at CI time
rather than at first runtime use.
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 updates the LevelControl cluster revision from 5 to 6 in the test module and adds a new test case, test_logic_passes_handler_validate, to ensure consistency between the device logic and the handler during initialization. I have no feedback to provide.

@github-actions
Copy link
Copy Markdown

PR #453: Size comparison from 7d96427 to 85318f1

Increases above 0.2%:

platform target config section 7d96427 85318f1 change % change
speaker x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 847336 1950360 1103024 130.2
RAM 2856 5472 2616 91.6
Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
platform target config section 7d96427 85318f1 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 847336 1950360 1103024 130.2
RAM 2856 5472 2616 91.6

@ivmarkov ivmarkov merged commit da2d79e into project-chip:main May 18, 2026
17 of 23 checks passed
@snabb snabb deleted the fix-test-level-control-revision branch May 18, 2026 07:30
snabb added a commit to snabb/rs-matter that referenced this pull request May 23, 2026
Matter 1.5.1 §1.6 lists the LevelControl cluster at revision 7.
Upstream project-chip#453 bumped the local `validate()` check and the
`TestLevelControlDeviceLogic` reference impl from 5 to 6, but the
spec value is one higher. Bring both to 7 so device-side `validate()`
accepts spec-conformant cluster definitions.
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.

2 participants