Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6771b2fbf | ||
|
|
87a1e64807 | ||
|
|
952290a49d | ||
|
|
6123a06527 | ||
|
|
12901e0e19 | ||
|
|
a6fb60d38f | ||
|
|
94e437e842 | ||
|
|
c1c9818e30 | ||
|
|
26dbcfd262 |
@@ -1,114 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { createHash } from "node:crypto";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cp, lstat, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const platformRoot = resolve(scriptDir, "../..");
|
||||
const taskerRoot = resolve(
|
||||
process.env.NODEDC_TASKMANAGER_ROOT || resolve(platformRoot, "../../data/dc_taskmanager/NODEDC_TASKMANAGER"),
|
||||
);
|
||||
const artifactDir = resolve(process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(scriptDir, "../deploy-artifacts"));
|
||||
const [release = "20260821-002", ...extra] = process.argv.slice(2);
|
||||
|
||||
if (extra.length || release !== "20260821-002") {
|
||||
throw new Error("usage: build-tasker-comments-route-diagnostics-artifact.mjs [20260821-002]");
|
||||
}
|
||||
|
||||
const descriptor = {
|
||||
artifactBasename: `nodedc-tasker-comments-route-diagnostics-${release}.tgz`,
|
||||
component: "tasker",
|
||||
expectedCommit: "0df65d85dd8a04f2d2532235d482864a6f6cfd3d",
|
||||
files: ["plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py"],
|
||||
patchId: `tasker-comments-route-diagnostics-${release}`,
|
||||
};
|
||||
|
||||
const sourceCommit = gitOutput(taskerRoot, ["rev-parse", "HEAD"]);
|
||||
if (sourceCommit !== descriptor.expectedCommit) throw new Error(`source_commit_mismatch:${sourceCommit}`);
|
||||
if (gitOutput(taskerRoot, ["status", "--porcelain"])) throw new Error("source_worktree_not_clean:tasker");
|
||||
|
||||
await mkdir(artifactDir, { recursive: true });
|
||||
const stage = await mkdtemp(join(tmpdir(), "nodedc-tasker-comments-route-diagnostics-"));
|
||||
const payload = join(stage, "payload");
|
||||
const artifact = join(artifactDir, descriptor.artifactBasename);
|
||||
|
||||
try {
|
||||
await assertFresh(artifact);
|
||||
await mkdir(payload, { recursive: true });
|
||||
for (const relativePath of descriptor.files) {
|
||||
const source = resolve(taskerRoot, relativePath);
|
||||
const sourceStat = await lstat(source);
|
||||
if (!sourceStat.isFile() || sourceStat.isSymbolicLink()) throw new Error(`source_file_rejected:${relativePath}`);
|
||||
const destination = join(payload, relativePath);
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
await cp(source, destination, { force: false, verbatimSymlinks: true });
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
join(stage, "manifest.env"),
|
||||
`id=${descriptor.patchId}\ncomponent=${descriptor.component}\ntype=app-overlay\n`,
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(join(stage, "files.txt"), `${descriptor.files.join("\n")}\n`, "utf8");
|
||||
|
||||
const tar = spawnSync("python3", ["-c", canonicalTarScript(), artifact, stage], {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 128 * 1024 * 1024,
|
||||
});
|
||||
if (tar.status !== 0) throw new Error(`tar_failed:${tar.stderr || tar.stdout}`);
|
||||
|
||||
const sha256 = createHash("sha256").update(await readFile(artifact)).digest("hex");
|
||||
console.log(
|
||||
JSON.stringify(
|
||||
{
|
||||
ok: true,
|
||||
release,
|
||||
artifact,
|
||||
component: descriptor.component,
|
||||
files: descriptor.files,
|
||||
patchId: descriptor.patchId,
|
||||
sha256,
|
||||
sourceCommit,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
await rm(stage, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
function gitOutput(cwd, args) {
|
||||
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
||||
if (result.status !== 0) throw new Error(`git_failed:${args.join("_")}:${result.stderr || result.stdout}`);
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
async function assertFresh(path) {
|
||||
try {
|
||||
await lstat(path);
|
||||
} catch (error) {
|
||||
if (error?.code === "ENOENT") return;
|
||||
throw error;
|
||||
}
|
||||
throw new Error(`output_already_exists:${path}`);
|
||||
}
|
||||
|
||||
function canonicalTarScript() {
|
||||
return [
|
||||
"import gzip,io,pathlib,sys,tarfile",
|
||||
"root=pathlib.Path(sys.argv[2])",
|
||||
"with open(sys.argv[1],'wb') as out:",
|
||||
" with gzip.GzipFile(filename='',mode='wb',fileobj=out,compresslevel=9,mtime=0) as gz:",
|
||||
" with tarfile.open(fileobj=gz,mode='w',format=tarfile.PAX_FORMAT) as tar:",
|
||||
" for top in ('manifest.env','files.txt','payload'):",
|
||||
" p=root/top; paths=[p]+(sorted(p.rglob('*')) if p.is_dir() else [])",
|
||||
" for x in paths:",
|
||||
" info=tar.gettarinfo(str(x),arcname=x.relative_to(root).as_posix())",
|
||||
" info.uid=info.gid=0; info.uname=info.gname='root'; info.mtime=0; info.mode=0o755 if info.isdir() else 0o644",
|
||||
" with (open(x,'rb') if info.isfile() else io.BytesIO()) as src: tar.addfile(info,src if info.isfile() else None)",
|
||||
].join("\n");
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { createHash } from "node:crypto";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cp, lstat, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const platformRoot = resolve(scriptDir, "../..");
|
||||
const taskerRoot = resolve(
|
||||
process.env.NODEDC_TASKMANAGER_ROOT || resolve(platformRoot, "../../data/dc_taskmanager/NODEDC_TASKMANAGER"),
|
||||
);
|
||||
const opsAgentsRoot = resolve(
|
||||
process.env.NODEDC_OPS_AGENTS_ROOT || resolve(platformRoot, "../../data/NODEDC_TASKMANAGER_CODEXAPI"),
|
||||
);
|
||||
const artifactDir = resolve(process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(scriptDir, "../deploy-artifacts"));
|
||||
const [release = "20260821-001", ...extra] = process.argv.slice(2);
|
||||
|
||||
if (extra.length || release !== "20260821-001") {
|
||||
throw new Error("usage: build-tasker-ops-comments-inventory-artifacts.mjs [20260821-001]");
|
||||
}
|
||||
|
||||
const descriptors = [
|
||||
{
|
||||
artifactBasename: `nodedc-tasker-comments-inventory-${release}.tgz`,
|
||||
component: "tasker",
|
||||
expectedCommit: "42988b9cbea0a9a0b85a817c2dcb5b396aeda197",
|
||||
files: [
|
||||
"plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py",
|
||||
"plane-src/apps/api/plane/urls.py",
|
||||
],
|
||||
patchId: `tasker-comments-inventory-${release}`,
|
||||
sourceRoot: taskerRoot,
|
||||
},
|
||||
{
|
||||
artifactBasename: `nodedc-ops-agents-comments-inventory-${release}.tgz`,
|
||||
component: "ops-agents",
|
||||
expectedCommit: "d4fea6b29001df10444cae2ea95bc8259b22c763",
|
||||
files: [
|
||||
"src/mcp/tool-runtime.ts",
|
||||
"src/routes/tools.ts",
|
||||
"src/tasker/client.ts",
|
||||
],
|
||||
patchId: `ops-agents-comments-inventory-${release}`,
|
||||
sourceRoot: opsAgentsRoot,
|
||||
},
|
||||
];
|
||||
|
||||
await mkdir(artifactDir, { recursive: true });
|
||||
const artifacts = [];
|
||||
|
||||
for (const descriptor of descriptors) {
|
||||
const sourceCommit = gitOutput(descriptor.sourceRoot, ["rev-parse", "HEAD"]);
|
||||
if (sourceCommit !== descriptor.expectedCommit) {
|
||||
throw new Error(`source_commit_mismatch:${descriptor.component}:${sourceCommit}`);
|
||||
}
|
||||
const sourceStatus = gitOutput(descriptor.sourceRoot, ["status", "--porcelain"]);
|
||||
if (sourceStatus) throw new Error(`source_worktree_not_clean:${descriptor.component}`);
|
||||
|
||||
const stage = await mkdtemp(join(tmpdir(), `nodedc-${descriptor.component}-comments-inventory-`));
|
||||
const payload = join(stage, "payload");
|
||||
const artifact = join(artifactDir, descriptor.artifactBasename);
|
||||
|
||||
try {
|
||||
await assertFresh(artifact);
|
||||
await mkdir(payload, { recursive: true });
|
||||
for (const relativePath of descriptor.files) {
|
||||
const source = resolve(descriptor.sourceRoot, relativePath);
|
||||
const sourceStat = await lstat(source);
|
||||
if (!sourceStat.isFile() || sourceStat.isSymbolicLink()) {
|
||||
throw new Error(`source_file_rejected:${descriptor.component}:${relativePath}`);
|
||||
}
|
||||
const destination = join(payload, relativePath);
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
await cp(source, destination, { force: false, verbatimSymlinks: true });
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
join(stage, "manifest.env"),
|
||||
`id=${descriptor.patchId}\ncomponent=${descriptor.component}\ntype=app-overlay\n`,
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(join(stage, "files.txt"), `${descriptor.files.join("\n")}\n`, "utf8");
|
||||
|
||||
const tar = spawnSync("python3", ["-c", canonicalTarScript(), artifact, stage], {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 128 * 1024 * 1024,
|
||||
});
|
||||
if (tar.status !== 0) throw new Error(`tar_failed:${descriptor.component}:${tar.stderr || tar.stdout}`);
|
||||
|
||||
const sha256 = createHash("sha256").update(await readFile(artifact)).digest("hex");
|
||||
artifacts.push({
|
||||
artifact,
|
||||
component: descriptor.component,
|
||||
files: descriptor.files,
|
||||
patchId: descriptor.patchId,
|
||||
sha256,
|
||||
sourceCommit,
|
||||
});
|
||||
} finally {
|
||||
await rm(stage, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify({ ok: true, release, deployOrder: ["tasker", "ops-agents"], artifacts }, null, 2));
|
||||
|
||||
function gitOutput(cwd, args) {
|
||||
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
||||
if (result.status !== 0) throw new Error(`git_failed:${cwd}:${args.join("_")}:${result.stderr || result.stdout}`);
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
async function assertFresh(path) {
|
||||
try {
|
||||
await lstat(path);
|
||||
} catch (error) {
|
||||
if (error?.code === "ENOENT") return;
|
||||
throw error;
|
||||
}
|
||||
throw new Error(`output_already_exists:${path}`);
|
||||
}
|
||||
|
||||
function canonicalTarScript() {
|
||||
return [
|
||||
"import gzip,io,pathlib,sys,tarfile",
|
||||
"root=pathlib.Path(sys.argv[2])",
|
||||
"with open(sys.argv[1],'wb') as out:",
|
||||
" with gzip.GzipFile(filename='',mode='wb',fileobj=out,compresslevel=9,mtime=0) as gz:",
|
||||
" with tarfile.open(fileobj=gz,mode='w',format=tarfile.PAX_FORMAT) as tar:",
|
||||
" for top in ('manifest.env','files.txt','payload'):",
|
||||
" p=root/top; paths=[p]+(sorted(p.rglob('*')) if p.is_dir() else [])",
|
||||
" for x in paths:",
|
||||
" info=tar.gettarinfo(str(x),arcname=x.relative_to(root).as_posix())",
|
||||
" info.uid=info.gid=0; info.uname=info.gname='root'; info.mtime=0; info.mode=0o755 if info.isdir() else 0o644",
|
||||
" with (open(x,'rb') if info.isfile() else io.BytesIO()) as src: tar.addfile(info,src if info.isfile() else None)",
|
||||
].join("\n");
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import { createHash } from "node:crypto";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cp, lstat, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const platformRoot = resolve(scriptDir, "../..");
|
||||
const taskerRoot = resolve(
|
||||
process.env.NODEDC_TASKMANAGER_ROOT || resolve(platformRoot, "../../data/dc_taskmanager/NODEDC_TASKMANAGER"),
|
||||
);
|
||||
const opsAgentsRoot = resolve(
|
||||
process.env.NODEDC_OPS_AGENTS_ROOT || resolve(platformRoot, "../../data/NODEDC_TASKMANAGER_CODEXAPI"),
|
||||
);
|
||||
const artifactDir = resolve(process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(scriptDir, "../deploy-artifacts"));
|
||||
const [release = "20260822-003", ...extra] = process.argv.slice(2);
|
||||
|
||||
if (extra.length || release !== "20260822-003") {
|
||||
throw new Error("usage: build-tasker-ops-comments-read-artifacts.mjs [20260822-003]");
|
||||
}
|
||||
|
||||
const descriptors = [
|
||||
{
|
||||
artifactBasename: `nodedc-tasker-comments-read-${release}.tgz`,
|
||||
component: "tasker",
|
||||
expectedCommit: "7f97c21886ff7dff314db89aa1877e2113e5570b",
|
||||
files: [
|
||||
"plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py",
|
||||
],
|
||||
patchId: `tasker-comments-read-${release}`,
|
||||
sourceRoot: taskerRoot,
|
||||
},
|
||||
{
|
||||
artifactBasename: `nodedc-ops-agents-comments-read-${release}.tgz`,
|
||||
component: "ops-agents",
|
||||
expectedCommit: "6b63049d79eb975372d9f6a01cc32684563678a8",
|
||||
files: [
|
||||
"src/mcp/tool-runtime.ts",
|
||||
"src/routes/tools.ts",
|
||||
"src/tasker/client.ts",
|
||||
],
|
||||
patchId: `ops-agents-comments-read-${release}`,
|
||||
sourceRoot: opsAgentsRoot,
|
||||
},
|
||||
];
|
||||
|
||||
await mkdir(artifactDir, { recursive: true });
|
||||
const artifacts = [];
|
||||
|
||||
for (const descriptor of descriptors) {
|
||||
const sourceCommit = gitOutput(descriptor.sourceRoot, ["rev-parse", "HEAD"]);
|
||||
if (sourceCommit !== descriptor.expectedCommit) {
|
||||
throw new Error(`source_commit_mismatch:${descriptor.component}:${sourceCommit}`);
|
||||
}
|
||||
const sourceStatus = gitOutput(descriptor.sourceRoot, ["status", "--porcelain"]);
|
||||
if (sourceStatus) throw new Error(`source_worktree_not_clean:${descriptor.component}`);
|
||||
|
||||
const stage = await mkdtemp(join(tmpdir(), `nodedc-${descriptor.component}-comments-read-`));
|
||||
const payload = join(stage, "payload");
|
||||
const artifact = join(artifactDir, descriptor.artifactBasename);
|
||||
|
||||
try {
|
||||
await assertFresh(artifact);
|
||||
await mkdir(payload, { recursive: true });
|
||||
for (const relativePath of descriptor.files) {
|
||||
const source = resolve(descriptor.sourceRoot, relativePath);
|
||||
const sourceStat = await lstat(source);
|
||||
if (!sourceStat.isFile() || sourceStat.isSymbolicLink()) {
|
||||
throw new Error(`source_file_rejected:${descriptor.component}:${relativePath}`);
|
||||
}
|
||||
const destination = join(payload, relativePath);
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
await cp(source, destination, { force: false, verbatimSymlinks: true });
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
join(stage, "manifest.env"),
|
||||
`id=${descriptor.patchId}\ncomponent=${descriptor.component}\ntype=app-overlay\n`,
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(join(stage, "files.txt"), `${descriptor.files.join("\n")}\n`, "utf8");
|
||||
|
||||
const tar = spawnSync("python3", ["-c", canonicalTarScript(), artifact, stage], {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 128 * 1024 * 1024,
|
||||
});
|
||||
if (tar.status !== 0) throw new Error(`tar_failed:${descriptor.component}:${tar.stderr || tar.stdout}`);
|
||||
|
||||
const sha256 = createHash("sha256").update(await readFile(artifact)).digest("hex");
|
||||
artifacts.push({
|
||||
artifact,
|
||||
component: descriptor.component,
|
||||
files: descriptor.files,
|
||||
patchId: descriptor.patchId,
|
||||
sha256,
|
||||
sourceCommit,
|
||||
});
|
||||
} finally {
|
||||
await rm(stage, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify({ ok: true, release, deployOrder: ["tasker", "ops-agents"], artifacts }, null, 2));
|
||||
|
||||
function gitOutput(cwd, args) {
|
||||
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
||||
if (result.status !== 0) throw new Error(`git_failed:${cwd}:${args.join("_")}:${result.stderr || result.stdout}`);
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
async function assertFresh(path) {
|
||||
try {
|
||||
await lstat(path);
|
||||
} catch (error) {
|
||||
if (error?.code === "ENOENT") return;
|
||||
throw error;
|
||||
}
|
||||
throw new Error(`output_already_exists:${path}`);
|
||||
}
|
||||
|
||||
function canonicalTarScript() {
|
||||
return [
|
||||
"import gzip,io,pathlib,sys,tarfile",
|
||||
"root=pathlib.Path(sys.argv[2])",
|
||||
"with open(sys.argv[1],'wb') as out:",
|
||||
" with gzip.GzipFile(filename='',mode='wb',fileobj=out,compresslevel=9,mtime=0) as gz:",
|
||||
" with tarfile.open(fileobj=gz,mode='w',format=tarfile.PAX_FORMAT) as tar:",
|
||||
" for top in ('manifest.env','files.txt','payload'):",
|
||||
" p=root/top; paths=[p]+(sorted(p.rglob('*')) if p.is_dir() else [])",
|
||||
" for x in paths:",
|
||||
" info=tar.gettarinfo(str(x),arcname=x.relative_to(root).as_posix())",
|
||||
" info.uid=info.gid=0; info.uname=info.gname='root'; info.mtime=0; info.mode=0o755 if info.isdir() else 0o644",
|
||||
" with (open(x,'rb') if info.isfile() else io.BytesIO()) as src: tar.addfile(info,src if info.isfile() else None)",
|
||||
].join("\n");
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import inspect
|
||||
import json
|
||||
import stat
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -27,6 +29,617 @@ RUNNER = load_runner()
|
||||
|
||||
|
||||
class DevicePlaneRegistryTest(unittest.TestCase):
|
||||
def test_manager_v7_pins_v6_and_live_edge_host_projection(self):
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_PREDECESSOR_PATCH_ID,
|
||||
"device-manager-release-v6-20260822-035",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"193faabe930e2b3f212f8eb45288e39f850ec714528b28881095be654baf9a80",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_CONTROL_CORE_PREDECESSOR_PATCH_ID,
|
||||
"device-control-core-release-v2-20260822-036",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_CONTROL_CORE_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"8708cc4b59fa0cd5e9c6e6a7b2654ba01ea60271549167aca2631f94000d3da3",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_COMPOSE_SHA256,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_COMPOSE_SHA256,
|
||||
)
|
||||
boundaries = RUNNER.expected_device_plane_manager_release_v7_boundaries()
|
||||
self.assertEqual(
|
||||
boundaries["infrastructureHostProjection"],
|
||||
"edge-registration-live-channel-v1",
|
||||
)
|
||||
self.assertEqual(
|
||||
boundaries["ontologyStatus"],
|
||||
"generic-host-domain-candidate-not-canonical",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.component_services(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V7_ENTRIES,
|
||||
),
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
def test_manager_v6_pins_034_and_canonical_favicon_boundary(self):
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_PREDECESSOR_PATCH_ID,
|
||||
"device-manager-release-v5-20260822-034",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"acc1d2ae2cda66861054826928c25d01a2428e688cc8132a9c381831bf29ab5a",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_COMPOSE_SHA256,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_COMPOSE_SHA256,
|
||||
)
|
||||
boundaries = RUNNER.expected_device_plane_manager_release_v6_boundaries()
|
||||
self.assertEqual(boundaries["faviconSet"], "nodedc-adaptive-v1")
|
||||
self.assertEqual(
|
||||
boundaries["overviewLayout"],
|
||||
"mission-core-landing-stage-v1",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.component_services(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_ENTRIES,
|
||||
),
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
def test_manager_v5_pins_033_and_mission_core_overview_layout(self):
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_PREDECESSOR_PATCH_ID,
|
||||
"device-manager-release-v4-20260822-033",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"52ba322042f1e4f595bbfea99f8bb35630b15984e0da648dc55348bc9e5b2066",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_COMPOSE_SHA256,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V4_COMPOSE_SHA256,
|
||||
)
|
||||
boundaries = RUNNER.expected_device_plane_manager_release_v5_boundaries()
|
||||
self.assertEqual(
|
||||
boundaries["overviewLayout"],
|
||||
"mission-core-landing-stage-v1",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.component_services(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_ENTRIES,
|
||||
),
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
def test_manager_v4_pins_032_and_persistent_white_boundary(self):
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V4_PREDECESSOR_PATCH_ID,
|
||||
"device-manager-release-v3-20260822-032",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V4_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"6e0eb3a0a6f19ceab92d46832b93bffbcea21247dbdc2ea50625a51ff460e4ca",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V4_COMPOSE_SHA256,
|
||||
"e7dff0f5873ad4586bd55946d3db2bb86092a5e149e886d120adc041e056c256",
|
||||
)
|
||||
boundaries = RUNNER.expected_device_plane_manager_release_v4_boundaries()
|
||||
self.assertEqual(boundaries["defaultAccentHex"], "#f5f5f5")
|
||||
self.assertEqual(
|
||||
boundaries["presentationDataHostPath"],
|
||||
"/volume1/docker/nodedc-device-plane/data/device-manager",
|
||||
)
|
||||
self.assertEqual(
|
||||
boundaries["presentationDataContainerPath"],
|
||||
"/var/lib/nodedc-device-manager",
|
||||
)
|
||||
|
||||
def test_manager_v3_targets_applied_control_core_recovery(self):
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V3_CONTROL_CORE_PREDECESSOR_PATCH_ID,
|
||||
"device-control-core-release-v2-20260821-030",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V3_CONTROL_CORE_PREDECESSOR_ARTIFACT_SHA256,
|
||||
"8459521a662541a5a87cb0188991cdcfb51727427db8ec2a232ce4846bfc3454",
|
||||
)
|
||||
self.assertEqual(
|
||||
RUNNER.expected_device_plane_manager_release_v3_boundaries()[
|
||||
"controlCorePredecessor"
|
||||
],
|
||||
{
|
||||
"patchId": (
|
||||
"device-control-core-release-v2-20260821-030"
|
||||
),
|
||||
"artifactSha256": (
|
||||
"8459521a662541a5a87cb0188991cdcfb51727427db8ec2a232ce4846bfc3454"
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
def test_control_core_predecessor_health_is_phase_scoped(self):
|
||||
with self.assertRaisesRegex(
|
||||
RUNNER.DeployError,
|
||||
"preflight phase is invalid",
|
||||
):
|
||||
RUNNER.validate_device_plane_control_core_release_predecessor(
|
||||
Path("/not-used"),
|
||||
preflight_phase="unknown",
|
||||
)
|
||||
|
||||
plan_source = inspect.getsource(RUNNER.plan_artifact)
|
||||
self.assertIn(
|
||||
'validate_device_plane_control_core_release_predecessor(\n'
|
||||
' payload_dir,\n'
|
||||
' preflight_phase="plan",',
|
||||
plan_source,
|
||||
)
|
||||
apply_source = inspect.getsource(RUNNER.apply_artifact)
|
||||
self.assertIn(
|
||||
'validate_device_plane_control_core_release_predecessor(\n'
|
||||
' payload_dir,\n'
|
||||
' preflight_phase="apply",',
|
||||
apply_source,
|
||||
)
|
||||
|
||||
def test_control_core_preflight_health_excludes_selected_target(self):
|
||||
descriptor = {
|
||||
"preservedServices": [
|
||||
"device-manager",
|
||||
"device-gateway",
|
||||
"device-postgres",
|
||||
"device-backhaul-target",
|
||||
],
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service",
|
||||
) as healthcheck:
|
||||
services = (
|
||||
RUNNER.validate_device_plane_control_core_preserved_runtime_health(
|
||||
descriptor
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
services,
|
||||
(
|
||||
"device-manager",
|
||||
"device-gateway",
|
||||
"device-postgres",
|
||||
"device-backhaul-target",
|
||||
),
|
||||
)
|
||||
self.assertEqual(
|
||||
healthcheck.call_args_list,
|
||||
[
|
||||
mock.call("device-plane", "device-manager"),
|
||||
mock.call("device-plane", "device-gateway"),
|
||||
mock.call("device-plane", "device-postgres"),
|
||||
mock.call("device-plane", "device-backhaul-target"),
|
||||
],
|
||||
)
|
||||
self.assertNotIn(
|
||||
mock.call("device-plane", "device-control-core"),
|
||||
healthcheck.call_args_list,
|
||||
)
|
||||
|
||||
def test_control_core_selected_predecessor_may_be_unhealthy(self):
|
||||
inventory = {
|
||||
"schemaVersion": "nodedc.device-plane.runtime-inventory.v1",
|
||||
"composeProject": "nodedc-device-plane",
|
||||
"services": [{
|
||||
"service": "device-control-core",
|
||||
"containerId": "a" * 64,
|
||||
"imageId": "sha256:" + "b" * 64,
|
||||
"status": "running",
|
||||
"running": True,
|
||||
"health": "unhealthy",
|
||||
"restartCount": 4,
|
||||
}],
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"device_plane_runtime_inventory",
|
||||
return_value=inventory,
|
||||
):
|
||||
selected = (
|
||||
RUNNER.validate_device_plane_control_core_selected_predecessor_runtime()
|
||||
)
|
||||
self.assertEqual(selected["health"], "unhealthy")
|
||||
|
||||
def test_control_core_selected_predecessor_may_be_restarting(self):
|
||||
inventory = {
|
||||
"schemaVersion": "nodedc.device-plane.runtime-inventory.v1",
|
||||
"composeProject": "nodedc-device-plane",
|
||||
"services": [{
|
||||
"service": "device-control-core",
|
||||
"containerId": "a" * 64,
|
||||
"imageId": "sha256:" + "b" * 64,
|
||||
"status": "restarting",
|
||||
"running": True,
|
||||
"health": "starting",
|
||||
"restartCount": 5,
|
||||
}],
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"device_plane_runtime_inventory",
|
||||
return_value=inventory,
|
||||
):
|
||||
selected = (
|
||||
RUNNER.validate_device_plane_control_core_selected_predecessor_runtime()
|
||||
)
|
||||
self.assertEqual(selected["status"], "restarting")
|
||||
self.assertEqual(selected["health"], "starting")
|
||||
|
||||
def test_control_core_rollback_accepts_restored_unhealthy_boundary(self):
|
||||
service_names = (
|
||||
"device-control-core",
|
||||
"device-manager",
|
||||
"device-gateway",
|
||||
"device-postgres",
|
||||
"device-backhaul-target",
|
||||
)
|
||||
inventory = {
|
||||
"schemaVersion": "nodedc.device-plane.runtime-inventory.v1",
|
||||
"composeProject": "nodedc-device-plane",
|
||||
"services": [
|
||||
{
|
||||
"service": service,
|
||||
"containerId": chr(97 + index) * 64,
|
||||
"imageId": "sha256:" + str(index + 1) * 64,
|
||||
"status": "running",
|
||||
"running": True,
|
||||
"health": "unhealthy" if index == 0 else "healthy",
|
||||
"restartCount": index,
|
||||
}
|
||||
for index, service in enumerate(service_names)
|
||||
],
|
||||
}
|
||||
restored_id = "f" * 64
|
||||
restored = {
|
||||
"Id": restored_id,
|
||||
"State": {
|
||||
"Status": "running",
|
||||
"Running": True,
|
||||
"Health": {"Status": "unhealthy"},
|
||||
},
|
||||
}
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
) as preserved_health,
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"compose_service_container_id",
|
||||
return_value=restored_id,
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"inspect_device_plane_container",
|
||||
return_value=restored,
|
||||
),
|
||||
):
|
||||
accepted = (
|
||||
RUNNER.accept_device_plane_control_core_rollback_runtime(
|
||||
inventory
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(accepted["health"], "unhealthy")
|
||||
self.assertEqual(accepted["status"], "running")
|
||||
self.assertEqual(accepted["predecessorHealth"], "unhealthy")
|
||||
self.assertEqual(
|
||||
preserved_health.call_args_list,
|
||||
[
|
||||
mock.call("device-plane", "device-manager"),
|
||||
mock.call("device-plane", "device-gateway"),
|
||||
mock.call("device-plane", "device-postgres"),
|
||||
mock.call("device-plane", "device-backhaul-target"),
|
||||
],
|
||||
)
|
||||
|
||||
def test_control_core_post_apply_health_includes_backhaul(self):
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
) as healthcheck,
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"component_healthchecks",
|
||||
return_value=(),
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_manager_control_plane_runtime",
|
||||
),
|
||||
):
|
||||
RUNNER.run_healthchecks(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_CONTROL_CORE_RELEASE_V2_ENTRIES,
|
||||
("device-control-core",),
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
healthcheck.call_args_list,
|
||||
[
|
||||
mock.call("device-plane", "device-control-core"),
|
||||
mock.call("device-plane", "device-manager"),
|
||||
mock.call("device-plane", "device-gateway"),
|
||||
mock.call("device-plane", "device-postgres"),
|
||||
mock.call("device-plane", "device-backhaul-target"),
|
||||
],
|
||||
)
|
||||
|
||||
def test_manager_v3_post_apply_uses_private_egress_core_boundary(self):
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"component_healthchecks",
|
||||
return_value=(),
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_manager_control_plane_runtime",
|
||||
) as runtime_acceptance,
|
||||
):
|
||||
RUNNER.run_healthchecks(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V3_ENTRIES,
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
runtime_acceptance.assert_called_once_with(
|
||||
require_edge_channel=True,
|
||||
core_network_mode="private-egress",
|
||||
)
|
||||
|
||||
def test_manager_v4_post_apply_requires_persistent_data(self):
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"component_healthchecks",
|
||||
return_value=(),
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_manager_control_plane_runtime",
|
||||
) as runtime_acceptance,
|
||||
):
|
||||
RUNNER.run_healthchecks(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V4_ENTRIES,
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
runtime_acceptance.assert_called_once_with(
|
||||
require_edge_channel=True,
|
||||
core_network_mode="private-egress",
|
||||
require_persistent_data=True,
|
||||
)
|
||||
|
||||
def test_manager_v5_post_apply_preserves_persistent_data_gate(self):
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"component_healthchecks",
|
||||
return_value=(),
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_manager_control_plane_runtime",
|
||||
) as runtime_acceptance,
|
||||
):
|
||||
RUNNER.run_healthchecks(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_ENTRIES,
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
runtime_acceptance.assert_called_once_with(
|
||||
require_edge_channel=True,
|
||||
core_network_mode="private-egress",
|
||||
require_persistent_data=True,
|
||||
)
|
||||
|
||||
def test_manager_v6_post_apply_preserves_persistent_data_gate(self):
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service_with_grace",
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"component_healthchecks",
|
||||
return_value=(),
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_manager_control_plane_runtime",
|
||||
) as runtime_acceptance,
|
||||
):
|
||||
RUNNER.run_healthchecks(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V6_ENTRIES,
|
||||
("device-manager",),
|
||||
)
|
||||
|
||||
runtime_acceptance.assert_called_once_with(
|
||||
require_edge_channel=True,
|
||||
core_network_mode="private-egress",
|
||||
require_persistent_data=True,
|
||||
)
|
||||
|
||||
def test_manager_v4_prepare_owns_new_parent_and_managed_data_directory(self):
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="nodedc-manager-v4-data-",
|
||||
) as directory:
|
||||
data_dir = Path(directory) / "data" / "device-manager"
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"DEVICE_PLANE_MANAGER_DATA_DIR",
|
||||
data_dir,
|
||||
),
|
||||
mock.patch.object(RUNNER.os, "chown") as chown,
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_plane_manager_persistent_data_metadata",
|
||||
return_value="uid-1000-gid-1000-mode-0750",
|
||||
) as validate,
|
||||
):
|
||||
result = RUNNER.ensure_device_plane_manager_persistent_data()
|
||||
|
||||
self.assertEqual(result, "uid-1000-gid-1000-mode-0750")
|
||||
self.assertEqual(
|
||||
chown.call_args_list,
|
||||
[
|
||||
mock.call(data_dir.parent, 0, 0),
|
||||
mock.call(data_dir, 1000, 1000),
|
||||
],
|
||||
)
|
||||
validate.assert_called_once_with()
|
||||
|
||||
def test_manager_v4_prepare_preserves_existing_safe_parent_metadata(self):
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="nodedc-manager-v4-parent-",
|
||||
) as directory:
|
||||
data_parent = Path(directory) / "data"
|
||||
data_parent.mkdir(mode=0o700)
|
||||
data_dir = data_parent / "device-manager"
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"DEVICE_PLANE_MANAGER_DATA_DIR",
|
||||
data_dir,
|
||||
),
|
||||
mock.patch.object(RUNNER.os, "chown") as chown,
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"validate_device_plane_manager_persistent_data_metadata",
|
||||
return_value="uid-1000-gid-1000-mode-0750",
|
||||
),
|
||||
):
|
||||
RUNNER.ensure_device_plane_manager_persistent_data()
|
||||
|
||||
self.assertEqual(stat.S_IMODE(data_parent.stat().st_mode), 0o700)
|
||||
chown.assert_called_once_with(data_dir, 1000, 1000)
|
||||
|
||||
def test_manager_v4_prepare_rejects_symlink_parent_before_child_creation(self):
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="nodedc-manager-v4-symlink-",
|
||||
) as directory:
|
||||
root = Path(directory)
|
||||
outside = root / "outside"
|
||||
outside.mkdir()
|
||||
data_parent = root / "data"
|
||||
data_parent.symlink_to(outside, target_is_directory=True)
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"DEVICE_PLANE_MANAGER_DATA_DIR",
|
||||
data_parent / "device-manager",
|
||||
):
|
||||
with self.assertRaisesRegex(
|
||||
RUNNER.DeployError,
|
||||
"persistent data parent is unsafe",
|
||||
):
|
||||
RUNNER.ensure_device_plane_manager_persistent_data()
|
||||
self.assertFalse((outside / "device-manager").exists())
|
||||
|
||||
def test_manager_predecessor_health_is_phase_scoped(self):
|
||||
with self.assertRaisesRegex(
|
||||
RUNNER.DeployError,
|
||||
"preflight phase is invalid",
|
||||
):
|
||||
RUNNER.validate_device_plane_manager_activation_predecessor(
|
||||
Path("/not-used"),
|
||||
preflight_phase="unknown",
|
||||
)
|
||||
|
||||
plan_source = inspect.getsource(RUNNER.plan_artifact)
|
||||
self.assertIn('preflight_phase="plan"', plan_source)
|
||||
apply_source = inspect.getsource(RUNNER.apply_artifact)
|
||||
self.assertIn('preflight_phase="apply"', apply_source)
|
||||
|
||||
def test_manager_v3_health_gate_checks_only_preserved_services(self):
|
||||
descriptor = {
|
||||
"schemaVersion": (
|
||||
"nodedc.device-plane.device-manager-release.v3"
|
||||
),
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service",
|
||||
) as healthcheck:
|
||||
services = (
|
||||
RUNNER.validate_device_plane_manager_preserved_runtime_health(
|
||||
descriptor
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
services,
|
||||
("device-control-core", "device-postgres"),
|
||||
)
|
||||
self.assertEqual(
|
||||
healthcheck.call_args_list,
|
||||
[
|
||||
mock.call("device-plane", "device-control-core"),
|
||||
mock.call("device-plane", "device-postgres"),
|
||||
],
|
||||
)
|
||||
self.assertNotIn(
|
||||
mock.call("device-plane", "device-manager"),
|
||||
healthcheck.call_args_list,
|
||||
)
|
||||
|
||||
def test_legacy_manager_health_gate_excludes_selected_services(self):
|
||||
descriptor = {
|
||||
"schemaVersion": (
|
||||
"nodedc.device-plane.device-manager-release.v2"
|
||||
),
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service",
|
||||
) as healthcheck:
|
||||
services = (
|
||||
RUNNER.validate_device_plane_manager_preserved_runtime_health(
|
||||
descriptor
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(services, ("device-postgres",))
|
||||
healthcheck.assert_called_once_with(
|
||||
"device-plane",
|
||||
"device-postgres",
|
||||
)
|
||||
|
||||
def test_registry_has_exact_roots_project_and_stateless_services(self):
|
||||
component = RUNNER.COMPONENTS["device-plane"]
|
||||
root = Path("/volume1/docker/nodedc-device-plane")
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
PLATFORM_ROOT = SCRIPT_DIR.parent.parent
|
||||
BUILDER_PATH = SCRIPT_DIR / "build-tasker-comments-route-diagnostics-artifact.mjs"
|
||||
RUNNER_PATH = SCRIPT_DIR / "nodedc-deploy"
|
||||
RELEASE = "20260821-002"
|
||||
|
||||
|
||||
def load_runner():
|
||||
loader = importlib.machinery.SourceFileLoader("nodedc_comments_route_diagnostics_runner", str(RUNNER_PATH))
|
||||
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
RUNNER = load_runner()
|
||||
|
||||
|
||||
class TaskerCommentsRouteDiagnosticsArtifactTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.temporary = tempfile.TemporaryDirectory(prefix="nodedc-comments-route-diagnostics-")
|
||||
cls.results = []
|
||||
for index in range(2):
|
||||
output = Path(cls.temporary.name) / f"build-{index}"
|
||||
output.mkdir()
|
||||
env = os.environ.copy()
|
||||
env["NODEDC_DEPLOY_ARTIFACT_DIR"] = str(output)
|
||||
result = subprocess.run(
|
||||
["node", str(BUILDER_PATH), RELEASE],
|
||||
cwd=PLATFORM_ROOT,
|
||||
env=env,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
cls.results.append(json.loads(result.stdout))
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.temporary.cleanup()
|
||||
|
||||
def test_artifact_is_reproducible_and_runner_accepted(self):
|
||||
first = self.results[0]
|
||||
second = self.results[1]
|
||||
first_path = Path(first["artifact"])
|
||||
second_path = Path(second["artifact"])
|
||||
first_bytes = first_path.read_bytes()
|
||||
self.assertEqual(first_bytes, second_path.read_bytes())
|
||||
self.assertEqual(first_bytes[4:8], bytes(4))
|
||||
self.assertEqual(first["sha256"], hashlib.sha256(first_bytes).hexdigest())
|
||||
self.assertEqual(first["sourceCommit"], "0df65d85dd8a04f2d2532235d482864a6f6cfd3d")
|
||||
self.assertEqual(
|
||||
first["files"],
|
||||
["plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py"],
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
manifest, entries, payload = RUNNER.load_artifact(first_path, Path(directory))
|
||||
self.assertEqual(manifest["component"], "tasker")
|
||||
self.assertEqual(manifest["id"], first["patchId"])
|
||||
self.assertEqual(entries, first["files"])
|
||||
self.assertTrue((payload / first["files"][0]).is_file())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
@@ -1,100 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
PLATFORM_ROOT = SCRIPT_DIR.parent.parent
|
||||
BUILDER_PATH = SCRIPT_DIR / "build-tasker-ops-comments-inventory-artifacts.mjs"
|
||||
RUNNER_PATH = SCRIPT_DIR / "nodedc-deploy"
|
||||
RELEASE = "20260821-001"
|
||||
|
||||
|
||||
def load_runner():
|
||||
loader = importlib.machinery.SourceFileLoader("nodedc_comments_inventory_runner", str(RUNNER_PATH))
|
||||
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
RUNNER = load_runner()
|
||||
|
||||
|
||||
class TaskerOpsCommentsInventoryArtifactTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.temporary = tempfile.TemporaryDirectory(prefix="nodedc-comments-inventory-")
|
||||
cls.root = Path(cls.temporary.name)
|
||||
cls.builds = []
|
||||
for index in range(2):
|
||||
output = cls.root / f"build-{index}"
|
||||
output.mkdir()
|
||||
env = os.environ.copy()
|
||||
env["NODEDC_DEPLOY_ARTIFACT_DIR"] = str(output)
|
||||
result = subprocess.run(
|
||||
["node", str(BUILDER_PATH), RELEASE],
|
||||
cwd=PLATFORM_ROOT,
|
||||
env=env,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
cls.builds.append(json.loads(result.stdout))
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.temporary.cleanup()
|
||||
|
||||
def artifact(self, build_index, component):
|
||||
return next(item for item in self.builds[build_index]["artifacts"] if item["component"] == component)
|
||||
|
||||
def test_artifacts_are_reproducible_and_runner_accepted(self):
|
||||
self.assertEqual(self.builds[0]["deployOrder"], ["tasker", "ops-agents"])
|
||||
for component in ("tasker", "ops-agents"):
|
||||
first = self.artifact(0, component)
|
||||
second = self.artifact(1, component)
|
||||
first_path = Path(first["artifact"])
|
||||
second_path = Path(second["artifact"])
|
||||
first_bytes = first_path.read_bytes()
|
||||
self.assertEqual(first_bytes, second_path.read_bytes())
|
||||
self.assertEqual(first_bytes[4:8], bytes(4))
|
||||
self.assertEqual(first["sha256"], hashlib.sha256(first_bytes).hexdigest())
|
||||
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
manifest, entries, payload = RUNNER.load_artifact(first_path, Path(directory))
|
||||
self.assertEqual(manifest["component"], component)
|
||||
self.assertEqual(manifest["id"], first["patchId"])
|
||||
self.assertEqual(entries, first["files"])
|
||||
for relative_path in entries:
|
||||
self.assertTrue((payload / relative_path).is_file())
|
||||
|
||||
def test_tasker_overlay_contains_only_comment_audit_runtime(self):
|
||||
tasker = self.artifact(0, "tasker")
|
||||
self.assertEqual(tasker["sourceCommit"], "42988b9cbea0a9a0b85a817c2dcb5b396aeda197")
|
||||
self.assertEqual(
|
||||
set(tasker["files"]),
|
||||
{
|
||||
"plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py",
|
||||
"plane-src/apps/api/plane/urls.py",
|
||||
},
|
||||
)
|
||||
|
||||
def test_ops_agents_overlay_contains_only_comment_audit_runtime(self):
|
||||
ops_agents = self.artifact(0, "ops-agents")
|
||||
self.assertEqual(ops_agents["sourceCommit"], "d4fea6b29001df10444cae2ea95bc8259b22c763")
|
||||
self.assertEqual(
|
||||
set(ops_agents["files"]),
|
||||
{"src/mcp/tool-runtime.ts", "src/routes/tools.ts", "src/tasker/client.ts"},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
PLATFORM_ROOT = SCRIPT_DIR.parent.parent
|
||||
BUILDER_PATH = SCRIPT_DIR / "build-tasker-ops-comments-read-artifacts.mjs"
|
||||
RUNNER_PATH = SCRIPT_DIR / "nodedc-deploy"
|
||||
RELEASE = "20260822-003"
|
||||
|
||||
|
||||
def load_runner():
|
||||
loader = importlib.machinery.SourceFileLoader("nodedc_comments_read_runner", str(RUNNER_PATH))
|
||||
spec = importlib.util.spec_from_loader(loader.name, loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
RUNNER = load_runner()
|
||||
|
||||
|
||||
class TaskerOpsCommentsReadArtifactTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.temporary = tempfile.TemporaryDirectory(prefix="nodedc-comments-read-")
|
||||
cls.root = Path(cls.temporary.name)
|
||||
cls.builds = []
|
||||
for index in range(2):
|
||||
output = cls.root / f"build-{index}"
|
||||
output.mkdir()
|
||||
env = os.environ.copy()
|
||||
env["NODEDC_DEPLOY_ARTIFACT_DIR"] = str(output)
|
||||
result = subprocess.run(
|
||||
["node", str(BUILDER_PATH), RELEASE],
|
||||
cwd=PLATFORM_ROOT,
|
||||
env=env,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
cls.builds.append(json.loads(result.stdout))
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.temporary.cleanup()
|
||||
|
||||
def artifact(self, build_index, component):
|
||||
return next(item for item in self.builds[build_index]["artifacts"] if item["component"] == component)
|
||||
|
||||
def test_artifacts_are_reproducible_and_runner_accepted(self):
|
||||
self.assertEqual(self.builds[0]["deployOrder"], ["tasker", "ops-agents"])
|
||||
for component in ("tasker", "ops-agents"):
|
||||
first = self.artifact(0, component)
|
||||
second = self.artifact(1, component)
|
||||
first_path = Path(first["artifact"])
|
||||
second_path = Path(second["artifact"])
|
||||
first_bytes = first_path.read_bytes()
|
||||
self.assertEqual(first_bytes, second_path.read_bytes())
|
||||
self.assertEqual(first_bytes[4:8], bytes(4))
|
||||
self.assertEqual(first["sha256"], hashlib.sha256(first_bytes).hexdigest())
|
||||
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
manifest, entries, payload = RUNNER.load_artifact(first_path, Path(directory))
|
||||
self.assertEqual(manifest["component"], component)
|
||||
self.assertEqual(manifest["id"], first["patchId"])
|
||||
self.assertEqual(entries, first["files"])
|
||||
for relative_path in entries:
|
||||
self.assertTrue((payload / relative_path).is_file())
|
||||
|
||||
def test_tasker_overlay_contains_only_active_comment_reader(self):
|
||||
tasker = self.artifact(0, "tasker")
|
||||
self.assertEqual(tasker["sourceCommit"], "7f97c21886ff7dff314db89aa1877e2113e5570b")
|
||||
self.assertEqual(
|
||||
tasker["files"],
|
||||
["plane-src/apps/api/plane/authentication/views/nodedc_agent_adapter.py"],
|
||||
)
|
||||
|
||||
def test_ops_agents_overlay_contains_only_active_comment_reader(self):
|
||||
ops_agents = self.artifact(0, "ops-agents")
|
||||
self.assertEqual(ops_agents["sourceCommit"], "6b63049d79eb975372d9f6a01cc32684563678a8")
|
||||
self.assertEqual(
|
||||
set(ops_agents["files"]),
|
||||
{"src/mcp/tool-runtime.ts", "src/routes/tools.ts", "src/tasker/client.ts"},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
Reference in New Issue
Block a user