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
@@ -173,6 +173,24 @@ test("rejects a revoked Edge registration before opening a channel", async () =>
}
});
test("rejects an Edge hello from an unexpected channel generation", async () => {
const edge = createEdgeServer({
channelGeneration: "generation:edge-unexpected",
});
const address = await edge.start();
const core = createCoreClient({ address });
try {
await core.start();
await waitFor(() => core.status().protocolFailures >= 1, 2_000);
assert.notEqual(core.status().channel, "accepted");
assert.match(core.status().lastErrorCode, /channel_generation_mismatch/);
assert.equal(edge.status().channelsAccepted, 0);
} finally {
await core.stop();
await edge.stop();
}
});
test("rejects an authenticated but non-allowlisted Core certificate", async () => {
const edge = createEdgeServer();
const address = await edge.start();
@@ -370,7 +388,7 @@ function createEdgeServer(options = {}) {
const edgeCertificate = options.edgeCertificate ?? certificates.edge;
return createDeviceEdgeChannelServer({
edgeRegistrationId: "edge:pilot-1",
channelGeneration: "generation:pilot-1",
channelGeneration: options.channelGeneration ?? "generation:pilot-1",
trustGeneration: options.edgeTrustGeneration ?? "trust-generation:1",
host: "127.0.0.1",
port: 0,
@@ -427,6 +445,7 @@ function createCoreClient(options) {
function edgeRegistration(address, certificateIdentities, lifecycleState = "active") {
return {
edgeRegistrationId: "edge:pilot-1",
channelGeneration: "generation:pilot-1",
endpoint: `https://127.0.0.1:${address.port}/`,
servername: "localhost",
certificateIdentities,