@matter/testing 0.18.0 → 0.18.1-alpha.0-20261111-b84c5d1bc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chip/app-reference.d.ts +41 -0
- package/dist/cjs/chip/app-reference.d.ts.map +1 -0
- package/dist/cjs/chip/app-reference.js +83 -0
- package/dist/cjs/chip/app-reference.js.map +6 -0
- package/dist/cjs/chip/cert/cert-context.d.ts +4 -2
- package/dist/cjs/chip/cert/cert-context.d.ts.map +1 -1
- package/dist/cjs/chip/cert/cert-context.js.map +1 -1
- package/dist/cjs/chip/cert/cert-dsl.d.ts +7 -1
- package/dist/cjs/chip/cert/cert-dsl.d.ts.map +1 -1
- package/dist/cjs/chip/cert/cert-dsl.js +4 -1
- package/dist/cjs/chip/cert/cert-dsl.js.map +1 -1
- package/dist/cjs/chip/cert/cert-test.d.ts.map +1 -1
- package/dist/cjs/chip/cert/cert-test.js +5 -18
- package/dist/cjs/chip/cert/cert-test.js.map +1 -1
- package/dist/cjs/chip/cert/chip-app-subject.d.ts.map +1 -1
- package/dist/cjs/chip/cert/chip-app-subject.js +23 -7
- package/dist/cjs/chip/cert/chip-app-subject.js.map +1 -1
- package/dist/cjs/chip/cert/controller-adapter.d.ts +89 -18
- package/dist/cjs/chip/cert/controller-adapter.d.ts.map +1 -1
- package/dist/cjs/chip/cert/controller-adapter.js +1 -3
- package/dist/cjs/chip/cert/controller-adapter.js.map +1 -1
- package/dist/cjs/chip/cert/evidence.d.ts +3 -3
- package/dist/cjs/chip/cert/evidence.js +1 -1
- package/dist/cjs/chip/cert/log-follower.d.ts +10 -0
- package/dist/cjs/chip/cert/log-follower.d.ts.map +1 -1
- package/dist/cjs/chip/cert/log-follower.js +48 -21
- package/dist/cjs/chip/cert/log-follower.js.map +1 -1
- package/dist/cjs/chip/cert/prompt-driven-python-test.js +1 -1
- package/dist/cjs/chip/cert/prompt-driven-python-test.js.map +1 -1
- package/dist/cjs/chip/cert/step-actions.d.ts +2 -3
- package/dist/cjs/chip/cert/step-actions.d.ts.map +1 -1
- package/dist/cjs/chip/cert/step-actions.js +3 -27
- package/dist/cjs/chip/cert/step-actions.js.map +1 -1
- package/dist/cjs/chip/index.d.ts +2 -1
- package/dist/cjs/chip/index.d.ts.map +1 -1
- package/dist/cjs/chip/index.js +2 -0
- package/dist/cjs/chip/index.js.map +1 -1
- package/dist/cjs/chip/python-test.d.ts +5 -0
- package/dist/cjs/chip/python-test.d.ts.map +1 -1
- package/dist/cjs/chip/python-test.js +12 -1
- package/dist/cjs/chip/python-test.js.map +1 -1
- package/dist/cjs/chip/state.d.ts.map +1 -1
- package/dist/cjs/chip/state.js +4 -1
- package/dist/cjs/chip/state.js.map +1 -1
- package/dist/cjs/device/backchannel.d.ts +10 -1
- package/dist/cjs/device/backchannel.d.ts.map +1 -1
- package/dist/cjs/test-descriptor.d.ts +4 -1
- package/dist/cjs/test-descriptor.d.ts.map +1 -1
- package/dist/cjs/test-descriptor.js.map +1 -1
- package/dist/cjs/util/async.d.ts +1 -0
- package/dist/cjs/util/async.d.ts.map +1 -1
- package/dist/cjs/util/async.js +1 -0
- package/dist/cjs/util/async.js.map +1 -1
- package/dist/esm/chip/app-reference.d.ts +41 -0
- package/dist/esm/chip/app-reference.d.ts.map +1 -0
- package/dist/esm/chip/app-reference.js +63 -0
- package/dist/esm/chip/app-reference.js.map +6 -0
- package/dist/esm/chip/cert/cert-context.d.ts +4 -2
- package/dist/esm/chip/cert/cert-context.d.ts.map +1 -1
- package/dist/esm/chip/cert/cert-context.js.map +1 -1
- package/dist/esm/chip/cert/cert-dsl.d.ts +7 -1
- package/dist/esm/chip/cert/cert-dsl.d.ts.map +1 -1
- package/dist/esm/chip/cert/cert-dsl.js +4 -1
- package/dist/esm/chip/cert/cert-dsl.js.map +1 -1
- package/dist/esm/chip/cert/cert-test.d.ts.map +1 -1
- package/dist/esm/chip/cert/cert-test.js +5 -18
- package/dist/esm/chip/cert/cert-test.js.map +1 -1
- package/dist/esm/chip/cert/chip-app-subject.d.ts.map +1 -1
- package/dist/esm/chip/cert/chip-app-subject.js +23 -7
- package/dist/esm/chip/cert/chip-app-subject.js.map +1 -1
- package/dist/esm/chip/cert/controller-adapter.d.ts +89 -18
- package/dist/esm/chip/cert/controller-adapter.d.ts.map +1 -1
- package/dist/esm/chip/cert/controller-adapter.js +1 -3
- package/dist/esm/chip/cert/controller-adapter.js.map +1 -1
- package/dist/esm/chip/cert/evidence.d.ts +3 -3
- package/dist/esm/chip/cert/evidence.js +1 -1
- package/dist/esm/chip/cert/log-follower.d.ts +10 -0
- package/dist/esm/chip/cert/log-follower.d.ts.map +1 -1
- package/dist/esm/chip/cert/log-follower.js +49 -22
- package/dist/esm/chip/cert/log-follower.js.map +1 -1
- package/dist/esm/chip/cert/prompt-driven-python-test.js +1 -1
- package/dist/esm/chip/cert/prompt-driven-python-test.js.map +1 -1
- package/dist/esm/chip/cert/step-actions.d.ts +2 -3
- package/dist/esm/chip/cert/step-actions.d.ts.map +1 -1
- package/dist/esm/chip/cert/step-actions.js +3 -29
- package/dist/esm/chip/cert/step-actions.js.map +1 -1
- package/dist/esm/chip/index.d.ts +2 -1
- package/dist/esm/chip/index.d.ts.map +1 -1
- package/dist/esm/chip/index.js +2 -0
- package/dist/esm/chip/index.js.map +1 -1
- package/dist/esm/chip/python-test.d.ts +5 -0
- package/dist/esm/chip/python-test.d.ts.map +1 -1
- package/dist/esm/chip/python-test.js +12 -1
- package/dist/esm/chip/python-test.js.map +1 -1
- package/dist/esm/chip/state.d.ts.map +1 -1
- package/dist/esm/chip/state.js +4 -1
- package/dist/esm/chip/state.js.map +1 -1
- package/dist/esm/device/backchannel.d.ts +10 -1
- package/dist/esm/device/backchannel.d.ts.map +1 -1
- package/dist/esm/test-descriptor.d.ts +4 -1
- package/dist/esm/test-descriptor.d.ts.map +1 -1
- package/dist/esm/test-descriptor.js.map +1 -1
- package/dist/esm/util/async.d.ts +1 -0
- package/dist/esm/util/async.d.ts.map +1 -1
- package/dist/esm/util/async.js +1 -0
- package/dist/esm/util/async.js.map +1 -1
- package/package.json +5 -5
- package/src/chip/app-reference.ts +91 -0
- package/src/chip/cert/cert-context.ts +4 -2
- package/src/chip/cert/cert-dsl.ts +16 -4
- package/src/chip/cert/cert-test.ts +7 -33
- package/src/chip/cert/chip-app-subject.ts +35 -10
- package/src/chip/cert/controller-adapter.ts +104 -22
- package/src/chip/cert/evidence.ts +3 -3
- package/src/chip/cert/log-follower.ts +58 -23
- package/src/chip/cert/prompt-driven-python-test.ts +1 -1
- package/src/chip/cert/step-actions.ts +5 -32
- package/src/chip/index.ts +3 -0
- package/src/chip/python-test.ts +18 -1
- package/src/chip/state.ts +6 -2
- package/src/device/backchannel.ts +11 -0
- package/src/test-descriptor.ts +4 -1
- package/src/util/async.ts +1 -1
- package/test/chip/AppReferenceTest.ts +113 -0
|
@@ -156,8 +156,8 @@ export interface StepRecorder {
|
|
|
156
156
|
*/
|
|
157
157
|
runHeaderLines?(): string[];
|
|
158
158
|
/**
|
|
159
|
-
* Records how many steps were skipped because the controller under test
|
|
160
|
-
*
|
|
159
|
+
* Records how many steps were skipped because the controller under test lacks a capability they
|
|
160
|
+
* declare. A run with such a step proved less than its plan, so it settles as
|
|
161
161
|
* `"controller-gap"` rather than `"pass"` (see `EvidenceRecorder`), and the count says how much less.
|
|
162
162
|
*/
|
|
163
163
|
recordControllerUnsupportedSkips?(count: number): void;
|
|
@@ -346,6 +346,8 @@ export interface CertTestDefinition {
|
|
|
346
346
|
* here; every other test keeps the transport its evidence and timing were written against.
|
|
347
347
|
*/
|
|
348
348
|
transport?: ControllerTransport;
|
|
349
|
+
/** Whether the test's controllers judge device attestation (see `cert-dsl.ts`'s `CertTestOptions`). */
|
|
350
|
+
attestation?: boolean;
|
|
349
351
|
/** Role name → controller kind (see `cert-dsl.ts`'s `CertTestOptions`). */
|
|
350
352
|
controllers: Readonly<Record<string, ControllerRoleKind>>;
|
|
351
353
|
/** What every step of this test needs of its controllers (see `cert-dsl.ts`'s `CertTestOptions`). */
|
|
@@ -136,6 +136,13 @@ export interface CertTestOptions {
|
|
|
136
136
|
*/
|
|
137
137
|
transport?: ControllerTransport;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Has the test's controllers judge device attestation against the chip test roots
|
|
141
|
+
* (`ControllerAdapterOptions.attestation`), for a case about which attestations a commissioner accepts or refuses.
|
|
142
|
+
* Implies the `attestation` capability, so a case with a controller that cannot judge attestation is skipped.
|
|
143
|
+
*/
|
|
144
|
+
attestation?: boolean;
|
|
145
|
+
|
|
139
146
|
/**
|
|
140
147
|
* What the whole test needs of its controllers beyond the {@link ControllerAdapter} interface. Where a
|
|
141
148
|
* controller filling one of its roles lacks one, the test is skipped before any device starts. Declare it here
|
|
@@ -343,6 +350,7 @@ export function certTest(tc: string, options: CertTestOptions): CertTestBuilder
|
|
|
343
350
|
flavors: options.flavors,
|
|
344
351
|
chipBinsSources: options.chipBinsSources,
|
|
345
352
|
transport: options.transport,
|
|
353
|
+
attestation: options.attestation,
|
|
346
354
|
controllers: controllerRoles,
|
|
347
355
|
controllerCapabilities: options.controllerCapabilities,
|
|
348
356
|
controllerGroups: options.controllerGroups,
|
|
@@ -646,14 +654,17 @@ export function unmetTestPics(definition: CertTestDefinition, pics = certPicsFil
|
|
|
646
654
|
* one can: the capabilities it declares, and those its adapter options imply.
|
|
647
655
|
*/
|
|
648
656
|
export function unmetControllerCapabilities(
|
|
649
|
-
definition: Pick<CertTestDefinition, "controllers" | "controllerCapabilities" | "transport">,
|
|
657
|
+
definition: Pick<CertTestDefinition, "controllers" | "controllerCapabilities" | "transport" | "attestation">,
|
|
650
658
|
selection: ControllerSelection = resolveControllerSelection(),
|
|
651
659
|
): string | undefined {
|
|
652
660
|
return controllerCapabilityGap(requiredCapabilities(definition), Object.values(definition.controllers), selection);
|
|
653
661
|
}
|
|
654
662
|
|
|
655
|
-
function requiredCapabilities(
|
|
656
|
-
|
|
663
|
+
function requiredCapabilities(
|
|
664
|
+
definition: Pick<CertTestDefinition, "controllerCapabilities" | "transport" | "attestation">,
|
|
665
|
+
) {
|
|
666
|
+
const { transport, attestation } = definition;
|
|
667
|
+
return [...(definition.controllerCapabilities ?? []), ...capabilitiesFor({ transport, attestation })];
|
|
657
668
|
}
|
|
658
669
|
|
|
659
670
|
/**
|
|
@@ -675,7 +686,7 @@ function controllerNotApplicable(
|
|
|
675
686
|
* (see {@link controllerCapabilityOutOfScope}).
|
|
676
687
|
*/
|
|
677
688
|
function outOfControllerScope(
|
|
678
|
-
definition: Pick<CertTestDefinition, "controllers" | "controllerCapabilities" | "transport">,
|
|
689
|
+
definition: Pick<CertTestDefinition, "controllers" | "controllerCapabilities" | "transport" | "attestation">,
|
|
679
690
|
selection: ControllerSelection,
|
|
680
691
|
): string | undefined {
|
|
681
692
|
return controllerCapabilityOutOfScope(
|
|
@@ -1034,6 +1045,7 @@ class WiredCertTest extends CertTest {
|
|
|
1034
1045
|
name,
|
|
1035
1046
|
{
|
|
1036
1047
|
transport: this.definition.transport,
|
|
1048
|
+
attestation: this.definition.attestation,
|
|
1037
1049
|
groups: kind === "dut" ? this.#controllerGroups() : undefined,
|
|
1038
1050
|
},
|
|
1039
1051
|
kind,
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
} from "./cert-context.js";
|
|
29
29
|
import {
|
|
30
30
|
capabilitiesFor,
|
|
31
|
-
type ControllerCapability,
|
|
32
31
|
controllerCapabilityGap,
|
|
33
32
|
controllerCapabilityOutOfScope,
|
|
34
33
|
type ControllerSelection,
|
|
@@ -101,8 +100,8 @@ export class CertTest extends BaseTest {
|
|
|
101
100
|
const { devices } = cx;
|
|
102
101
|
|
|
103
102
|
// A step's own checks are how the suite defines "something was observed", and a step that ran
|
|
104
|
-
// without recording one ends unverified.
|
|
105
|
-
//
|
|
103
|
+
// without recording one ends unverified. Together with the actions below, the count also decides
|
|
104
|
+
// whether a step may still skip itself (CertStepNotApplicableError, the notApplicableAtRun probe).
|
|
106
105
|
let observedThisStep = 0;
|
|
107
106
|
// Checks alone miss a step that changed the device before it recorded anything
|
|
108
107
|
const actions = new StepActions();
|
|
@@ -358,7 +357,7 @@ export class CertTest extends BaseTest {
|
|
|
358
357
|
await raceAgainstDeviceExit(stepDef.run(cx), deviceExitWatch.exit, tc, stepDef.number);
|
|
359
358
|
} catch (e) {
|
|
360
359
|
if (e instanceof CertStepNotApplicableError) {
|
|
361
|
-
//
|
|
360
|
+
// "skipped" claims nothing was evaluated, which a step that recorded evidence or acted cannot
|
|
362
361
|
if (observedThisStep === 0 && actions.count === 0) {
|
|
363
362
|
planConditionSkips++;
|
|
364
363
|
report(stepDef, "skipped", e.message);
|
|
@@ -377,40 +376,15 @@ export class CertTest extends BaseTest {
|
|
|
377
376
|
continue;
|
|
378
377
|
}
|
|
379
378
|
|
|
380
|
-
if (e instanceof UnsupportedByControllerError
|
|
379
|
+
if (e instanceof UnsupportedByControllerError) {
|
|
381
380
|
aborted = true;
|
|
382
381
|
failed = true;
|
|
383
382
|
frameworkError = true;
|
|
384
|
-
failure = undeclaredRefusal(tc, stepDef, this.#definition, e
|
|
383
|
+
failure = undeclaredRefusal(tc, stepDef, this.#definition, e);
|
|
385
384
|
report(stepDef, "error");
|
|
386
385
|
continue;
|
|
387
386
|
}
|
|
388
387
|
|
|
389
|
-
if (e instanceof UnsupportedByControllerError) {
|
|
390
|
-
// "skipped" claims nothing was evaluated. A step that already recorded
|
|
391
|
-
// evidence or acted did act, so every later step would rest on a device state
|
|
392
|
-
// nobody declared — that is the run's outcome, not a skip.
|
|
393
|
-
if (observedThisStep === 0 && actions.count === 0) {
|
|
394
|
-
controllerUnsupportedSkips++;
|
|
395
|
-
report(stepDef, "skipped", e.message);
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
aborted = true;
|
|
400
|
-
failed = true;
|
|
401
|
-
failure = new Error(
|
|
402
|
-
`Cert test ${tc} step ${stepDef.number}: the controller refused "${e.operation}" after ` +
|
|
403
|
-
`the step had already recorded ${observedThisStep} check(s) and made ${actions.count} ` +
|
|
404
|
-
`controller call(s) that may change the device, so the device ` +
|
|
405
|
-
`is in a state this run cannot describe. Declare the limitation as a capability gap ` +
|
|
406
|
-
`of the controller, or in its own PICS, so the step is skipped before it acts. ` +
|
|
407
|
-
`Refusal: ${e.message}`,
|
|
408
|
-
);
|
|
409
|
-
|
|
410
|
-
report(stepDef, "fail");
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
388
|
aborted = true;
|
|
415
389
|
failed = true;
|
|
416
390
|
failure = e;
|
|
@@ -791,12 +765,12 @@ function undeclaredRefusal(
|
|
|
791
765
|
stepDef: CertStepDefinition,
|
|
792
766
|
definition: CertTestDefinition,
|
|
793
767
|
refusal: UnsupportedByControllerError,
|
|
794
|
-
capability: ControllerCapability,
|
|
795
768
|
): CertFrameworkError {
|
|
769
|
+
const { capability } = refusal;
|
|
796
770
|
const declared =
|
|
797
771
|
stepDef.controllerCapabilities?.includes(capability) ||
|
|
798
772
|
definition.controllerCapabilities?.includes(capability) ||
|
|
799
|
-
capabilitiesFor({ transport: definition.transport }).includes(capability);
|
|
773
|
+
capabilitiesFor({ transport: definition.transport, attestation: definition.attestation }).includes(capability);
|
|
800
774
|
const cause = declared
|
|
801
775
|
? `controller "${refusal.controller}" refused ${capability}, which its registration declares neither as a gap nor out of scope`
|
|
802
776
|
: `the step needs ${capability} and neither it nor its test case declares it`;
|
|
@@ -139,6 +139,18 @@ function hasStdinCommands(app: string) {
|
|
|
139
139
|
return STDIN_COMMANDS[app] !== undefined;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* The apps CHIP's own builds, chip-cert-bins among them, compile with the interactive shell (`chip_build_libshell` in the
|
|
144
|
+
* app's `args.gni`). The shell reads standard input and stops the app at end of input, so such an app needs a standard
|
|
145
|
+
* input that stays open. This project's image builds every app without the shell.
|
|
146
|
+
*/
|
|
147
|
+
const SHELL_APPS = new Set(["tv"]);
|
|
148
|
+
|
|
149
|
+
/** Whether `app` needs a standard input pipe: for its simulation commands, or to keep its shell from ending it. */
|
|
150
|
+
function needsStdin(app: string) {
|
|
151
|
+
return hasStdinCommands(app) || SHELL_APPS.has(app);
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
/** The character `app` reads for `command`, or `undefined` for a command it does not take that way. */
|
|
143
155
|
function stdinCommandFor(app: string, command: BackchannelCommand): string | undefined {
|
|
144
156
|
return STDIN_COMMANDS[app]?.get(command.name);
|
|
@@ -397,6 +409,8 @@ class ChipLocalDevice implements CertDevice {
|
|
|
397
409
|
readonly commissioning: Subject.CommissioningParameters;
|
|
398
410
|
readonly log: LogFollower;
|
|
399
411
|
|
|
412
|
+
/** The arguments that name the ports of this device's identity, which every start passes. */
|
|
413
|
+
#portArgs: string[];
|
|
400
414
|
#appArgs: string[];
|
|
401
415
|
|
|
402
416
|
/** What the app was last spawned with, which is what the evidence bundle reports. */
|
|
@@ -420,7 +434,8 @@ class ChipLocalDevice implements CertDevice {
|
|
|
420
434
|
this.id = domain;
|
|
421
435
|
this.commissioning = commissioningFor(options?.identity);
|
|
422
436
|
this.log = new LogFollower(this.#hub.follow(), domain);
|
|
423
|
-
this.#
|
|
437
|
+
this.#portArgs = portArgs(options?.identity);
|
|
438
|
+
this.#appArgs = [...this.#portArgs, ...(options?.appArgs ?? [])];
|
|
424
439
|
}
|
|
425
440
|
|
|
426
441
|
/**
|
|
@@ -494,7 +509,7 @@ class ChipLocalDevice implements CertDevice {
|
|
|
494
509
|
|
|
495
510
|
let generation: LocalGeneration | undefined;
|
|
496
511
|
const app = ManagedChildProcess.spawn(binPath, args, {
|
|
497
|
-
stdin:
|
|
512
|
+
stdin: needsStdin(this.app) ? "pipe" : "ignore",
|
|
498
513
|
onExit: exit => {
|
|
499
514
|
if (generation !== undefined) {
|
|
500
515
|
this.#ended(generation, exit);
|
|
@@ -762,18 +777,28 @@ class ChipLocalDevice implements CertDevice {
|
|
|
762
777
|
}
|
|
763
778
|
}
|
|
764
779
|
|
|
780
|
+
/** Stops the app and drops its key-value store, so the next start() is factory-new. */
|
|
781
|
+
async #factoryReset() {
|
|
782
|
+
await this.stop();
|
|
783
|
+
|
|
784
|
+
// A chip app is factory-new only once its key-value store is gone. Dropping the whole storage directory keeps
|
|
785
|
+
// this independent of the file layout the app's KVS implementation chooses; start() creates a fresh one.
|
|
786
|
+
if (this.#storageDir !== undefined) {
|
|
787
|
+
await rm(this.#storageDir, { recursive: true, force: true });
|
|
788
|
+
this.#storageDir = undefined;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
765
792
|
async backchannel(command: BackchannelCommand): Promise<void> {
|
|
766
793
|
switch (command.name) {
|
|
767
794
|
case "factoryReset":
|
|
768
|
-
await this
|
|
795
|
+
await this.#factoryReset();
|
|
796
|
+
await startForBackchannel(this, command.name);
|
|
797
|
+
break;
|
|
769
798
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
if (this.#storageDir !== undefined) {
|
|
774
|
-
await rm(this.#storageDir, { recursive: true, force: true });
|
|
775
|
-
this.#storageDir = undefined;
|
|
776
|
-
}
|
|
799
|
+
case "factoryResetWithAppArgs":
|
|
800
|
+
await this.#factoryReset();
|
|
801
|
+
this.#appArgs = [...this.#portArgs, ...command.appArgs];
|
|
777
802
|
await startForBackchannel(this, command.name);
|
|
778
803
|
break;
|
|
779
804
|
|
|
@@ -65,6 +65,7 @@ export interface CommissioningTarget {
|
|
|
65
65
|
* `writeAttribute`, `subscribe` and `decommission`. The controller's copy of the peer starts empty and holds
|
|
66
66
|
* only what direct calls read, so the calls that answer from it — `clientEndpoints`, `clientAttribute`, event
|
|
67
67
|
* observation, `openCommissioningWindow`, the ICD and OTA helpers — answer wrongly or fail.
|
|
68
|
+
* `openCommissioningWindow` works once the caller has read the node's root endpoint (endpoint 0, every cluster).
|
|
68
69
|
*
|
|
69
70
|
* Advisory. An adapter whose controller holds no such subscription has nothing to do.
|
|
70
71
|
*/
|
|
@@ -300,7 +301,7 @@ export interface ReadAttributeOptions {
|
|
|
300
301
|
* session over TCP (Matter Core § 4.15.1).
|
|
301
302
|
*
|
|
302
303
|
* A hard requirement, not a preference: a controller that cannot establish such a session fails
|
|
303
|
-
* the read, or refuses it
|
|
304
|
+
* the read, or refuses it naming `tcp-transport`, rather than reading over MRP
|
|
304
305
|
* — so a step asking for one cannot pass on a transport it did not use. A broad read is the case
|
|
305
306
|
* for it: the peer answers in a single report where MRP would have made it chunk.
|
|
306
307
|
*/
|
|
@@ -667,7 +668,12 @@ export interface OtaAnnouncementRecord {
|
|
|
667
668
|
/** `ProviderNodeID`, in the form {@link ControllerAdapter.commission} answers with. */
|
|
668
669
|
providerNodeId: CertNodeRef;
|
|
669
670
|
|
|
670
|
-
/**
|
|
671
|
+
/**
|
|
672
|
+
* `VendorID`: the announcing controller's vendor id as it would appear in its Basic Information cluster. A
|
|
673
|
+
* controller without that cluster sends its commissioner (admin) vendor id.
|
|
674
|
+
*
|
|
675
|
+
* @see {@link MatterSpecification.v161.Core} § 11.20.7.6.1.2
|
|
676
|
+
*/
|
|
671
677
|
vendorId: number;
|
|
672
678
|
|
|
673
679
|
/** `AnnouncementReason`: 0 SimpleAnnouncement, 1 UpdateAvailable, 2 UrgentUpdateAvailable. */
|
|
@@ -868,8 +874,8 @@ export interface CertIcdClientApi {
|
|
|
868
874
|
*
|
|
869
875
|
* A method whose controller cannot express the requested operation throws
|
|
870
876
|
* {@link UnsupportedByControllerError} rather than performing part of the interaction and returning
|
|
871
|
-
* a partial result; a step that needs the capability declares
|
|
872
|
-
*
|
|
877
|
+
* a partial result; a step that needs the capability declares it (see {@link ControllerCapability}), so it is
|
|
878
|
+
* skipped before it runs where the controller lacks it.
|
|
873
879
|
*/
|
|
874
880
|
export interface CertNodeApi {
|
|
875
881
|
invoke(
|
|
@@ -894,8 +900,8 @@ export interface CertNodeApi {
|
|
|
894
900
|
* {@link invoke}, a failure status is reported rather than thrown — the whole point of the batch is
|
|
895
901
|
* that its commands fail independently.
|
|
896
902
|
*
|
|
897
|
-
* A controller with no batch-invoke support throws {@link UnsupportedByControllerError}
|
|
898
|
-
* {@link CertNodeApi}'s own doc for the general contract).
|
|
903
|
+
* A controller with no batch-invoke support lacks `batch-invoke` and throws {@link UnsupportedByControllerError}
|
|
904
|
+
* (see {@link CertNodeApi}'s own doc for the general contract).
|
|
899
905
|
*
|
|
900
906
|
* @see {@link MatterSpecification.v161.Core} § 8.8.2
|
|
901
907
|
*/
|
|
@@ -928,8 +934,9 @@ export interface CertNodeApi {
|
|
|
928
934
|
* result was therefore not written — it is not a protocol failure, and a step that needs to know an attribute
|
|
929
935
|
* changed reads it back.
|
|
930
936
|
*
|
|
931
|
-
* An adapter whose controller cannot express
|
|
932
|
-
*
|
|
937
|
+
* An adapter whose controller cannot express the write throws {@link UnsupportedByControllerError} naming the
|
|
938
|
+
* capability it lacks or does not offer, among them `multi-path-write`, `mixed-version-write`,
|
|
939
|
+
* `typed-list-write-with-others` and `many-paths-per-request` (see {@link CertNodeApi}'s own doc for the general
|
|
933
940
|
* contract).
|
|
934
941
|
*
|
|
935
942
|
* @see {@link MatterSpecification.v161.Core} § 8.9.2.7, § 8.7.3.2
|
|
@@ -1104,6 +1111,25 @@ export interface CertNodeApi {
|
|
|
1104
1111
|
enhanced: boolean;
|
|
1105
1112
|
}): Promise<{ manualPairingCode?: string; qrPairingCode?: string }>;
|
|
1106
1113
|
decommission(): Promise<void>;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Replaces this node's operational certificate (NOC) with one the controller issues for a new operational key pair,
|
|
1117
|
+
* keeping the node ID and fabric.
|
|
1118
|
+
*
|
|
1119
|
+
* Over CASE, the controller arms the fail-safe, sends CSRRequest with IsForUpdateNOC set, issues a NOC for the
|
|
1120
|
+
* returned CSR, sends UpdateNOC, opens a new CASE session and sends CommissioningComplete. Resolves once
|
|
1121
|
+
* CommissioningComplete answered with success, or once a later read shows that a CommissioningComplete whose answer
|
|
1122
|
+
* was lost took effect. Rejects where any of these steps fails. A rejection does not prove that the node holds its
|
|
1123
|
+
* previous certificate: another operation of the same fabric may have committed the new one, or the outcome may be
|
|
1124
|
+
* unknown.
|
|
1125
|
+
*
|
|
1126
|
+
* Present where the controller can issue a certificate for a node it commissioned; a step that needs it declares
|
|
1127
|
+
* `noc-update` (see {@link ControllerCapability}).
|
|
1128
|
+
*
|
|
1129
|
+
* @see {@link MatterSpecification.v161.Core} § 11.18.6.9
|
|
1130
|
+
*/
|
|
1131
|
+
updateOperationalCertificate?(): Promise<void>;
|
|
1132
|
+
|
|
1107
1133
|
/**
|
|
1108
1134
|
* The operational mDNS instance name (`<compressed-fabric-id>-<node-id>._matter._tcp.local`) this node
|
|
1109
1135
|
* advertises on the fabric it was commissioned onto — the same value matter.js's own advertiser computes
|
|
@@ -1122,26 +1148,22 @@ export interface CertNodeApi {
|
|
|
1122
1148
|
* Raise this before the operation has any observable effect (a commission, a write, a recorded
|
|
1123
1149
|
* check).
|
|
1124
1150
|
*
|
|
1125
|
-
*
|
|
1126
|
-
* implementation declares that capability as a gap, so a step or test case that declares it is
|
|
1127
|
-
* before it runs, and a refusal that still reaches the step runner means a declaration is missing on one
|
|
1128
|
-
* side. The runner reports that as a framework error, whatever the step already did.
|
|
1151
|
+
* Every refusal names the {@link ControllerCapability} it stands for, and is never a step outcome: the
|
|
1152
|
+
* implementation declares that capability as a gap or out of scope, so a step or test case that declares it is
|
|
1153
|
+
* skipped before it runs, and a refusal that still reaches the step runner means a declaration is missing on one
|
|
1154
|
+
* side. The runner reports that as a framework error, whatever the step already did. A step must never take this
|
|
1155
|
+
* error for an outcome of the device.
|
|
1129
1156
|
*
|
|
1130
|
-
*
|
|
1131
|
-
* the step had not yet recorded a check or made a controller call that may change the device, and fails
|
|
1132
|
-
* and aborts the run otherwise. A step must never take this error for an outcome of the device.
|
|
1157
|
+
* `detail` says why the controller lacks the capability; an implementation passes the reason it registered.
|
|
1133
1158
|
*/
|
|
1134
1159
|
export class UnsupportedByControllerError extends Error {
|
|
1135
1160
|
constructor(
|
|
1136
1161
|
readonly operation: string,
|
|
1137
1162
|
readonly controller: string,
|
|
1138
|
-
detail
|
|
1139
|
-
readonly capability
|
|
1163
|
+
detail: string,
|
|
1164
|
+
readonly capability: ControllerCapability,
|
|
1140
1165
|
) {
|
|
1141
|
-
super(
|
|
1142
|
-
`not implementable on controller "${controller}": ${operation}` +
|
|
1143
|
-
(detail === undefined ? "" : ` — ${detail}`),
|
|
1144
|
-
);
|
|
1166
|
+
super(`not implementable on controller "${controller}": ${operation} — ${detail}`);
|
|
1145
1167
|
}
|
|
1146
1168
|
}
|
|
1147
1169
|
|
|
@@ -1185,6 +1207,23 @@ export interface ControllerAdapter {
|
|
|
1185
1207
|
*/
|
|
1186
1208
|
parseManualPairingCode(code: string): Promise<ManualPairingCodeFields>;
|
|
1187
1209
|
|
|
1210
|
+
/**
|
|
1211
|
+
* The commissionable nodes the controller finds through DNS-SD, without commissioning any of them.
|
|
1212
|
+
*
|
|
1213
|
+
* Each controller looks for as long as its own discovery does, and reports what it found then: matter.js for a
|
|
1214
|
+
* fixed window, matterjs-server for the window its `discover_commissionable_nodes` command uses, chip-tool until
|
|
1215
|
+
* the first node that matches. A filter narrows the search where the controller can apply one; a controller that
|
|
1216
|
+
* cannot reports every node it found, so a caller still selects the node it is looking for. Where the controller
|
|
1217
|
+
* found nothing, resolves with an empty list, or rejects where the controller reports such a search as a failure
|
|
1218
|
+
* (chip-tool).
|
|
1219
|
+
*
|
|
1220
|
+
* Present where the controller can discover without commissioning; a step that needs it declares
|
|
1221
|
+
* `commissionable-discovery` (see {@link ControllerCapability}).
|
|
1222
|
+
*
|
|
1223
|
+
* @see {@link MatterSpecification.v161.Core} § 4.3.1
|
|
1224
|
+
*/
|
|
1225
|
+
discoverCommissionableNodes?(filter?: CommissionableNodeFilter): Promise<DiscoveredCommissionableNode[]>;
|
|
1226
|
+
|
|
1188
1227
|
node(ref: CertNodeRef): CertNodeApi;
|
|
1189
1228
|
|
|
1190
1229
|
/**
|
|
@@ -1289,6 +1328,33 @@ export interface ManualPairingCodeFields {
|
|
|
1289
1328
|
productId?: number;
|
|
1290
1329
|
}
|
|
1291
1330
|
|
|
1331
|
+
/** What {@link ControllerAdapter.discoverCommissionableNodes} asks the controller to look for. */
|
|
1332
|
+
export interface CommissionableNodeFilter {
|
|
1333
|
+
/** The 12-bit discriminator of the `_L` commissioning subtype (§ 4.3.1.3). */
|
|
1334
|
+
longDiscriminator?: number;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* A commissionable node as {@link ControllerAdapter.discoverCommissionableNodes} reports it: the values of its DNS-SD
|
|
1339
|
+
* advertisement, as the controller read them.
|
|
1340
|
+
*
|
|
1341
|
+
* @see {@link MatterSpecification.v161.Core} § 4.3.1
|
|
1342
|
+
*/
|
|
1343
|
+
export interface DiscoveredCommissionableNode {
|
|
1344
|
+
/** The DNS-SD service instance name. */
|
|
1345
|
+
instanceName: string;
|
|
1346
|
+
|
|
1347
|
+
/** The `D` TXT key (§ 4.3.1.5). */
|
|
1348
|
+
longDiscriminator: number;
|
|
1349
|
+
|
|
1350
|
+
/** From the `VP` TXT key (§ 4.3.1.6); absent where the node states none. */
|
|
1351
|
+
vendorId?: number;
|
|
1352
|
+
productId?: number;
|
|
1353
|
+
|
|
1354
|
+
/** The `CM` TXT key (§ 4.3.1.7). */
|
|
1355
|
+
commissioningMode: number;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1292
1358
|
/**
|
|
1293
1359
|
* How a controller reaches its peers. `"tcp"` asks for a TCP-backed session, which a large-payload
|
|
1294
1360
|
* interaction requires; omitted, a controller keeps the transport every other TC's evidence and
|
|
@@ -1505,9 +1571,18 @@ export type ControllerRoleKind = "dut" | "helper";
|
|
|
1505
1571
|
*
|
|
1506
1572
|
* - `onboarding-payload-parse` — {@link ControllerAdapter.parseQrPayload} and
|
|
1507
1573
|
* {@link ControllerAdapter.parseManualPairingCode}
|
|
1574
|
+
* - `commissionable-discovery` — {@link ControllerAdapter.discoverCommissionableNodes}
|
|
1508
1575
|
* - `multi-path-write` — {@link CertNodeApi.writeAttributes} with several entries or a data version
|
|
1576
|
+
* - `mixed-version-write` — {@link CertNodeApi.writeAttributes} in which some entries carry a data version and others
|
|
1577
|
+
* do not
|
|
1578
|
+
* - `typed-list-write-with-others` — {@link CertNodeApi.writeAttributes} with several entries, one of them a list
|
|
1579
|
+
* attribute the controller writes only through a command of its own for that attribute, which carries no other
|
|
1580
|
+
* entry (the implementation's gap text names the attributes)
|
|
1581
|
+
* - `many-paths-per-request` — a read, subscription or write that names more paths in one request than a controller
|
|
1582
|
+
* accepts in one command (the implementation's gap text names its limit)
|
|
1509
1583
|
* - `chunked-write` — a write too large for one message sent as chunked WriteRequestMessages, each next one after the
|
|
1510
1584
|
* WriteResponse to the previous (Matter Core § 10.2.3)
|
|
1585
|
+
* - `batch-invoke` — {@link CertNodeApi.invokeBatch}: several commands in one InvokeRequest
|
|
1511
1586
|
* - `batch-arrival-order` — {@link CertNodeApi.invokeBatch} results in the order the device's answers arrived
|
|
1512
1587
|
* - `basic-commissioning-window` — {@link CertNodeApi.openCommissioningWindow} without `enhanced`
|
|
1513
1588
|
* - `max-value-path-ids` — a concrete path naming endpoint 0xFFFF or a cluster, attribute or event id 0xFFFFFFFF
|
|
@@ -1530,6 +1605,7 @@ export type ControllerRoleKind = "dut" | "helper";
|
|
|
1530
1605
|
* - `sustained-subscription` — a subscription the controller keeps to a node on its own, which
|
|
1531
1606
|
* {@link CertNodeApi.observeEvents} reports through and which keeps what {@link CertNodeApi.clientEndpoints} and
|
|
1532
1607
|
* {@link CertNodeApi.clientAttribute} answer following the node
|
|
1608
|
+
* - `noc-update` — {@link CertNodeApi.updateOperationalCertificate}
|
|
1533
1609
|
*
|
|
1534
1610
|
* An implementation states the ones it lacks, and the ones it deliberately does not offer, when it registers (see
|
|
1535
1611
|
* {@link registerControllerAdapterFactory}), and a step or test case states the ones it needs, so the engine skips it
|
|
@@ -1539,8 +1615,13 @@ export type ControllerRoleKind = "dut" | "helper";
|
|
|
1539
1615
|
*/
|
|
1540
1616
|
export type ControllerCapability =
|
|
1541
1617
|
| "onboarding-payload-parse"
|
|
1618
|
+
| "commissionable-discovery"
|
|
1542
1619
|
| "multi-path-write"
|
|
1620
|
+
| "mixed-version-write"
|
|
1621
|
+
| "typed-list-write-with-others"
|
|
1622
|
+
| "many-paths-per-request"
|
|
1543
1623
|
| "chunked-write"
|
|
1624
|
+
| "batch-invoke"
|
|
1544
1625
|
| "batch-arrival-order"
|
|
1545
1626
|
| "basic-commissioning-window"
|
|
1546
1627
|
| "max-value-path-ids"
|
|
@@ -1555,7 +1636,8 @@ export type ControllerCapability =
|
|
|
1555
1636
|
| "ota-provider"
|
|
1556
1637
|
| "ota-provider-script"
|
|
1557
1638
|
| "icd-client"
|
|
1558
|
-
| "sustained-subscription"
|
|
1639
|
+
| "sustained-subscription"
|
|
1640
|
+
| "noc-update";
|
|
1559
1641
|
|
|
1560
1642
|
/** The {@link ControllerCapability | capabilities} an implementation lacks, each with the reason it lacks it. */
|
|
1561
1643
|
export type ControllerCapabilityGaps = Readonly<Partial<Record<ControllerCapability, string>>>;
|
|
@@ -127,8 +127,8 @@ export interface RunRecord {
|
|
|
127
127
|
*/
|
|
128
128
|
runError?: string;
|
|
129
129
|
/**
|
|
130
|
-
* How many steps the controller under test
|
|
131
|
-
* verdict `"controller-gap"`, and the count says how much of the plan the run left out.
|
|
130
|
+
* How many steps were skipped because the controller under test lacks a capability they declare, absent if none.
|
|
131
|
+
* Any such step makes the verdict `"controller-gap"`, and the count says how much of the plan the run left out.
|
|
132
132
|
*/
|
|
133
133
|
controllerUnsupportedSkips?: number;
|
|
134
134
|
/**
|
|
@@ -287,7 +287,7 @@ export class EvidenceRecorder implements StepRecorder {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* Records how many steps the controller under test
|
|
290
|
+
* Records how many steps were skipped because the controller under test lacks a capability they declare (see
|
|
291
291
|
* {@link RunRecord.controllerUnsupportedSkips}). Such a step is a gap in coverage, not a defect in the device,
|
|
292
292
|
* so it settles a run that failed nothing as `"controller-gap"`.
|
|
293
293
|
*/
|