Skip to content

[Feature] TH to support thread commissioning #295

Merged
rquidute merged 10 commits intov2.15-developfrom
feature/865_add_support_thread_commissioning
Feb 5, 2026
Merged

[Feature] TH to support thread commissioning #295
rquidute merged 10 commits intov2.15-developfrom
feature/865_add_support_thread_commissioning

Conversation

@rquidute
Copy link
Contributor

@rquidute rquidute commented Feb 5, 2026

What changed

Added support for Thread commissioning with Border Agent (BA) parameters in the Matter Test Harness. This new THREAD pairing mode enables device commissioning using the chip-tool pairing code-thread command with Thread operational dataset and Border Agent host/port configuration.

Core Implementation

  1. New Pairing Mode
  • Added THREAD = "thread" to DutPairingModeEnum in app/constants/shared_constants.py
  • Maps to code-thread command for chip-tool execution
  1. Configuration Schema Updates
  • Added optional ba_host and ba_port fields to ThreadAutoConfig (app/schemas/test_environment_config.py)
  • Added optional ba_host and ba_port fields to ThreadExternalConfig (test_collections/matter/test_environment_config.py)
  • Added validation requiring both ba_host and ba_port when pairing_mode is THREAD
  • Updated default project configuration with example BA parameters
  1. YAML Test Runner Support
  • Implemented pairing_thread() method in MatterYAMLRunner (matter_yaml_runner.py)
  • Constructs chip-tool command: pairing code-thread <node_id> hex: --thread-ba-host --thread-ba-port
  • Supports optional BA parameters (can be omitted if not provided)
  1. ChipSuite Integration
  • Added __pair_with_dut_thread() method in ChipSuite (chip_suite.py)
  • Handles both ThreadExternalConfig (uses provided dataset) and ThreadAutoConfig (retrieves dataset from border router)
  • Generates manual pairing code from discriminator and setup code
  • Integrates with existing commissioning flow
  1. Python Test Harness Support
  • Updated generate_command_arguments() in Python testing utils to handle THREAD mode
  • Adds --thread-ba-host and --thread-ba-port arguments for Python tests
  • Updated PythonTestSuite and CommissioningPythonTestSuite to include THREAD mode in PCSC and OTBR setup logic

Related Issue

project-chip/certification-tool#865

Testing

Added 22 new unit tests. All unit tests are passing.
Screenshot 2026-02-05 at 10 02 58

Development Testing
⚠️ Python Test Harness Support: From SDK perspective, the Thread commissioning is not fully implemented. This PR (project-chip/connectedhomeip#41777) is still in draft
Attempting to run Python tests with pairing_mode: "thread" will result in:

test_harness_client.py: error: argument -m/--commissioning-method: invalid choice: 'thread' (choose from 'on-network', 'ble-wifi', 'ble-thread', 'nfc-thread')

@rquidute rquidute self-assigned this Feb 5, 2026
@rquidute rquidute changed the title Initial code for thread support [Feature] TH to support thread commissioning Feb 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rquidute, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Matter Test Harness by introducing a dedicated 'THREAD' pairing mode. This new mode facilitates device commissioning using Thread operational datasets and Border Agent parameters, streamlining the testing process for Thread-enabled Matter devices. The changes involve updates to core constants, configuration schemas, test runners, and test suites, ensuring comprehensive support and validation for this advanced commissioning method.

Highlights

  • New THREAD Pairing Mode: Introduced a new 'THREAD' pairing mode to the Matter Test Harness, enabling device commissioning via the 'chip-tool pairing code-thread' command with Thread operational datasets and Border Agent (BA) parameters.
  • Configuration Schema Updates: Extended configuration schemas ('ThreadAutoConfig' and 'ThreadExternalConfig') to include optional 'ba_host' and 'ba_port' fields, with new validation logic ensuring these parameters are provided when 'THREAD' pairing mode is selected.
  • Test Harness Integration: Integrated the new 'THREAD' pairing mode across the test harness, including the YAML Test Runner ('pairing_thread' method) and 'ChipSuite' ('__pair_with_dut_thread' method), to correctly construct and execute 'chip-tool' commands with BA parameters.
  • Python Test Support: Updated Python Test Harness utilities and test suites to recognize and properly handle the new 'THREAD' commissioning method and its associated command-line arguments, including logic for PCSC and OTBR setup.
  • Comprehensive Unit Testing: Added 22 new unit tests to thoroughly validate the functionality, configuration requirements, and various scenarios of the new 'THREAD' pairing mode, ensuring robustness and correctness.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/constants/shared_constants.py
    • Added 'THREAD = "thread"' to 'DutPairingModeEnum' to introduce the new pairing mode.
    • Updated copyright year to 2026.
  • app/schemas/test_environment_config.py
    • Added 'ba_host' and 'ba_port' as optional fields to 'ThreadAutoConfig'.
    • Updated copyright year to 2026.
  • test_collections/matter/default_project.config
    • Included example 'ba_host' and 'ba_port' parameters in the default Thread configuration.
  • test_collections/matter/sdk_tests/support/python_testing/models/test_suite.py
    • Extended PCSC and OTBR setup logic to support the new 'THREAD' pairing mode.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/python_testing/models/utils.py
    • Modified 'generate_command_arguments' to correctly pass '--thread-ba-host' and '--thread-ba-port' when 'THREAD' pairing mode is active.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/tests/matter/test_test_environment_config.py
    • Introduced new unit tests to validate the presence of 'ba_host' and 'ba_port' when 'THREAD' pairing mode is specified, and to ensure proper handling of valid and invalid Thread configurations.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/tests/utils/utils.py
    • Added new default configuration dictionaries ('default_config_thread_valid', 'default_config_thread_no_ba_host', 'default_config_thread_no_ba_port') for testing 'THREAD' pairing mode.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/tests/yaml_tests/test_chip_suite.py
    • Added comprehensive unit tests for the '__pair_with_dut_thread' method, covering scenarios with external and auto Thread configurations, as well as error handling for missing or invalid configurations.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/tests/yaml_tests/test_matter_yaml_runner.py
    • Added new unit tests for the 'pairing_thread' method, verifying correct command construction with and without Border Agent parameters, and handling of various response scenarios.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/yaml_tests/matter_yaml_runner.py
    • Defined 'PAIRING_MODE_THREAD = "code-thread"'.
    • Implemented the 'pairing_thread' asynchronous method to execute the 'chip-tool pairing code-thread' command, incorporating optional 'ba_host' and 'ba_port' arguments.
    • Updated copyright year to 2026.
  • test_collections/matter/sdk_tests/support/yaml_tests/models/chip_suite.py
    • Integrated the new 'THREAD' pairing mode into the main '__pair_with_dut' dispatch logic.
    • Implemented the '__pair_with_dut_thread' asynchronous method to manage the Thread commissioning flow, including dataset retrieval and manual pairing code generation, before invoking the 'pairing_thread' runner method.
    • Updated copyright year to 2026.
  • test_collections/matter/test_environment_config.py
    • Added 'ba_host' and 'ba_port' as optional fields to 'ThreadExternalConfig'.
    • Implemented validation logic in 'validate_model' to enforce that 'ba_host' and 'ba_port' are mandatory when 'pairing_mode' is set to 'THREAD'.
    • Updated copyright year to 2026.
Activity
  • The author added 22 new unit tests to cover the new Thread commissioning functionality.
  • All newly added unit tests are reported as passing.
  • A known limitation has been identified: the Python Test Harness client ('test_harness_client.py') currently does not support the 'thread' commissioning method, leading to an 'invalid choice' error if attempted.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 adds support for a new THREAD pairing mode for Thread commissioning with Border Agent parameters. The changes are comprehensive, touching configuration, test harness logic, and adding extensive unit tests. The implementation is largely solid, but I've identified a critical bug in how command responses are processed and several opportunities for code simplification and improving readability. My review includes suggestions to fix the bug and refactor parts of the code for better maintainability.

rquidute and others added 4 commits February 5, 2026 10:12
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@rquidute rquidute merged commit 0211885 into v2.15-develop Feb 5, 2026
7 of 8 checks passed
@rquidute rquidute deleted the feature/865_add_support_thread_commissioning branch February 5, 2026 16:37
@rquidute rquidute restored the feature/865_add_support_thread_commissioning branch February 5, 2026 16:45
@rquidute rquidute deleted the feature/865_add_support_thread_commissioning branch February 5, 2026 16:49
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.

4 participants

Comments