feat(device-plane): supervise pinned edge channels in core

This commit is contained in:
Codex
2026-08-11 20:14:55 +03:00
parent 6461e7fca8
commit be964eccb7
18 changed files with 1217 additions and 70 deletions
@@ -143,6 +143,62 @@ test("shared catalog and Edge authority requires the Hub owner ceiling", () => {
);
});
test("normalizes only a pinned Core-initiated public Edge channel", () => {
const command = normalizeInfrastructureManagementCommand("edge.ensure", {
edgeKey: "moscow-edge",
displayName: "Moscow Edge",
deploymentRef: "deployment:device-edge/moscow-1",
lifecycleState: "active",
channel: {
endpoint: "https://155.212.211.15:8443/",
servername: "155.212.211.15",
generationRef: "channel-generation:1",
trustBundleRef: "edge-trust:moscow-edge",
certificateIdentities: [{
generationRef: "edge-identity:1",
fingerprint: "AA:".repeat(31) + "AA",
status: "active",
}],
lifecycleState: "active",
},
});
assert.equal(command.channel.endpoint, "https://155.212.211.15:8443/");
assert.equal(command.channel.lifecycleState, "active");
assert.equal(command.channel.certificateIdentities.length, 1);
for (const endpoint of [
"https://127.0.0.1:8443/",
"https://192.168.1.1:8443/",
"https://155.212.211.15:9921/",
"http://155.212.211.15:8443/",
]) {
assert.throws(
() => normalizeInfrastructureManagementCommand("edge.ensure", {
edgeKey: "bad-edge",
displayName: "Bad Edge",
channel: { ...command.channel, endpoint },
}),
/device_edge_channel_endpoint_invalid/,
);
}
assert.throws(
() => normalizeInfrastructureManagementCommand("edge.ensure", {
edgeKey: "bad-edge",
displayName: "Bad Edge",
channel: { ...command.channel, servername: "example.invalid" },
}),
/device_edge_channel_servername_mismatch/,
);
assert.throws(
() => normalizeInfrastructureManagementCommand("edge.ensure", {
edgeKey: "bad-edge",
displayName: "Bad Edge",
channel: { lifecycleState: "disabled", endpoint: command.channel.endpoint },
}),
/device_edge_channel_disabled_configuration_invalid/,
);
});
function actor(hubRole) {
return normalizeManagementActor({
userRef: "user:platform-admin",