fix(k1): expose exact supervisor recovery verify
This commit is contained in:
@@ -5260,6 +5260,90 @@ test("an unresolved physical command has one explicit server-bound read-only rec
|
||||
assert.match(physicalRecovery, /physicalRecoveryTarget\?\.serverBound/);
|
||||
});
|
||||
|
||||
test("supervisor DeviceInfo Verify keeps the exact physical reconnect visible", () => {
|
||||
const state = durableTopologyState();
|
||||
const recoveryTransport = "F89438FA-55ED-85AD-EED7-734AC84746D8";
|
||||
state.snapshot_runtime_id = "runtime-terminal-control-physical-recovery";
|
||||
state.semantic_topology_store.record.transport_ref = recoveryTransport;
|
||||
state.physical_command = {
|
||||
status: "unresolved",
|
||||
reason_code: "physical-command-reconciliation-required",
|
||||
requires_reconciliation: true,
|
||||
resolved_active_recovery_required: false,
|
||||
reconciliation_ready: true,
|
||||
record: {
|
||||
revision: 583,
|
||||
operation_id: "old-start-operation",
|
||||
action: "start",
|
||||
stage: "observing",
|
||||
resolution: null,
|
||||
connection: {
|
||||
transport_ref: recoveryTransport,
|
||||
connection_mode: "bridge",
|
||||
target_ipv4: "192.168.68.52",
|
||||
},
|
||||
},
|
||||
};
|
||||
const deniedObservation = (targetSource) => ({
|
||||
allowed: false,
|
||||
reason_codes: ["control-session-not-admissible-for-network-change"],
|
||||
target_source: targetSource,
|
||||
required_transport_ref: recoveryTransport,
|
||||
required_connection_mode: "bridge",
|
||||
requires_live_gatt_validation: true,
|
||||
automatic_retry: false,
|
||||
});
|
||||
state.connection_policy = {
|
||||
schema_version: "missioncore.xgrids-k1-connection-policy/v1",
|
||||
facts: { retained_context_is_presence: false, retired_transport_refs: [] },
|
||||
recommended_action: "scan-ble",
|
||||
allowed_actions: [
|
||||
"scan-ble",
|
||||
"inspect-configured-endpoint",
|
||||
"verify-control-device-info",
|
||||
],
|
||||
actions: {
|
||||
"observe-fresh-device-network": deniedObservation("fresh-scan"),
|
||||
"observe-current-device-network": deniedObservation(
|
||||
"retained-current-process",
|
||||
),
|
||||
"observe-configured-device-network": deniedObservation(
|
||||
"durable-configured-state",
|
||||
),
|
||||
"verify-control-device-info": {
|
||||
allowed: true,
|
||||
reason_codes: [],
|
||||
target_source: "connection-supervisor",
|
||||
required_transport_ref: null,
|
||||
requires_live_gatt_validation: false,
|
||||
automatic_retry: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepEqual(readOnlyConnectionObservationTarget(state), {
|
||||
action: "verify-control-device-info",
|
||||
deviceId: recoveryTransport,
|
||||
connectionMode: "bridge",
|
||||
source: "durable-configured-state",
|
||||
serverBound: true,
|
||||
expectedDiscoveryGeneration: null,
|
||||
});
|
||||
|
||||
const markup = renderToStaticMarkup(createElement(K1ProvisioningPipeline, {
|
||||
controller: provisioningController(state),
|
||||
desiredMode: "bridge",
|
||||
}));
|
||||
const reconnect = buttonMarkupWithText(markup, "Переподключиться");
|
||||
assert.equal(reconnect.length, 1);
|
||||
assert.doesNotMatch(reconnect[0], /\bdisabled(?:=|\s|>)/);
|
||||
assert.equal(buttonMarkupWithText(markup, "Подключить новый K1").length, 1);
|
||||
|
||||
const mismatched = structuredClone(state);
|
||||
mismatched.semantic_topology_store.record.transport_ref = "another-k1";
|
||||
assert.equal(readOnlyConnectionObservationTarget(mismatched), null);
|
||||
});
|
||||
|
||||
test("unavailable physical replacement stays CAS-protected behind the simple new-device path", () => {
|
||||
const state = durableTopologyState();
|
||||
const transportRef = "F89438FA-55ED-85AD-EED7-734AC84746D8";
|
||||
|
||||
Reference in New Issue
Block a user