Skip to content

fix(model): provisional conformance no longer implies mandatory - #4167

Open
Apollon77 wants to merge 1 commit into
mainfrom
fix/provisional-conformance-applicability
Open

fix(model): provisional conformance no longer implies mandatory#4167
Apollon77 wants to merge 1 commit into
mainfrom
fix/provisional-conformance-applicability

Conversation

@Apollon77

Copy link
Copy Markdown
Collaborator

Problem

Conformance.computeApplicability treated an otherwise list whose first term is P as mandatory-when-the-following-term-applies. GroupKeyManagement.GroupcastAdoption (P, GCAST) therefore resolved to Mandatory with the Groupcast feature enabled, so the managed state layer gave it a default [] and published it — even though no server populates it.

Per spec §7.3 (ref_ProvisionalConformance) the terms following a P describe the conformance intended once the element is no longer provisional, not the current one:

For example: "P, M" means provisional, but mandatory, when not provisional in the future.

The model layer was the outlier

Two other engines already read P, M correctly:

Engine P, M
Conformance.isMandatory false
conformance-compiler createGroup optional
computeApplicability Mandatory

So ClusterBehaviorType was auto-supplying a state default for an element the runtime validator never required and the protocol view reported as non-mandatory.

Change

Applicability caps at optional for terms following a P; the terms still contribute their condition, so P, GCAST remains absent without the feature. A mandatory term preceding the P still wins, matching the spec's [AA], P example. A standalone P is now optional rather than excluded — excluding it would drop the element from the conformant view and make ClusterBehavior.enable() throw.

The cluster-variance engine gets the same rule, so generated types declare provisional elements optional (membership?: Membership[]) instead of listing them under "always supports these elements". That is what surfaced unguarded this.state.membership reads in GroupcastServer, which now declares the elements it implements via enable().

63 elements across 11 clusters change classification. ~23 are struct/enum fields and inert — TLV optionality comes from ValueModel.mandatoryisMandatory, which already returned false. The rest are attributes, commands and events.

Consequences

  • Provisional attributes are no longer implemented by default; supply a state value.
  • Provisional events require ClusterBehavior.enable().
  • Commands are unaffected — they publish on implementation presence.

Tests

applicabilityFor had no direct coverage; this adds a describe("applicability") block. Two existing tests pinned the old semantics (ignores provisional, and the P, FOO, BAR, BAZ variance case) and are updated. A new node-level test uses ThreadNetworkDiagnostics — the one affected cluster without a provisional guard — to pin the wire-level contract: the attribute is absent from attributeList by default and present once the application supplies a value.

Clean build, format-verify, lint and the full suite pass.

Known gap, not addressed here

NameDependentElements.extractOtherwiseInterdependencies and inter-element-conformance re-walk the same otherwise list without the cap, so for conformance referencing a sibling element name the P is ignored and dependency presence forces the element present. CameraAvStreamManagement.ImageRotationDiscreteAngles takes that path today but is safe because its bracketing yields an optional fallback. An unbracketed P, <ElementName> would hit it. Tracked for the Groupcast follow-up.

🤖 Generated with Claude Code

An otherwise list whose terms follow a "P" describes the conformance
intended once the element is no longer provisional. Applicability caps
those terms at optional, matching Conformance.isMandatory and the
runtime conformance compiler, which already read "P, M" this way.

The variance engine agrees, so generated types declare provisional
elements optional rather than always present. GroupcastServer now
enables the elements it implements.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 18:43

Copilot AI 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.

Pull request overview

This PR aligns the model-layer conformance/applicability logic with Matter spec §7.3 so that provisional (P) conformance no longer implies mandatory for the terms that follow it, and propagates that change through variance inference, generated types, and node behaviors.

Changes:

  • Update Conformance.computeApplicability to cap “intended” mandatory conformance following P at Optional, while preserving feature/condition gating and keeping standalone P Optional (not excluded).
  • Apply the same “provisional caps at optional” rule in the cluster-variance inference engine, affecting generated typing of provisional elements.
  • Add/adjust tests (model + node) and update GroupcastServer to explicitly enable() the provisional elements it implements; update changelog to document the breaking behavior change.

Reviewed changes

Copilot reviewed 8 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/model/src/aspects/Conformance.ts Adjusts applicability computation for provisional (P) terms to match spec semantics.
packages/model/src/logic/cluster-variance/InferredComponents.ts Ensures inferred variance treats provisional intended conformance as optional while preserving conditions.
packages/model/test/aspects/ConformanceTest.ts Adds direct test coverage for applicability (including provisional cases).
packages/model/test/logic/ClusterVarianceTest.ts Updates/adds variance tests to reflect provisional-as-optional behavior.
packages/node/src/behaviors/groupcast/GroupcastServer.ts Uses ClusterBehavior.enable() to declare which provisional Groupcast elements are implemented.
packages/node/test/behaviors/thread-network-diagnostics/ThreadNetworkDiagnosticsProvisionalTest.ts Adds node-level contract test asserting provisional ThreadNetworkDiagnostics attrs are absent by default.
packages/node/test/behaviors/group-key-management/GroupKeyManagementServerTest.ts Adds test asserting provisional GroupcastAdoption isn’t implemented by default.
packages/types/src/clusters/thread-network-diagnostics.d.ts Regenerates/updates typings reflecting provisional optionality (note: one interface section appears inconsistent).
packages/types/src/clusters/thermostat.d.ts Marks provisional events as optional in typings.
packages/types/src/clusters/microwave-oven-control.d.ts Marks provisional elements optional in typings.
packages/types/src/clusters/groupcast.d.ts Marks provisional Groupcast elements optional in typings.
packages/types/src/clusters/group-key-management.d.ts Marks provisional groupcastAdoption optional in typings.
packages/types/src/clusters/general-commissioning.d.ts Marks provisional elements optional in typings.
packages/types/src/clusters/ambient-context-sensing.d.ts Marks provisional elements optional in typings.
packages/types/src/clusters/access-control.d.ts Marks provisional elements optional in typings.
CHANGELOG.md Documents breaking changes for model/types/node regarding provisional conformance handling.

@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants