feat(device-plane): add canonical Device Manager runtime

This commit is contained in:
Codex
2026-08-10 22:00:59 +03:00
parent 1d1e9a96b3
commit 29ba5de92e
14 changed files with 1122 additions and 10 deletions
@@ -5,7 +5,7 @@ import test from "node:test";
const appUrl = new URL("../src/app.mjs", import.meta.url);
const serverUrl = new URL("../src/server.mjs", import.meta.url);
const repositoryUrl = new URL("../src/postgres-repository.mjs", import.meta.url);
const composeUrl = new URL("../../../docker-compose.device-plane.yml", import.meta.url);
const managerComposeUrl = new URL("../../../docker-compose.device-manager.yml", import.meta.url);
test("management surface is internal, POST-only and disabled by default", async () => {
const source = await readFile(appUrl, "utf8");
@@ -22,14 +22,22 @@ test("management surface is internal, POST-only and disabled by default", async
assert.doesNotMatch(source, /device-commands:(?:plan|confirm|dispatch)/);
});
test("management token remains file-backed and is not enabled by current Compose", async () => {
test("management API is enabled only through a runner-owned file token", async () => {
const server = await readFile(serverUrl, "utf8");
const compose = await readFile(composeUrl, "utf8");
const compose = await readFile(managerComposeUrl, "utf8");
assert.match(server, /DEVICE_MANAGEMENT_API_ENABLED/);
assert.match(server, /DEVICE_MANAGEMENT_CORE_TOKEN_FILE/);
assert.doesNotMatch(compose, /DEVICE_MANAGEMENT_API_ENABLED/);
assert.doesNotMatch(compose, /DEVICE_MANAGEMENT_CORE_TOKEN_FILE/);
assert.match(compose, /DEVICE_MANAGEMENT_API_ENABLED: "true"/);
assert.match(
compose,
/DEVICE_MANAGEMENT_CORE_TOKEN_FILE: \/run\/nodedc-secrets\/management-core-token/,
);
assert.match(
compose,
/source: \/volume1\/docker\/nodedc-device-plane\/secrets\/management-core-token/,
);
assert.doesNotMatch(compose, /DEVICE_MANAGEMENT_CORE_TOKEN:\s/);
});
test("repository pins idempotency, audit and last-owner checks inside one transaction", async () => {