Compare commits
2 Commits
59f9fc2b26
...
f02a1d4125
| Author | SHA1 | Date |
|---|---|---|
|
|
f02a1d4125 | |
|
|
73364b4acb |
|
|
@ -0,0 +1,268 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
import { createHash } from "node:crypto";
|
||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
import {
|
||||||
|
copyFile,
|
||||||
|
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 here = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const workspaceRoot = resolve(here, "../../..");
|
||||||
|
const engineRoot = resolve(
|
||||||
|
process.env.NODEDC_ENGINE_SOURCE_ROOT || join(workspaceRoot, "NODEDC_ENGINE_INFRA"),
|
||||||
|
);
|
||||||
|
const artifactRoot = resolve(
|
||||||
|
process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(here, "../deploy-artifacts"),
|
||||||
|
);
|
||||||
|
const descriptorPath =
|
||||||
|
"nodedc-source/server/deployTransitions/executionPlanModuleOwnershipV3.json";
|
||||||
|
const activationPath =
|
||||||
|
"nodedc-source/services/node-intelligence/activation.json";
|
||||||
|
const targetSha256 = Object.freeze({
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js":
|
||||||
|
"dabf0073520049d7a04d1962b29e591ae092b87b287a50534ad2d98b03ae683c",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js":
|
||||||
|
"17c5f502b3ceacc45278eef7418d08e1e55a8b3e46e00942e559d25566fdba41",
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"7e34b93aa30b06cd52853b48013baef2970cc27e4fddc333a1011dc73ea8c08a",
|
||||||
|
[descriptorPath]:
|
||||||
|
"d187d539a219fec453e06c55c3f5486ef66059371b4ae9b145266307b2af9889",
|
||||||
|
[activationPath]:
|
||||||
|
"4cdeb85ebb2e43f088f095f75b7fc31aabd8ab81c8ac96ded4aafd7dbd8e30bd",
|
||||||
|
});
|
||||||
|
const entries = Object.freeze(Object.keys(targetSha256));
|
||||||
|
const [patchId = "", ...extra] = process.argv.slice(2);
|
||||||
|
if (
|
||||||
|
extra.length
|
||||||
|
|| !/^engine-mcp-execution-plan-module-ownership-\d{8}-\d{3}$/.test(patchId)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"usage: build-engine-mcp-execution-plan-module-ownership-artifact.mjs "
|
||||||
|
+ "<engine-mcp-execution-plan-module-ownership-YYYYMMDD-NNN>",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const artifact = join(artifactRoot, `nodedc-${patchId}.tgz`);
|
||||||
|
|
||||||
|
await assertFresh(artifact);
|
||||||
|
await assertExactSources();
|
||||||
|
const stage = await mkdtemp(
|
||||||
|
join(tmpdir(), "nodedc-engine-mcp-execution-plan-module-ownership-"),
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
const payload = join(stage, "payload");
|
||||||
|
for (const relativePath of entries) {
|
||||||
|
const destination = join(payload, relativePath);
|
||||||
|
await mkdir(dirname(destination), { recursive: true });
|
||||||
|
await copyFile(join(engineRoot, relativePath), destination);
|
||||||
|
}
|
||||||
|
await writeFile(
|
||||||
|
join(stage, "manifest.env"),
|
||||||
|
`id=${patchId}\ncomponent=engine\ntype=app-overlay\n`,
|
||||||
|
{ encoding: "utf8", flag: "wx", mode: 0o644 },
|
||||||
|
);
|
||||||
|
await writeFile(join(stage, "files.txt"), `${entries.join("\n")}\n`, {
|
||||||
|
encoding: "utf8",
|
||||||
|
flag: "wx",
|
||||||
|
mode: 0o644,
|
||||||
|
});
|
||||||
|
await mkdir(artifactRoot, { recursive: true });
|
||||||
|
run("python3", ["-c", canonicalTarScript(), artifact, stage]);
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
ok: true,
|
||||||
|
patchId,
|
||||||
|
artifact,
|
||||||
|
sha256: digest(await readFile(artifact)),
|
||||||
|
entries,
|
||||||
|
targetSha256,
|
||||||
|
services: ["nodedc-backend"],
|
||||||
|
transition: "execution-plan-telemetry-runtime-v2-to-module-ownership-v3",
|
||||||
|
mcpVersion: "0.10.0",
|
||||||
|
mcpSurface: "external-codex",
|
||||||
|
compilerVersions: ["1.1.0", "1.2.0"],
|
||||||
|
materializationStrategies: [
|
||||||
|
"create_or_reconcile_owned",
|
||||||
|
"adopt_existing",
|
||||||
|
"adopt_existing_module",
|
||||||
|
],
|
||||||
|
moduleOwnership: {
|
||||||
|
nodeBindings: "exact-one-to-one",
|
||||||
|
retireBoundary: "closed",
|
||||||
|
sharedManualWebhook: "compatible-existing-configuration-preserved",
|
||||||
|
providerCredentialNodes: "engine-managed",
|
||||||
|
publisherNodes: "engine-managed",
|
||||||
|
},
|
||||||
|
providerPackage: {
|
||||||
|
added: "gelios.provider.v9",
|
||||||
|
legacyPreserved: "gelios.provider.v8",
|
||||||
|
},
|
||||||
|
untouched: [
|
||||||
|
"live L2 graphs",
|
||||||
|
"n8n workflow data",
|
||||||
|
"L1",
|
||||||
|
"Engine UI",
|
||||||
|
"node-intelligence image",
|
||||||
|
"databases",
|
||||||
|
"credentials",
|
||||||
|
"MCP Nginx",
|
||||||
|
"embedded AI Workspace",
|
||||||
|
],
|
||||||
|
}, null, 2));
|
||||||
|
} finally {
|
||||||
|
await rm(stage, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function assertExactSources() {
|
||||||
|
for (const [relativePath, expected] of Object.entries(targetSha256)) {
|
||||||
|
const sourcePath = join(engineRoot, relativePath);
|
||||||
|
const info = await lstat(sourcePath);
|
||||||
|
if (!info.isFile() || info.isSymbolicLink()) {
|
||||||
|
throw new Error(
|
||||||
|
`engine_mcp_execution_plan_module_ownership_source_unsafe:${relativePath}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const actual = digest(await readFile(sourcePath));
|
||||||
|
if (actual !== expected) {
|
||||||
|
throw new Error(
|
||||||
|
`engine_mcp_execution_plan_module_ownership_target_mismatch:${relativePath}:`
|
||||||
|
+ `expected=${expected}:actual=${actual}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const materializer = await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/l2ExecutionPlan/materializer.js"),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
for (const marker of [
|
||||||
|
"nodedc.engine.materialized-execution-plan-module/v1",
|
||||||
|
"adopt_existing_module",
|
||||||
|
"preserveBoundNodeIds",
|
||||||
|
"execution_plan_module_retire_boundary_not_closed",
|
||||||
|
"manual_webhook_same_method",
|
||||||
|
]) {
|
||||||
|
if (!materializer.includes(marker)) {
|
||||||
|
throw new Error(
|
||||||
|
`engine_mcp_execution_plan_module_ownership_marker_missing:${marker}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (/gelios|robot2b/i.test(materializer)) {
|
||||||
|
throw new Error("engine_mcp_execution_plan_module_ownership_provider_hardcode");
|
||||||
|
}
|
||||||
|
|
||||||
|
const gateway = await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/routes/engineAgentGateway.js"),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
!gateway.includes("const ENGINE_AGENT_MCP_VERSION = '0.10.0'")
|
||||||
|
|| !gateway.includes("preserveBoundNodeIds")
|
||||||
|
|| !gateway.includes("adopt_existing_module")
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_gateway_contract_mismatch",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const catalog = JSON.parse(await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/assets/execution-plans/v1/catalog.json"),
|
||||||
|
"utf8",
|
||||||
|
));
|
||||||
|
const geliosV9 = catalog?.packages?.find(
|
||||||
|
(providerPackage) => providerPackage?.id === "gelios.provider.v9",
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
geliosV9?.contractDigest
|
||||||
|
!== "sha256:7dd4ce4a45ce76e884ffa1e304bfaa521f552e9a45e535930f2d17b882ae23ed"
|
||||||
|
|| !catalog?.packages?.some(
|
||||||
|
(providerPackage) => providerPackage?.id === "gelios.provider.v8",
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_catalog_contract_mismatch",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const descriptor = JSON.parse(
|
||||||
|
await readFile(join(engineRoot, descriptorPath), "utf8"),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
descriptor?.schemaVersion !== "nodedc.engine.deploy-transition/v1"
|
||||||
|
|| descriptor?.id !== "engine-mcp-l2-execution-plan-module-ownership-v3"
|
||||||
|
|| descriptor?.mcpVersion !== "0.10.0"
|
||||||
|
|| descriptor?.moduleOwnership?.adoptionStrategy !== "adopt_existing_module"
|
||||||
|
|| descriptor?.sharedBoundary?.configurationAuthority !== "existing-graph"
|
||||||
|
|| descriptor?.providerPackageTrust?.addedPackageId !== "gelios.provider.v9"
|
||||||
|
|| descriptor?.providerPackageTrust?.legacyPackagePreserved !== true
|
||||||
|
|| descriptor?.engineProviderHardcode !== false
|
||||||
|
|| descriptor?.embeddedCodexChanged !== false
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_descriptor_contract_mismatch",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const activation = JSON.parse(
|
||||||
|
await readFile(join(engineRoot, activationPath), "utf8"),
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
activation?.action !== "activate"
|
||||||
|
|| activation?.releaseId !== "2.33.2-974a9fb3492f"
|
||||||
|
|| activation?.source?.gatewaySha256
|
||||||
|
!== targetSha256["nodedc-source/server/routes/engineAgentGateway.js"]
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_activation_contract_mismatch",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function assertFresh(path) {
|
||||||
|
try {
|
||||||
|
await lstat(path);
|
||||||
|
} catch (error) {
|
||||||
|
if (error?.code === "ENOENT") return;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
throw new Error("artifact_already_exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
function canonicalTarScript() {
|
||||||
|
return [
|
||||||
|
"import gzip,io,pathlib,sys,tarfile",
|
||||||
|
"root=pathlib.Path(sys.argv[2])",
|
||||||
|
"with open(sys.argv[1],'xb') 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");
|
||||||
|
}
|
||||||
|
|
||||||
|
function digest(value) {
|
||||||
|
return createHash("sha256").update(value).digest("hex");
|
||||||
|
}
|
||||||
|
|
||||||
|
function run(command, args) {
|
||||||
|
const result = spawnSync(command, args, {
|
||||||
|
encoding: "utf8",
|
||||||
|
maxBuffer: 128 * 1024 * 1024,
|
||||||
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
|
});
|
||||||
|
if (result.status !== 0) {
|
||||||
|
throw new Error(`${command}_failed:${result.stderr || result.stdout}`);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -651,6 +651,53 @@ ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_TARGET_SHA256 = {
|
||||||
ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_NEW_PATHS = (
|
ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_NEW_PATHS = (
|
||||||
ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_DESCRIPTOR_REL,
|
ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_DESCRIPTOR_REL,
|
||||||
)
|
)
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_DESCRIPTOR_REL = (
|
||||||
|
"nodedc-source/server/deployTransitions/executionPlanModuleOwnershipV3.json"
|
||||||
|
)
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES = (
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js",
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_DESCRIPTOR_REL,
|
||||||
|
ENGINE_NODE_INTELLIGENCE_DESCRIPTOR_REL,
|
||||||
|
)
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_PREDECESSOR_SHA256 = {
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js":
|
||||||
|
"ee3bcfd06b3a5fa46800df974a2dedfdd55eeaf662329f837486c011a9bd713e",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js":
|
||||||
|
"9020cf49a3558c0497fed4ecfd81367cbc11b5b249881804c29fe437900c71f8",
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"5bdfc92284a7c836ff326e3a89b559110e376b32efd34b5f23f2bec272745781",
|
||||||
|
ENGINE_NODE_INTELLIGENCE_DESCRIPTOR_REL:
|
||||||
|
"03b2ba120c3929e9cf99940ddc927082de376ceff762895a84103144202aef42",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256 = {
|
||||||
|
"nodedc-source/server/routes/n8n.js":
|
||||||
|
"391fc81228fdacd6efc6c0868991a3485f71869708e49ac15819db6ccce1bfce",
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/catalog.js":
|
||||||
|
"c35b4c7ad9319aabbf1366a11ff52a6e99d961893bafdfcb4e84fc5f24fc04be",
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/compiler.js":
|
||||||
|
"6b783ad15c26dc7de0645082c8a426002d943138c70bf31a240247b16a33b6a0",
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MATERIALIZATION_DESCRIPTOR_REL:
|
||||||
|
"52c0152cff49c251be5581a9209d2e63ba710c16e815bdd6ece24f7c9dd7e480",
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_TELEMETRY_RUNTIME_DESCRIPTOR_REL:
|
||||||
|
"68b275efb6303284336d8b637c966c24d891a4bd0b3fec4fb83247359929ef79",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256 = {
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js":
|
||||||
|
"dabf0073520049d7a04d1962b29e591ae092b87b287a50534ad2d98b03ae683c",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js":
|
||||||
|
"17c5f502b3ceacc45278eef7418d08e1e55a8b3e46e00942e559d25566fdba41",
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"7e34b93aa30b06cd52853b48013baef2970cc27e4fddc333a1011dc73ea8c08a",
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_DESCRIPTOR_REL:
|
||||||
|
"d187d539a219fec453e06c55c3f5486ef66059371b4ae9b145266307b2af9889",
|
||||||
|
ENGINE_NODE_INTELLIGENCE_DESCRIPTOR_REL:
|
||||||
|
"4cdeb85ebb2e43f088f095f75b7fc31aabd8ab81c8ac96ded4aafd7dbd8e30bd",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS = (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_DESCRIPTOR_REL,
|
||||||
|
)
|
||||||
ENGINE_AGENT_FULL_GRANT_MIGRATION_ARTIFACT_ENTRIES = (
|
ENGINE_AGENT_FULL_GRANT_MIGRATION_ARTIFACT_ENTRIES = (
|
||||||
ENGINE_AGENT_FULL_GRANT_MIGRATION_STORE_REL,
|
ENGINE_AGENT_FULL_GRANT_MIGRATION_STORE_REL,
|
||||||
)
|
)
|
||||||
|
|
@ -3350,6 +3397,7 @@ def validate_engine_node_intelligence_transition(payload_dir, entries):
|
||||||
"const ENGINE_AGENT_MCP_VERSION = '0.7.0'",
|
"const ENGINE_AGENT_MCP_VERSION = '0.7.0'",
|
||||||
"const ENGINE_AGENT_MCP_VERSION = '0.8.0'",
|
"const ENGINE_AGENT_MCP_VERSION = '0.8.0'",
|
||||||
"const ENGINE_AGENT_MCP_VERSION = '0.9.0'",
|
"const ENGINE_AGENT_MCP_VERSION = '0.9.0'",
|
||||||
|
"const ENGINE_AGENT_MCP_VERSION = '0.10.0'",
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
die("Engine node-intelligence gateway MCP version is not registered")
|
die("Engine node-intelligence gateway MCP version is not registered")
|
||||||
|
|
@ -4583,6 +4631,54 @@ process.stdout.write('engine-mcp-execution-plan-telemetry-runtime:0.9.0:compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def accept_engine_mcp_execution_plan_module_ownership_runtime():
|
||||||
|
root = component_root("engine")
|
||||||
|
validate_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
root,
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES,
|
||||||
|
)
|
||||||
|
live = run_engine_backend_probe(
|
||||||
|
(
|
||||||
|
"node",
|
||||||
|
"--input-type=module",
|
||||||
|
"-e",
|
||||||
|
"""
|
||||||
|
const fs=await import('node:fs/promises');
|
||||||
|
const gateway=await import('file:///app/server/routes/engineAgentGateway.js');
|
||||||
|
const catalogModule=await import('file:///app/server/l2ExecutionPlan/catalog.js');
|
||||||
|
const materializer=await import('file:///app/server/l2ExecutionPlan/materializer.js');
|
||||||
|
const catalog=await catalogModule.loadExecutionPlanCatalog();
|
||||||
|
const source=await fs.readFile('/app/server/l2ExecutionPlan/materializer.js','utf8');
|
||||||
|
const plan=gateway.engineAgentTools.find((item)=>item.name==='engine_plan_l2_execution_plan_materialization');
|
||||||
|
const strategies=plan?.inputSchema?.properties?.strategy?.enum||[];
|
||||||
|
const adoption=plan?.inputSchema?.properties?.moduleAdoption?.properties||{};
|
||||||
|
const geliosV9=catalog.packages?.find((item)=>item.id==='gelios.provider.v9');
|
||||||
|
const legacy=catalog.packages?.some((item)=>item.id==='gelios.provider.v8');
|
||||||
|
const unmanaged=materializer.materializationState({source:{},nodes:[{id:'existing'}],edges:[]});
|
||||||
|
if(gateway.ENGINE_AGENT_MCP_VERSION!=='0.10.0'||strategies.join(',')!=='create_or_reconcile_owned,adopt_existing,adopt_existing_module'||!adoption.preserveBoundNodeIds||!source.includes('execution_plan_module_retire_boundary_not_closed')||!source.includes('manual_webhook_same_method')||/gelios|robot2b/i.test(source)||geliosV9?.contractDigest!=='sha256:7dd4ce4a45ce76e884ffa1e304bfaa521f552e9a45e535930f2d17b882ae23ed'||!legacy||unmanaged!=='unmanaged_existing')process.exit(2);
|
||||||
|
process.stdout.write('engine-mcp-execution-plan-module-ownership:0.10.0:module-scoped:shared-boundary:v3');
|
||||||
|
""".strip(),
|
||||||
|
),
|
||||||
|
"Engine MCP execution plan module ownership",
|
||||||
|
container_id=engine_backend_container_id(),
|
||||||
|
)
|
||||||
|
expected = (
|
||||||
|
"engine-mcp-execution-plan-module-ownership:"
|
||||||
|
"0.10.0:module-scoped:shared-boundary:v3"
|
||||||
|
)
|
||||||
|
if live != expected:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership live acceptance "
|
||||||
|
"mismatch"
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"target_sha256": dict(
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"live": live,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def validate_no_lifecycle_scripts(payload_dir, label):
|
def validate_no_lifecycle_scripts(payload_dir, label):
|
||||||
forbidden = ("preinstall", "install", "postinstall", "prepare", "prepack", "postpack")
|
forbidden = ("preinstall", "install", "postinstall", "prepare", "prepack", "postpack")
|
||||||
for package_path in payload_dir.rglob("package.json"):
|
for package_path in payload_dir.rglob("package.json"):
|
||||||
|
|
@ -5569,6 +5665,157 @@ def validate_engine_mcp_execution_plan_telemetry_runtime_slice(
|
||||||
die("Engine MCP execution plan telemetry runtime contains provider hardcode")
|
die("Engine MCP execution plan telemetry runtime contains provider hardcode")
|
||||||
|
|
||||||
|
|
||||||
|
def validate_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
payload_dir,
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
if (
|
||||||
|
tuple(entries)
|
||||||
|
!= ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership files.txt exact "
|
||||||
|
"set/order mismatch"
|
||||||
|
)
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256.items()
|
||||||
|
):
|
||||||
|
path = payload_dir / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership target is "
|
||||||
|
f"missing: {rel}"
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
stat.S_ISLNK(path_stat.st_mode)
|
||||||
|
or not stat.S_ISREG(path_stat.st_mode)
|
||||||
|
or sha256_file(path) != expected_sha256
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership target sha256 "
|
||||||
|
f"mismatch: {rel}"
|
||||||
|
)
|
||||||
|
descriptor = read_strict_json(
|
||||||
|
payload_dir
|
||||||
|
/ ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_DESCRIPTOR_REL,
|
||||||
|
"Engine MCP execution plan module ownership descriptor",
|
||||||
|
max_bytes=32 * 1024,
|
||||||
|
)
|
||||||
|
expected_descriptor = {
|
||||||
|
"schemaVersion": "nodedc.engine.deploy-transition/v1",
|
||||||
|
"id": "engine-mcp-l2-execution-plan-module-ownership-v3",
|
||||||
|
"component": "engine",
|
||||||
|
"scope": "external-mcp-l2-authoring-runtime",
|
||||||
|
"mcpVersion": "0.10.0",
|
||||||
|
"sourcePaths": [
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js",
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
],
|
||||||
|
"moduleOwnership": {
|
||||||
|
"schemaVersion":
|
||||||
|
"nodedc.engine.materialized-execution-plan-module/v1",
|
||||||
|
"adoptionStrategy": "adopt_existing_module",
|
||||||
|
"reconciliationStrategy": "create_or_reconcile_owned",
|
||||||
|
"nodeBindings": "exact-one-to-one",
|
||||||
|
"retirementScope": "closed-module-boundary",
|
||||||
|
"unrelatedNodes": "preserved",
|
||||||
|
"unrelatedEdges": "preserved",
|
||||||
|
"internalEdges": "server-derived-from-trusted-plan",
|
||||||
|
"wholeGraphReplacement": "not-required",
|
||||||
|
},
|
||||||
|
"sharedBoundary": {
|
||||||
|
"runtimeKinds": ["ndc.manual-trigger"],
|
||||||
|
"nodeTypes": ["n8n-nodes-base.webhook"],
|
||||||
|
"compatibility": "same-node-type-and-http-method",
|
||||||
|
"configurationAuthority": "existing-graph",
|
||||||
|
"providerCredentialNodes": "must-be-engine-managed",
|
||||||
|
"publisherNodes": "must-be-engine-managed",
|
||||||
|
},
|
||||||
|
"providerPackageTrust": {
|
||||||
|
"addedPackageId": "gelios.provider.v9",
|
||||||
|
"addedPackageDigest":
|
||||||
|
"sha256:7dd4ce4a45ce76e884ffa1e304bfaa521f552e9a45e535930f2d17b882ae23ed",
|
||||||
|
"legacyPackageId": "gelios.provider.v8",
|
||||||
|
"legacyPackagePreserved": True,
|
||||||
|
"telemetryRegistryDigest":
|
||||||
|
"sha256:8338dd1f3e757dae5a0fc558e41b3a5cc6395c33c94841ce4d2af976e1911381",
|
||||||
|
"telemetryProjectionDigest":
|
||||||
|
"sha256:ecdafb13173338f10043a08603ddd5cd1f6091f1c54d7fbb7e8a9606fbbdef65",
|
||||||
|
"providerLogicAuthority": "trusted-provider-package",
|
||||||
|
},
|
||||||
|
"engineProviderHardcode": False,
|
||||||
|
"embeddedCodexChanged": False,
|
||||||
|
}
|
||||||
|
if descriptor != expected_descriptor:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership descriptor "
|
||||||
|
"contract mismatch"
|
||||||
|
)
|
||||||
|
materializer_source = (
|
||||||
|
payload_dir / "nodedc-source/server/l2ExecutionPlan/materializer.js"
|
||||||
|
).read_text(encoding="utf-8")
|
||||||
|
gateway_source = (
|
||||||
|
payload_dir / "nodedc-source/server/routes/engineAgentGateway.js"
|
||||||
|
).read_text(encoding="utf-8")
|
||||||
|
for marker in (
|
||||||
|
"nodedc.engine.materialized-execution-plan-module/v1",
|
||||||
|
"adopt_existing_module",
|
||||||
|
"preserveBoundNodeIds",
|
||||||
|
"execution_plan_module_retire_boundary_not_closed",
|
||||||
|
"manual_webhook_same_method",
|
||||||
|
):
|
||||||
|
if marker not in materializer_source:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership contract "
|
||||||
|
f"marker missing: {marker}"
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
"const ENGINE_AGENT_MCP_VERSION = '0.10.0'" not in gateway_source
|
||||||
|
or "preserveBoundNodeIds" not in gateway_source
|
||||||
|
or "adopt_existing_module" not in gateway_source
|
||||||
|
):
|
||||||
|
die("Engine MCP execution plan module ownership gateway mismatch")
|
||||||
|
if re.search(r"gelios|robot2b", materializer_source, re.IGNORECASE):
|
||||||
|
die("Engine MCP execution plan module ownership contains provider hardcode")
|
||||||
|
catalog = read_strict_json(
|
||||||
|
payload_dir
|
||||||
|
/ "nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
"Engine execution plan catalog",
|
||||||
|
max_bytes=512 * 1024,
|
||||||
|
)
|
||||||
|
package_by_id = {
|
||||||
|
package.get("id"): package
|
||||||
|
for package in catalog.get("packages", [])
|
||||||
|
if isinstance(package, dict)
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
package_by_id.get("gelios.provider.v9", {}).get("contractDigest")
|
||||||
|
!= "sha256:7dd4ce4a45ce76e884ffa1e304bfaa521f552e9a45e535930f2d17b882ae23ed"
|
||||||
|
or "gelios.provider.v8" not in package_by_id
|
||||||
|
):
|
||||||
|
die("Engine MCP execution plan module ownership catalog mismatch")
|
||||||
|
node_intelligence_descriptor = read_engine_node_intelligence_descriptor(
|
||||||
|
payload_dir / ENGINE_NODE_INTELLIGENCE_DESCRIPTOR_REL,
|
||||||
|
"Engine MCP execution plan module ownership node-intelligence descriptor",
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
node_intelligence_descriptor.get("action") != "activate"
|
||||||
|
or node_intelligence_descriptor.get("releaseId")
|
||||||
|
!= ENGINE_NODE_INTELLIGENCE_RELEASE_ID
|
||||||
|
or node_intelligence_descriptor.get("source", {}).get("gatewaySha256")
|
||||||
|
!= ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256[
|
||||||
|
ENGINE_NODE_INTELLIGENCE_GATEWAY_REL
|
||||||
|
]
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership node-intelligence "
|
||||||
|
"attestation contract mismatch"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def validate_engine_agent_full_grant_migration_slice(payload_dir, entries):
|
def validate_engine_agent_full_grant_migration_slice(payload_dir, entries):
|
||||||
if tuple(entries) != ENGINE_AGENT_FULL_GRANT_MIGRATION_ARTIFACT_ENTRIES:
|
if tuple(entries) != ENGINE_AGENT_FULL_GRANT_MIGRATION_ARTIFACT_ENTRIES:
|
||||||
die("Engine agent full grant migration files.txt exact set/order mismatch")
|
die("Engine agent full grant migration files.txt exact set/order mismatch")
|
||||||
|
|
@ -5996,6 +6243,10 @@ def load_artifact(artifact, work_dir):
|
||||||
manifest["component"],
|
manifest["component"],
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
and not is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
)
|
||||||
and not is_engine_provider_authority_diagnostics_slice(
|
and not is_engine_provider_authority_diagnostics_slice(
|
||||||
manifest["component"],
|
manifest["component"],
|
||||||
entries,
|
entries,
|
||||||
|
|
@ -6045,6 +6296,14 @@ def load_artifact(artifact, work_dir):
|
||||||
payload_dir,
|
payload_dir,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
validate_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
payload_dir,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
if is_engine_provider_security_catalog_slice(manifest["component"], entries):
|
if is_engine_provider_security_catalog_slice(manifest["component"], entries):
|
||||||
validate_engine_provider_security_catalog_payload(payload_dir, entries)
|
validate_engine_provider_security_catalog_payload(payload_dir, entries)
|
||||||
if touches_engine_credential_sink(manifest["component"], entries):
|
if touches_engine_credential_sink(manifest["component"], entries):
|
||||||
|
|
@ -6074,6 +6333,10 @@ def load_artifact(artifact, work_dir):
|
||||||
manifest["component"],
|
manifest["component"],
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
and not is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
)
|
||||||
and (
|
and (
|
||||||
touches_engine_data_product_publish_grant(entries)
|
touches_engine_data_product_publish_grant(entries)
|
||||||
or ENGINE_DATA_PRODUCT_PUBLISH_GRANT_OVERRIDE_REL in entries
|
or ENGINE_DATA_PRODUCT_PUBLISH_GRANT_OVERRIDE_REL in entries
|
||||||
|
|
@ -6286,6 +6549,15 @@ def is_engine_mcp_execution_plan_telemetry_runtime_slice(component, entries):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def is_engine_mcp_execution_plan_module_ownership_slice(component, entries):
|
||||||
|
return (
|
||||||
|
component == "engine"
|
||||||
|
and entries is not None
|
||||||
|
and tuple(entries)
|
||||||
|
== ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def is_engine_agent_full_grant_migration_slice(component, entries):
|
def is_engine_agent_full_grant_migration_slice(component, entries):
|
||||||
return (
|
return (
|
||||||
component == "engine"
|
component == "engine"
|
||||||
|
|
@ -6964,6 +7236,83 @@ def preflight_engine_mcp_execution_plan_telemetry_runtime_predecessor():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def preflight_engine_mcp_execution_plan_module_ownership_predecessor():
|
||||||
|
root = component_root("engine")
|
||||||
|
actual = {}
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_PREDECESSOR_SHA256.items()
|
||||||
|
):
|
||||||
|
path = root / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership predecessor is "
|
||||||
|
f"missing: {rel}"
|
||||||
|
)
|
||||||
|
if stat.S_ISLNK(path_stat.st_mode) or not stat.S_ISREG(path_stat.st_mode):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership predecessor is "
|
||||||
|
f"unsafe: {rel}"
|
||||||
|
)
|
||||||
|
actual_sha256 = sha256_file(path)
|
||||||
|
if actual_sha256 != expected_sha256:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership predecessor drift "
|
||||||
|
f"detected: path={rel} expected={expected_sha256} "
|
||||||
|
f"actual={actual_sha256}"
|
||||||
|
)
|
||||||
|
actual[rel] = actual_sha256
|
||||||
|
foundation = {}
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256.items()
|
||||||
|
):
|
||||||
|
path = root / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership foundation is "
|
||||||
|
f"missing: {rel}"
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
stat.S_ISLNK(path_stat.st_mode)
|
||||||
|
or not stat.S_ISREG(path_stat.st_mode)
|
||||||
|
or sha256_file(path) != expected_sha256
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership foundation drift "
|
||||||
|
f"detected: {rel}"
|
||||||
|
)
|
||||||
|
foundation[rel] = expected_sha256
|
||||||
|
for rel in ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS:
|
||||||
|
path = root / rel
|
||||||
|
if path.exists() or path.is_symlink():
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership new path already "
|
||||||
|
f"exists: {rel}"
|
||||||
|
)
|
||||||
|
backend = preflight_engine_credential_backend_runtime()
|
||||||
|
if backend["mode"] != "verified-derived-retry":
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership requires the active "
|
||||||
|
"immutable backend"
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"mode":
|
||||||
|
"execution-plan-telemetry-runtime-v2-to-module-ownership-v3",
|
||||||
|
"predecessor_sha256": actual,
|
||||||
|
"foundation_sha256": foundation,
|
||||||
|
"target_sha256": dict(
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"new_paths": tuple(
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS
|
||||||
|
),
|
||||||
|
"backend_mode": backend["mode"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def preflight_engine_agent_full_grant_migration_predecessor():
|
def preflight_engine_agent_full_grant_migration_predecessor():
|
||||||
root = component_root("engine")
|
root = component_root("engine")
|
||||||
store_path = root / ENGINE_AGENT_FULL_GRANT_MIGRATION_STORE_REL
|
store_path = root / ENGINE_AGENT_FULL_GRANT_MIGRATION_STORE_REL
|
||||||
|
|
@ -7021,6 +7370,7 @@ def component_services(component, entries=None):
|
||||||
or is_engine_mcp_telemetry_catalog_slice(component, entries)
|
or is_engine_mcp_telemetry_catalog_slice(component, entries)
|
||||||
or is_engine_mcp_execution_plan_materialization_slice(component, entries)
|
or is_engine_mcp_execution_plan_materialization_slice(component, entries)
|
||||||
or is_engine_mcp_execution_plan_telemetry_runtime_slice(component, entries)
|
or is_engine_mcp_execution_plan_telemetry_runtime_slice(component, entries)
|
||||||
|
or is_engine_mcp_execution_plan_module_ownership_slice(component, entries)
|
||||||
or is_engine_provider_security_catalog_slice(component, entries)
|
or is_engine_provider_security_catalog_slice(component, entries)
|
||||||
):
|
):
|
||||||
# This slice updates only the existing Engine backend control plane.
|
# This slice updates only the existing Engine backend control plane.
|
||||||
|
|
@ -9233,6 +9583,7 @@ def plan_artifact(artifact):
|
||||||
mcp_telemetry_catalog_preflight = None
|
mcp_telemetry_catalog_preflight = None
|
||||||
mcp_execution_plan_materialization_preflight = None
|
mcp_execution_plan_materialization_preflight = None
|
||||||
mcp_execution_plan_telemetry_runtime_preflight = None
|
mcp_execution_plan_telemetry_runtime_preflight = None
|
||||||
|
mcp_execution_plan_module_ownership_preflight = None
|
||||||
provider_catalog_preflight = None
|
provider_catalog_preflight = None
|
||||||
with tempfile.TemporaryDirectory(prefix="plan-", dir=TMP_DIR) as tmp:
|
with tempfile.TemporaryDirectory(prefix="plan-", dir=TMP_DIR) as tmp:
|
||||||
manifest, entries, payload_dir = load_artifact(artifact, Path(tmp))
|
manifest, entries, payload_dir = load_artifact(artifact, Path(tmp))
|
||||||
|
|
@ -9312,6 +9663,13 @@ def plan_artifact(artifact):
|
||||||
mcp_execution_plan_telemetry_runtime_preflight = (
|
mcp_execution_plan_telemetry_runtime_preflight = (
|
||||||
preflight_engine_mcp_execution_plan_telemetry_runtime_predecessor()
|
preflight_engine_mcp_execution_plan_telemetry_runtime_predecessor()
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
mcp_execution_plan_module_ownership_preflight = (
|
||||||
|
preflight_engine_mcp_execution_plan_module_ownership_predecessor()
|
||||||
|
)
|
||||||
if is_engine_provider_security_catalog_slice(manifest["component"], entries):
|
if is_engine_provider_security_catalog_slice(manifest["component"], entries):
|
||||||
provider_catalog_preflight = preflight_engine_provider_security_catalog_predecessor()
|
provider_catalog_preflight = preflight_engine_provider_security_catalog_predecessor()
|
||||||
|
|
||||||
|
|
@ -9366,6 +9724,12 @@ def plan_artifact(artifact):
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
touches_mcp_execution_plan_module_ownership = (
|
||||||
|
is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
)
|
||||||
touches_agent_grant_migration = is_engine_agent_full_grant_migration_slice(
|
touches_agent_grant_migration = is_engine_agent_full_grant_migration_slice(
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
|
|
@ -9385,6 +9749,7 @@ def plan_artifact(artifact):
|
||||||
or touches_mcp_telemetry_catalog
|
or touches_mcp_telemetry_catalog
|
||||||
or touches_mcp_execution_plan_materialization
|
or touches_mcp_execution_plan_materialization
|
||||||
or touches_mcp_execution_plan_telemetry_runtime
|
or touches_mcp_execution_plan_telemetry_runtime
|
||||||
|
or touches_mcp_execution_plan_module_ownership
|
||||||
or touches_agent_grant_migration
|
or touches_agent_grant_migration
|
||||||
):
|
):
|
||||||
credential_backend_preflight = preflight_engine_credential_backend_runtime()
|
credential_backend_preflight = preflight_engine_credential_backend_runtime()
|
||||||
|
|
@ -9454,6 +9819,17 @@ def plan_artifact(artifact):
|
||||||
"Engine MCP execution plan telemetry runtime requires the "
|
"Engine MCP execution plan telemetry runtime requires the "
|
||||||
"active immutable credential backend"
|
"active immutable credential backend"
|
||||||
)
|
)
|
||||||
|
if touches_mcp_execution_plan_module_ownership:
|
||||||
|
if mcp_execution_plan_module_ownership_preflight is None:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership preflight is "
|
||||||
|
"missing"
|
||||||
|
)
|
||||||
|
if credential_backend_preflight["mode"] != "verified-derived-retry":
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership requires the "
|
||||||
|
"active immutable credential backend"
|
||||||
|
)
|
||||||
if touches_agent_grant_migration:
|
if touches_agent_grant_migration:
|
||||||
agent_grant_migration_predecessor_sha256 = (
|
agent_grant_migration_predecessor_sha256 = (
|
||||||
preflight_engine_agent_full_grant_migration_predecessor()
|
preflight_engine_agent_full_grant_migration_predecessor()
|
||||||
|
|
@ -9968,6 +10344,81 @@ def plan_artifact(artifact):
|
||||||
print("node_intelligence_image=preserved")
|
print("node_intelligence_image=preserved")
|
||||||
print("mcp_nginx=untouched")
|
print("mcp_nginx=untouched")
|
||||||
print("embedded_ai_workspace=untouched")
|
print("embedded_ai_workspace=untouched")
|
||||||
|
if mcp_execution_plan_module_ownership_preflight:
|
||||||
|
print(
|
||||||
|
"engine_mcp_module_ownership_transition="
|
||||||
|
f"{mcp_execution_plan_module_ownership_preflight['mode']}"
|
||||||
|
)
|
||||||
|
print("engine_mcp_version=0.10.0")
|
||||||
|
print("engine_mcp_surface=external-codex")
|
||||||
|
print(
|
||||||
|
"engine_mcp_materialization_strategies="
|
||||||
|
"create_or_reconcile_owned,adopt_existing,adopt_existing_module"
|
||||||
|
)
|
||||||
|
print("engine_mcp_module_node_bindings=exact-one-to-one")
|
||||||
|
print("engine_mcp_module_retirement_boundary=closed")
|
||||||
|
print("engine_mcp_shared_manual_webhook=compatible-config-preserved")
|
||||||
|
print("engine_mcp_provider_credential_nodes=engine-managed")
|
||||||
|
print("engine_mcp_publisher_nodes=engine-managed")
|
||||||
|
print("engine_provider_package_added=gelios.provider.v9")
|
||||||
|
print("engine_provider_package_legacy=gelios.provider.v8:preserved")
|
||||||
|
print("node_intelligence_descriptor=attested-gateway-successor")
|
||||||
|
print("node_intelligence_release=2.33.2-974a9fb3492f")
|
||||||
|
print("node_intelligence_image=preserved")
|
||||||
|
for foundation_path, foundation_sha256 in (
|
||||||
|
mcp_execution_plan_module_ownership_preflight[
|
||||||
|
"foundation_sha256"
|
||||||
|
].items()
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_foundation_sha256"
|
||||||
|
f"[{foundation_path}]={foundation_sha256}"
|
||||||
|
)
|
||||||
|
for changed_path in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_changed_path="
|
||||||
|
f"{changed_path}"
|
||||||
|
)
|
||||||
|
if changed_path in mcp_execution_plan_module_ownership_preflight[
|
||||||
|
"predecessor_sha256"
|
||||||
|
]:
|
||||||
|
print(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_predecessor_sha256"
|
||||||
|
f"[{changed_path}]="
|
||||||
|
f"{mcp_execution_plan_module_ownership_preflight['predecessor_sha256'][changed_path]}"
|
||||||
|
)
|
||||||
|
elif changed_path in mcp_execution_plan_module_ownership_preflight[
|
||||||
|
"new_paths"
|
||||||
|
]:
|
||||||
|
print(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_predecessor_state"
|
||||||
|
f"[{changed_path}]=absent"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership plan has no "
|
||||||
|
f"predecessor state: {changed_path}"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"engine_mcp_execution_plan_module_ownership_target_sha256"
|
||||||
|
f"[{changed_path}]="
|
||||||
|
f"{mcp_execution_plan_module_ownership_preflight['target_sha256'][changed_path]}"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"backend_current_barrier="
|
||||||
|
f"{mcp_execution_plan_module_ownership_preflight['backend_mode']}"
|
||||||
|
)
|
||||||
|
print("backend_force_recreate=yes")
|
||||||
|
print("backend_pull=never")
|
||||||
|
print("l2_graph=untouched")
|
||||||
|
print("n8n_l1=untouched")
|
||||||
|
print("engine_ui=untouched")
|
||||||
|
print("engine_databases=untouched")
|
||||||
|
print("credentials=preserved")
|
||||||
|
print("mcp_nginx=untouched")
|
||||||
|
print("embedded_ai_workspace=untouched")
|
||||||
if transition_descriptor:
|
if transition_descriptor:
|
||||||
print(f"n8n_transition={transition_descriptor['action']}")
|
print(f"n8n_transition={transition_descriptor['action']}")
|
||||||
print(f"n8n_version={transition_descriptor['n8nVersion']}")
|
print(f"n8n_version={transition_descriptor['n8nVersion']}")
|
||||||
|
|
@ -11094,6 +11545,10 @@ def component_healthchecks(component, entries=None, services=None):
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
or is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
or is_engine_agent_full_grant_migration_slice(component, entries)
|
or is_engine_agent_full_grant_migration_slice(component, entries)
|
||||||
or is_engine_mcp_control_plane_slice(component, entries)
|
or is_engine_mcp_control_plane_slice(component, entries)
|
||||||
or is_engine_mcp_ontology_sdk_slice(component, entries)
|
or is_engine_mcp_ontology_sdk_slice(component, entries)
|
||||||
|
|
@ -11523,6 +11978,12 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
touches_mcp_execution_plan_module_ownership = (
|
||||||
|
is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
)
|
||||||
touches_agent_grant_migration = is_engine_agent_full_grant_migration_slice(
|
touches_agent_grant_migration = is_engine_agent_full_grant_migration_slice(
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
|
|
@ -11543,6 +12004,7 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
or touches_mcp_telemetry_catalog
|
or touches_mcp_telemetry_catalog
|
||||||
or touches_mcp_execution_plan_materialization
|
or touches_mcp_execution_plan_materialization
|
||||||
or touches_mcp_execution_plan_telemetry_runtime
|
or touches_mcp_execution_plan_telemetry_runtime
|
||||||
|
or touches_mcp_execution_plan_module_ownership
|
||||||
or touches_agent_grant_migration
|
or touches_agent_grant_migration
|
||||||
or touches_mcp_control_plane
|
or touches_mcp_control_plane
|
||||||
or touches_mcp_ontology_sdk
|
or touches_mcp_ontology_sdk
|
||||||
|
|
@ -11567,6 +12029,7 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
or touches_mcp_telemetry_catalog
|
or touches_mcp_telemetry_catalog
|
||||||
or touches_mcp_execution_plan_materialization
|
or touches_mcp_execution_plan_materialization
|
||||||
or touches_mcp_execution_plan_telemetry_runtime
|
or touches_mcp_execution_plan_telemetry_runtime
|
||||||
|
or touches_mcp_execution_plan_module_ownership
|
||||||
or touches_agent_grant_migration
|
or touches_agent_grant_migration
|
||||||
or touches_mcp_control_plane
|
or touches_mcp_control_plane
|
||||||
or touches_mcp_ontology_sdk
|
or touches_mcp_ontology_sdk
|
||||||
|
|
@ -11796,6 +12259,48 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
"Engine MCP execution plan telemetry runtime installed state "
|
"Engine MCP execution plan telemetry runtime installed state "
|
||||||
"is neither target nor rollback predecessor"
|
"is neither target nor rollback predecessor"
|
||||||
)
|
)
|
||||||
|
if touches_mcp_execution_plan_module_ownership:
|
||||||
|
root = component_root("engine")
|
||||||
|
target_state = all(
|
||||||
|
(root / rel).is_file()
|
||||||
|
and not (root / rel).is_symlink()
|
||||||
|
and sha256_file(root / rel) == expected
|
||||||
|
for rel, expected in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256.items()
|
||||||
|
)
|
||||||
|
) and all(
|
||||||
|
(root / rel).is_file()
|
||||||
|
and not (root / rel).is_symlink()
|
||||||
|
and sha256_file(root / rel) == expected
|
||||||
|
for rel, expected in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256.items()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
predecessor_state = all(
|
||||||
|
(root / rel).is_file()
|
||||||
|
and not (root / rel).is_symlink()
|
||||||
|
and sha256_file(root / rel) == expected
|
||||||
|
for rel, expected in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_PREDECESSOR_SHA256.items()
|
||||||
|
)
|
||||||
|
) and all(
|
||||||
|
(root / rel).is_file()
|
||||||
|
and not (root / rel).is_symlink()
|
||||||
|
and sha256_file(root / rel) == expected
|
||||||
|
for rel, expected in (
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256.items()
|
||||||
|
)
|
||||||
|
) and all(
|
||||||
|
not (root / rel).exists() and not (root / rel).is_symlink()
|
||||||
|
for rel in ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS
|
||||||
|
)
|
||||||
|
if target_state:
|
||||||
|
accept_engine_mcp_execution_plan_module_ownership_runtime()
|
||||||
|
elif not predecessor_state:
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership installed state "
|
||||||
|
"is neither target nor rollback predecessor"
|
||||||
|
)
|
||||||
container_name = COMPONENTS[component].get("health_container")
|
container_name = COMPONENTS[component].get("health_container")
|
||||||
if container_name:
|
if container_name:
|
||||||
healthcheck_container(container_name)
|
healthcheck_container(container_name)
|
||||||
|
|
@ -11945,6 +12450,22 @@ def apply_artifact(artifact):
|
||||||
"Engine MCP execution plan telemetry runtime "
|
"Engine MCP execution plan telemetry runtime "
|
||||||
"requires the active immutable credential backend"
|
"requires the active immutable credential backend"
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
preflight_engine_mcp_execution_plan_module_ownership_predecessor()
|
||||||
|
execution_plan_module_ownership_backend_preflight = (
|
||||||
|
preflight_engine_credential_backend_runtime()
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
execution_plan_module_ownership_backend_preflight["mode"]
|
||||||
|
!= "verified-derived-retry"
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP execution plan module ownership "
|
||||||
|
"requires the active immutable credential backend"
|
||||||
|
)
|
||||||
if is_engine_agent_full_grant_migration_slice(component, entries):
|
if is_engine_agent_full_grant_migration_slice(component, entries):
|
||||||
preflight_engine_agent_full_grant_migration_predecessor()
|
preflight_engine_agent_full_grant_migration_predecessor()
|
||||||
migration_backend_preflight = preflight_engine_credential_backend_runtime()
|
migration_backend_preflight = preflight_engine_credential_backend_runtime()
|
||||||
|
|
@ -12210,6 +12731,10 @@ def apply_artifact(artifact):
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
or is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
or is_engine_agent_full_grant_migration_slice(component, entries)
|
or is_engine_agent_full_grant_migration_slice(component, entries)
|
||||||
or is_engine_mcp_control_plane_slice(component, entries)
|
or is_engine_mcp_control_plane_slice(component, entries)
|
||||||
or is_engine_mcp_ontology_sdk_slice(component, entries)
|
or is_engine_mcp_ontology_sdk_slice(component, entries)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,350 @@
|
||||||
|
import hashlib
|
||||||
|
import importlib.machinery
|
||||||
|
import importlib.util
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
import tarfile
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from contextlib import redirect_stdout
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||||
|
RUNNER_PATH = SCRIPT_DIR / "nodedc-deploy"
|
||||||
|
BUILDER_PATH = (
|
||||||
|
SCRIPT_DIR
|
||||||
|
/ "build-engine-mcp-execution-plan-module-ownership-artifact.mjs"
|
||||||
|
)
|
||||||
|
ENGINE_ROOT = SCRIPT_DIR.parent.parent.parent / "NODEDC_ENGINE_INFRA"
|
||||||
|
PATCH_ID = "engine-mcp-execution-plan-module-ownership-20991231-999"
|
||||||
|
|
||||||
|
|
||||||
|
def load_runner():
|
||||||
|
loader = importlib.machinery.SourceFileLoader(
|
||||||
|
"nodedc_engine_mcp_execution_plan_module_ownership",
|
||||||
|
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 EngineMcpExecutionPlanModuleOwnershipTest(unittest.TestCase):
|
||||||
|
def require_current_target_source(self):
|
||||||
|
for relative_path, expected in (
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256
|
||||||
|
.items()
|
||||||
|
):
|
||||||
|
path = ENGINE_ROOT / relative_path
|
||||||
|
if (
|
||||||
|
not path.is_file()
|
||||||
|
or hashlib.sha256(path.read_bytes()).hexdigest() != expected
|
||||||
|
):
|
||||||
|
self.skipTest("execution plan module ownership source has advanced")
|
||||||
|
|
||||||
|
def build(self, artifact_dir):
|
||||||
|
environment = os.environ.copy()
|
||||||
|
environment["NODEDC_ENGINE_SOURCE_ROOT"] = str(ENGINE_ROOT)
|
||||||
|
environment["NODEDC_DEPLOY_ARTIFACT_DIR"] = str(artifact_dir)
|
||||||
|
completed = subprocess.run(
|
||||||
|
["node", str(BUILDER_PATH), PATCH_ID],
|
||||||
|
check=True,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
env=environment,
|
||||||
|
)
|
||||||
|
return json.loads(completed.stdout)
|
||||||
|
|
||||||
|
def test_builder_emits_exact_deterministic_backend_only_successor(self):
|
||||||
|
self.require_current_target_source()
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-execution-plan-module-ownership-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
first = self.build(root / "first")
|
||||||
|
second = self.build(root / "second")
|
||||||
|
first_artifact = Path(first["artifact"])
|
||||||
|
second_artifact = Path(second["artifact"])
|
||||||
|
self.assertEqual(first_artifact.read_bytes(), second_artifact.read_bytes())
|
||||||
|
self.assertEqual(first["services"], ["nodedc-backend"])
|
||||||
|
self.assertEqual(first["mcpVersion"], "0.10.0")
|
||||||
|
self.assertEqual(
|
||||||
|
first["materializationStrategies"],
|
||||||
|
[
|
||||||
|
"create_or_reconcile_owned",
|
||||||
|
"adopt_existing",
|
||||||
|
"adopt_existing_module",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
tuple(first["entries"]),
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES,
|
||||||
|
)
|
||||||
|
|
||||||
|
extract = root / "extract"
|
||||||
|
with tarfile.open(first_artifact, "r:gz") as archive:
|
||||||
|
archive.extractall(extract, filter="data")
|
||||||
|
entries = tuple(
|
||||||
|
(extract / "files.txt").read_text(encoding="utf-8").splitlines()
|
||||||
|
)
|
||||||
|
payload = extract / "payload"
|
||||||
|
self.assertTrue(
|
||||||
|
RUNNER.is_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
"engine",
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.assertFalse(
|
||||||
|
RUNNER.is_engine_mcp_execution_plan_telemetry_runtime_slice(
|
||||||
|
"engine",
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
RUNNER.component_services("engine", entries),
|
||||||
|
("nodedc-backend",),
|
||||||
|
)
|
||||||
|
RUNNER.validate_engine_mcp_execution_plan_module_ownership_slice(
|
||||||
|
payload,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-execution-plan-module-load-"
|
||||||
|
) as load_directory:
|
||||||
|
loaded = RUNNER.load_artifact(
|
||||||
|
first_artifact,
|
||||||
|
Path(load_directory),
|
||||||
|
)
|
||||||
|
self.assertEqual(tuple(loaded[1]), entries)
|
||||||
|
|
||||||
|
def test_preflight_requires_exact_037_foundation_and_absent_descriptor(self):
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-execution-plan-module-preflight-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
hashes = {}
|
||||||
|
for mapping in (
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_PREDECESSOR_SHA256,
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256,
|
||||||
|
):
|
||||||
|
for relative_path, expected in mapping.items():
|
||||||
|
path = root / relative_path
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_text("installed\n", encoding="utf-8")
|
||||||
|
hashes[path] = expected
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=root),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"sha256_file",
|
||||||
|
side_effect=lambda path: hashes[Path(path)],
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"preflight_engine_credential_backend_runtime",
|
||||||
|
return_value={"mode": "verified-derived-retry"},
|
||||||
|
),
|
||||||
|
):
|
||||||
|
result = (
|
||||||
|
RUNNER
|
||||||
|
.preflight_engine_mcp_execution_plan_module_ownership_predecessor()
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
result["mode"],
|
||||||
|
"execution-plan-telemetry-runtime-v2-to-module-ownership-v3",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
result["foundation_sha256"],
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256,
|
||||||
|
)
|
||||||
|
|
||||||
|
new_path = (
|
||||||
|
root
|
||||||
|
/ RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS[0]
|
||||||
|
)
|
||||||
|
new_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
new_path.write_text("{}\n", encoding="utf-8")
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=root),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"sha256_file",
|
||||||
|
side_effect=lambda path: hashes[Path(path)],
|
||||||
|
),
|
||||||
|
):
|
||||||
|
with self.assertRaises(RUNNER.DeployError):
|
||||||
|
(
|
||||||
|
RUNNER
|
||||||
|
.preflight_engine_mcp_execution_plan_module_ownership_predecessor()
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_plan_renders_module_and_shared_boundary_contract(self):
|
||||||
|
self.require_current_target_source()
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-execution-plan-module-plan-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
artifact = Path(self.build(root / "artifacts")["artifact"])
|
||||||
|
live_root = root / "live"
|
||||||
|
live_root.mkdir()
|
||||||
|
preflight = {
|
||||||
|
"mode":
|
||||||
|
"execution-plan-telemetry-runtime-v2-to-module-ownership-v3",
|
||||||
|
"predecessor_sha256": dict(
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_PREDECESSOR_SHA256
|
||||||
|
),
|
||||||
|
"foundation_sha256": dict(
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256
|
||||||
|
),
|
||||||
|
"target_sha256": dict(
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"new_paths": tuple(
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_NEW_PATHS
|
||||||
|
),
|
||||||
|
"backend_mode": "verified-derived-retry",
|
||||||
|
}
|
||||||
|
output = io.StringIO()
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "validate_artifact_location"),
|
||||||
|
mock.patch.object(RUNNER, "ensure_layout"),
|
||||||
|
mock.patch.object(RUNNER, "TMP_DIR", root),
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=live_root),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"component_compose_root",
|
||||||
|
return_value=live_root,
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"preflight_engine_mcp_execution_plan_module_ownership_predecessor",
|
||||||
|
return_value=preflight,
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"preflight_engine_credential_backend_runtime",
|
||||||
|
return_value={"mode": "verified-derived-retry"},
|
||||||
|
),
|
||||||
|
mock.patch.object(RUNNER, "state_has_sha", return_value=False),
|
||||||
|
mock.patch.object(RUNNER, "state_has_patch_id", return_value=False),
|
||||||
|
redirect_stdout(output),
|
||||||
|
):
|
||||||
|
RUNNER.plan_artifact(artifact)
|
||||||
|
plan = output.getvalue()
|
||||||
|
self.assertIn("services=nodedc-backend", plan)
|
||||||
|
self.assertIn("engine_mcp_version=0.10.0", plan)
|
||||||
|
self.assertIn(
|
||||||
|
"engine_mcp_module_node_bindings=exact-one-to-one",
|
||||||
|
plan,
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"engine_mcp_shared_manual_webhook="
|
||||||
|
"compatible-config-preserved",
|
||||||
|
plan,
|
||||||
|
)
|
||||||
|
self.assertIn("engine_provider_package_added=gelios.provider.v9", plan)
|
||||||
|
self.assertIn("l2_graph=untouched", plan)
|
||||||
|
self.assertIn("embedded_ai_workspace=untouched", plan)
|
||||||
|
self.assertIn("state=new", plan)
|
||||||
|
|
||||||
|
def test_healthchecks_dispatch_versioned_module_acceptance(self):
|
||||||
|
entries = (
|
||||||
|
RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_ARTIFACT_ENTRIES
|
||||||
|
)
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-execution-plan-module-health-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
all_hashes = {
|
||||||
|
**RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_TARGET_SHA256,
|
||||||
|
**RUNNER
|
||||||
|
.ENGINE_MCP_EXECUTION_PLAN_MODULE_OWNERSHIP_FOUNDATION_SHA256,
|
||||||
|
}
|
||||||
|
for relative_path in all_hashes:
|
||||||
|
path = root / relative_path
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_text("target\n", encoding="utf-8")
|
||||||
|
|
||||||
|
def target_hash(path):
|
||||||
|
relative_path = Path(path).relative_to(root).as_posix()
|
||||||
|
return all_hashes[relative_path]
|
||||||
|
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=root),
|
||||||
|
mock.patch.object(RUNNER, "sha256_file", side_effect=target_hash),
|
||||||
|
mock.patch.object(RUNNER, "healthcheck_compose_service"),
|
||||||
|
mock.patch.object(RUNNER, "component_healthchecks", return_value=()),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"preflight_engine_credential_backend_runtime",
|
||||||
|
return_value={"mode": "verified-derived-retry"},
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"accept_engine_mcp_execution_plan_module_ownership_runtime",
|
||||||
|
return_value={"live": "accepted"},
|
||||||
|
) as acceptance,
|
||||||
|
mock.patch.object(RUNNER, "healthcheck_container"),
|
||||||
|
):
|
||||||
|
RUNNER.run_healthchecks(
|
||||||
|
"engine",
|
||||||
|
entries,
|
||||||
|
("nodedc-backend",),
|
||||||
|
)
|
||||||
|
acceptance.assert_called_once_with()
|
||||||
|
|
||||||
|
def test_live_acceptance_probes_provider_neutral_module_boundary(self):
|
||||||
|
expected_live = (
|
||||||
|
"engine-mcp-execution-plan-module-ownership:"
|
||||||
|
"0.10.0:module-scoped:shared-boundary:v3"
|
||||||
|
)
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=ENGINE_ROOT),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"validate_engine_mcp_execution_plan_module_ownership_slice",
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"engine_backend_container_id",
|
||||||
|
return_value="backend",
|
||||||
|
),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"run_engine_backend_probe",
|
||||||
|
return_value=expected_live,
|
||||||
|
) as backend_probe,
|
||||||
|
):
|
||||||
|
result = (
|
||||||
|
RUNNER
|
||||||
|
.accept_engine_mcp_execution_plan_module_ownership_runtime()
|
||||||
|
)
|
||||||
|
self.assertEqual(result["live"], expected_live)
|
||||||
|
probe_source = backend_probe.call_args.args[0][-1]
|
||||||
|
self.assertIn("adopt_existing_module", probe_source)
|
||||||
|
self.assertIn("preserveBoundNodeIds", probe_source)
|
||||||
|
self.assertIn("gelios|robot2b", probe_source)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main(verbosity=2)
|
||||||
|
|
@ -147,15 +147,15 @@ class EngineNodeIntelligenceTest(unittest.TestCase):
|
||||||
)
|
)
|
||||||
self.assertEqual(actual, descriptor)
|
self.assertEqual(actual, descriptor)
|
||||||
|
|
||||||
def test_gateway_accepts_registered_0_9_and_rejects_unknown_successors(self):
|
def test_gateway_accepts_registered_0_10_and_rejects_unknown_successors(self):
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
payload, descriptor = self.make_activation_payload(Path(directory))
|
payload, descriptor = self.make_activation_payload(Path(directory))
|
||||||
gateway = payload / RUNNER.ENGINE_NODE_INTELLIGENCE_GATEWAY_REL
|
gateway = payload / RUNNER.ENGINE_NODE_INTELLIGENCE_GATEWAY_REL
|
||||||
gateway_text = gateway.read_text(encoding="utf-8")
|
gateway_text = gateway.read_text(encoding="utf-8")
|
||||||
self.assertIn("const ENGINE_AGENT_MCP_VERSION = '0.9.0'", gateway_text)
|
self.assertIn("const ENGINE_AGENT_MCP_VERSION = '0.10.0'", gateway_text)
|
||||||
gateway.write_text(
|
gateway.write_text(
|
||||||
gateway_text.replace(
|
gateway_text.replace(
|
||||||
"const ENGINE_AGENT_MCP_VERSION = '0.9.0'",
|
"const ENGINE_AGENT_MCP_VERSION = '0.10.0'",
|
||||||
"const ENGINE_AGENT_MCP_VERSION = '9.9.9'",
|
"const ENGINE_AGENT_MCP_VERSION = '9.9.9'",
|
||||||
),
|
),
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ Foundry.
|
||||||
collection/request/extract/mapping/publish, прикладывает полные декларативные
|
collection/request/extract/mapping/publish, прикладывает полные декларативные
|
||||||
request/mapping contracts и фиксирует SHA-256 digests package, profile,
|
request/mapping contracts и фиксирует SHA-256 digests package, profile,
|
||||||
template, mapping, field policy, Data Product и telemetry registry. Plan
|
template, mapping, field policy, Data Product и telemetry registry. Plan
|
||||||
|
по умолчанию компилируется версией `1.2.0`; immutable plans `1.1.0` остаются
|
||||||
|
валидируемыми для воспроизводимости уже материализованных legacy runtime.
|
||||||
|
Версия компилятора выбирает только provider-neutral runtime semantics и не
|
||||||
|
добавляет ветвление по provider ID.
|
||||||
|
Plan
|
||||||
содержит exact `nodedc.l2-graph-blueprint/v1`: линейный набор generic runtime
|
содержит exact `nodedc.l2-graph-blueprint/v1`: линейный набор generic runtime
|
||||||
node kinds, exact edges, config digests, credential slots, trigger/retry/batch/
|
node kinds, exact edges, config digests, credential slots, trigger/retry/batch/
|
||||||
cardinality policy и закрытую матрицу требуемых mapping operators. Blueprint
|
cardinality policy и закрытую матрицу требуемых mapping operators. Blueprint
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ export { geliosCapabilityCatalogV1 } from "./capability-catalog-v1.mjs";
|
||||||
export { geliosCapabilityCatalogV2 } from "./capability-catalog-v2.mjs";
|
export { geliosCapabilityCatalogV2 } from "./capability-catalog-v2.mjs";
|
||||||
export { geliosProviderPackageV7 } from "./v7/index.mjs";
|
export { geliosProviderPackageV7 } from "./v7/index.mjs";
|
||||||
export * from "./v8/index.mjs";
|
export * from "./v8/index.mjs";
|
||||||
|
export * from "./v9/index.mjs";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export {
|
||||||
|
GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
geliosProviderPackageV9,
|
||||||
|
} from "./package.mjs";
|
||||||
|
export { geliosTelemetryFieldRegistryV2 } from "./telemetry-field-registry.mjs";
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { geliosProviderPackageV8 } from "../v8/package.mjs";
|
||||||
|
|
||||||
|
export const GELIOS_PROVIDER_PACKAGE_ID = "gelios.provider.v9";
|
||||||
|
export const GELIOS_PROVIDER_PACKAGE_VERSION = "9.0.0";
|
||||||
|
|
||||||
|
const value = structuredClone(geliosProviderPackageV8);
|
||||||
|
value.id = GELIOS_PROVIDER_PACKAGE_ID;
|
||||||
|
value.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||||
|
value.manifest = {
|
||||||
|
...value.manifest,
|
||||||
|
id: "gelios.provider.manifest.v9",
|
||||||
|
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const geliosProviderPackageV9 = deepFreeze(value);
|
||||||
|
|
||||||
|
function deepFreeze(input) {
|
||||||
|
if (!input || typeof input !== "object" || Object.isFrozen(input)) return input;
|
||||||
|
Object.freeze(input);
|
||||||
|
for (const child of Object.values(input)) deepFreeze(child);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import {
|
||||||
|
geliosTelemetryFieldRegistryV1,
|
||||||
|
} from "../v8/telemetry-field-registry.mjs";
|
||||||
|
import {
|
||||||
|
GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
} from "./package.mjs";
|
||||||
|
|
||||||
|
const value = structuredClone(geliosTelemetryFieldRegistryV1);
|
||||||
|
value.id = "gelios.units.current.telemetry.v2";
|
||||||
|
value.version = "2.0.0";
|
||||||
|
value.providerPackage = {
|
||||||
|
id: GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
};
|
||||||
|
value.entries = value.entries.map((entry) => {
|
||||||
|
if (!["in_0", "in_1"].includes(entry.sourceKey)) return entry;
|
||||||
|
return {
|
||||||
|
...entry,
|
||||||
|
status: "approved",
|
||||||
|
sensitivity: "operational",
|
||||||
|
valueType: "number",
|
||||||
|
semanticReading: {
|
||||||
|
id: `sensor.param.${entry.sourceKey}`,
|
||||||
|
labelSource: "provider_configured",
|
||||||
|
unitSource: "provider_configured",
|
||||||
|
},
|
||||||
|
allowedSurfaces: ["audit", "data_product", "analytics", "foundry"],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export const geliosTelemetryFieldRegistryV2 = deepFreeze(value);
|
||||||
|
|
||||||
|
function deepFreeze(input) {
|
||||||
|
if (!input || typeof input !== "object" || Object.isFrozen(input)) return input;
|
||||||
|
Object.freeze(input);
|
||||||
|
for (const child of Object.values(input)) deepFreeze(child);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,7 @@ export {
|
||||||
} from "./telemetry-field-registry.mjs";
|
} from "./telemetry-field-registry.mjs";
|
||||||
export {
|
export {
|
||||||
L2_EXECUTION_PLAN_COMPILER_VERSION,
|
L2_EXECUTION_PLAN_COMPILER_VERSION,
|
||||||
|
L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS,
|
||||||
L2_EXECUTION_PLAN_SCHEMA_VERSION,
|
L2_EXECUTION_PLAN_SCHEMA_VERSION,
|
||||||
L2_GRAPH_BLUEPRINT_SCHEMA_VERSION,
|
L2_GRAPH_BLUEPRINT_SCHEMA_VERSION,
|
||||||
L2_MAPPING_RUNTIME_SCHEMA_VERSION,
|
L2_MAPPING_RUNTIME_SCHEMA_VERSION,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,11 @@ export const L2_EXECUTION_PLAN_SCHEMA_VERSION = "nodedc.l2-execution-plan/v1";
|
||||||
export const L2_GRAPH_BLUEPRINT_SCHEMA_VERSION = "nodedc.l2-graph-blueprint/v1";
|
export const L2_GRAPH_BLUEPRINT_SCHEMA_VERSION = "nodedc.l2-graph-blueprint/v1";
|
||||||
export const L2_MATERIALIZATION_RECEIPT_SCHEMA_VERSION = "nodedc.l2-materialization-receipt/v1";
|
export const L2_MATERIALIZATION_RECEIPT_SCHEMA_VERSION = "nodedc.l2-materialization-receipt/v1";
|
||||||
export const L2_MAPPING_RUNTIME_SCHEMA_VERSION = "nodedc.semantic-mapping-runtime/v1";
|
export const L2_MAPPING_RUNTIME_SCHEMA_VERSION = "nodedc.semantic-mapping-runtime/v1";
|
||||||
export const L2_EXECUTION_PLAN_COMPILER_VERSION = "1.1.0";
|
export const L2_EXECUTION_PLAN_COMPILER_VERSION = "1.2.0";
|
||||||
|
export const L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS = Object.freeze([
|
||||||
|
"1.1.0",
|
||||||
|
L2_EXECUTION_PLAN_COMPILER_VERSION,
|
||||||
|
]);
|
||||||
|
|
||||||
const HASH = /^(?:sha256:)?[a-f0-9]{64}$/;
|
const HASH = /^(?:sha256:)?[a-f0-9]{64}$/;
|
||||||
const IDENTIFIER = /^[a-z][a-z0-9._:-]{2,127}$/;
|
const IDENTIFIER = /^[a-z][a-z0-9._:-]{2,127}$/;
|
||||||
|
|
@ -136,7 +140,9 @@ export function validateL2ExecutionPlan(value) {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
if (!isPlainObject(value)) return result(["executionPlan_must_be_object"]);
|
if (!isPlainObject(value)) return result(["executionPlan_must_be_object"]);
|
||||||
if (value.schemaVersion !== L2_EXECUTION_PLAN_SCHEMA_VERSION) errors.push("executionPlan.schemaVersion_mismatch");
|
if (value.schemaVersion !== L2_EXECUTION_PLAN_SCHEMA_VERSION) errors.push("executionPlan.schemaVersion_mismatch");
|
||||||
if (value.compilerVersion !== L2_EXECUTION_PLAN_COMPILER_VERSION) errors.push("executionPlan.compilerVersion_mismatch");
|
if (!L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS.includes(value.compilerVersion)) {
|
||||||
|
errors.push("executionPlan.compilerVersion_mismatch");
|
||||||
|
}
|
||||||
if (!Array.isArray(value.steps) || value.steps.length < 5) {
|
if (!Array.isArray(value.steps) || value.steps.length < 5) {
|
||||||
errors.push("executionPlan.steps_invalid");
|
errors.push("executionPlan.steps_invalid");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
import {
|
import {
|
||||||
|
L2_EXECUTION_PLAN_COMPILER_VERSION,
|
||||||
|
L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS,
|
||||||
L2_EXECUTION_PLAN_SCHEMA_VERSION,
|
L2_EXECUTION_PLAN_SCHEMA_VERSION,
|
||||||
L2_GRAPH_BLUEPRINT_SCHEMA_VERSION,
|
L2_GRAPH_BLUEPRINT_SCHEMA_VERSION,
|
||||||
L2_MAPPING_RUNTIME_SCHEMA_VERSION,
|
L2_MAPPING_RUNTIME_SCHEMA_VERSION,
|
||||||
|
|
@ -12,23 +14,26 @@ import {
|
||||||
validateL2ExecutionPlan,
|
validateL2ExecutionPlan,
|
||||||
} from "../src/index.mjs";
|
} from "../src/index.mjs";
|
||||||
import {
|
import {
|
||||||
geliosProviderPackageV8,
|
geliosProviderPackageV9,
|
||||||
geliosTelemetryFieldRegistryV1,
|
geliosTelemetryFieldRegistryV2,
|
||||||
} from "../providers/gelios/v8/index.mjs";
|
} from "../providers/gelios/v9/index.mjs";
|
||||||
|
|
||||||
const positionsConnection = instantiateL2Connection(geliosProviderPackageV8, {
|
const positionsConnection = instantiateL2Connection(geliosProviderPackageV9, {
|
||||||
tenantId: "tenant-compiler-fixture",
|
tenantId: "tenant-compiler-fixture",
|
||||||
connectionId: "gelios-compiler-fixture",
|
connectionId: "gelios-compiler-fixture",
|
||||||
collectionProfileId: "gelios.positions.current.realtime.v7",
|
collectionProfileId: "gelios.positions.current.realtime.v7",
|
||||||
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
|
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
|
||||||
});
|
});
|
||||||
const positionsPlan = compileL2ExecutionPlan(
|
const positionsPlan = compileL2ExecutionPlan(
|
||||||
geliosProviderPackageV8,
|
geliosProviderPackageV9,
|
||||||
positionsConnection,
|
positionsConnection,
|
||||||
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV1 },
|
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV2 },
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(positionsPlan.schemaVersion, L2_EXECUTION_PLAN_SCHEMA_VERSION);
|
assert.equal(positionsPlan.schemaVersion, L2_EXECUTION_PLAN_SCHEMA_VERSION);
|
||||||
|
assert.equal(L2_EXECUTION_PLAN_COMPILER_VERSION, "1.2.0");
|
||||||
|
assert.deepEqual(L2_EXECUTION_PLAN_SUPPORTED_COMPILER_VERSIONS, ["1.1.0", "1.2.0"]);
|
||||||
|
assert.equal(positionsPlan.compilerVersion, "1.2.0");
|
||||||
assert.deepEqual(validateL2ExecutionPlan(positionsPlan), { ok: true, errors: [] });
|
assert.deepEqual(validateL2ExecutionPlan(positionsPlan), { ok: true, errors: [] });
|
||||||
assert.match(positionsPlan.executionPlanDigest, /^sha256:[a-f0-9]{64}$/);
|
assert.match(positionsPlan.executionPlanDigest, /^sha256:[a-f0-9]{64}$/);
|
||||||
assert.match(positionsPlan.artifacts.packageDigest, /^sha256:[a-f0-9]{64}$/);
|
assert.match(positionsPlan.artifacts.packageDigest, /^sha256:[a-f0-9]{64}$/);
|
||||||
|
|
@ -106,48 +111,74 @@ assert.deepEqual(unitsRequest.config.request.query, {
|
||||||
const semanticMapping = positionsPlan.steps.find((step) => step.kind === "semantic_mapping");
|
const semanticMapping = positionsPlan.steps.find((step) => step.kind === "semantic_mapping");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
semanticMapping.config.telemetryProjection.entries.map((entry) => entry.reading.id),
|
semanticMapping.config.telemetryProjection.entries.map((entry) => entry.reading.id),
|
||||||
["sensor.param.in0", "sensor.param.in1"],
|
[
|
||||||
|
"sensor.param.in_0",
|
||||||
|
"sensor.param.in_1",
|
||||||
|
"sensor.param.in0",
|
||||||
|
"sensor.param.in1",
|
||||||
|
],
|
||||||
);
|
);
|
||||||
assert.equal(Object.isFrozen(positionsPlan), true);
|
assert.equal(Object.isFrozen(positionsPlan), true);
|
||||||
assert.equal(Object.isFrozen(positionsPlan.steps), true);
|
assert.equal(Object.isFrozen(positionsPlan.steps), true);
|
||||||
assert.equal(Object.isFrozen(positionsPlan.graphBlueprint), true);
|
assert.equal(Object.isFrozen(positionsPlan.graphBlueprint), true);
|
||||||
|
|
||||||
const clonedPlan = compileL2ExecutionPlan(
|
const clonedPlan = compileL2ExecutionPlan(
|
||||||
structuredClone(geliosProviderPackageV8),
|
structuredClone(geliosProviderPackageV9),
|
||||||
structuredClone(positionsConnection),
|
structuredClone(positionsConnection),
|
||||||
{ telemetryFieldRegistry: structuredClone(geliosTelemetryFieldRegistryV1) },
|
{ telemetryFieldRegistry: structuredClone(geliosTelemetryFieldRegistryV2) },
|
||||||
);
|
);
|
||||||
assert.equal(clonedPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
assert.equal(clonedPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
||||||
|
|
||||||
|
const legacyCompilerPlan = structuredClone(positionsPlan);
|
||||||
|
legacyCompilerPlan.compilerVersion = "1.1.0";
|
||||||
|
legacyCompilerPlan.executionPlanDigest = digestWithout(
|
||||||
|
legacyCompilerPlan,
|
||||||
|
"executionPlanDigest",
|
||||||
|
);
|
||||||
|
assert.deepEqual(validateL2ExecutionPlan(legacyCompilerPlan), { ok: true, errors: [] });
|
||||||
|
|
||||||
|
const unsupportedCompilerPlan = structuredClone(positionsPlan);
|
||||||
|
unsupportedCompilerPlan.compilerVersion = "2.0.0";
|
||||||
|
unsupportedCompilerPlan.executionPlanDigest = digestWithout(
|
||||||
|
unsupportedCompilerPlan,
|
||||||
|
"executionPlanDigest",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
validateL2ExecutionPlan(unsupportedCompilerPlan).errors.includes(
|
||||||
|
"executionPlan.compilerVersion_mismatch",
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => compileL2ExecutionPlan(geliosProviderPackageV8, positionsConnection),
|
() => compileL2ExecutionPlan(geliosProviderPackageV9, positionsConnection),
|
||||||
/telemetry_registry_required/,
|
/telemetry_registry_required/,
|
||||||
);
|
);
|
||||||
|
|
||||||
const profileConnection = instantiateL2Connection(geliosProviderPackageV8, {
|
const profileConnection = instantiateL2Connection(geliosProviderPackageV9, {
|
||||||
tenantId: "tenant-compiler-fixture",
|
tenantId: "tenant-compiler-fixture",
|
||||||
connectionId: "gelios-profile-compiler-fixture",
|
connectionId: "gelios-profile-compiler-fixture",
|
||||||
collectionProfileId: "gelios.units.profile.cold.v1",
|
collectionProfileId: "gelios.units.profile.cold.v1",
|
||||||
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
|
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0001",
|
||||||
});
|
});
|
||||||
const profilePlan = compileL2ExecutionPlan(geliosProviderPackageV8, profileConnection);
|
const profilePlan = compileL2ExecutionPlan(geliosProviderPackageV9, profileConnection);
|
||||||
assert.deepEqual(validateL2ExecutionPlan(profilePlan), { ok: true, errors: [] });
|
assert.deepEqual(validateL2ExecutionPlan(profilePlan), { ok: true, errors: [] });
|
||||||
assert.equal(profilePlan.artifacts.telemetryRegistryDigest, undefined);
|
assert.equal(profilePlan.artifacts.telemetryRegistryDigest, undefined);
|
||||||
assert.notEqual(profilePlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
assert.notEqual(profilePlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
||||||
assert.deepEqual(profilePlan.graphBlueprint.runtime.mappingRuntime.derivationKinds, []);
|
assert.deepEqual(profilePlan.graphBlueprint.runtime.mappingRuntime.derivationKinds, []);
|
||||||
|
|
||||||
for (const collectionProfile of geliosProviderPackageV8.collectionProfiles) {
|
for (const collectionProfile of geliosProviderPackageV9.collectionProfiles) {
|
||||||
const connection = instantiateL2Connection(geliosProviderPackageV8, {
|
const connection = instantiateL2Connection(geliosProviderPackageV9, {
|
||||||
tenantId: "tenant-all-profiles-fixture",
|
tenantId: "tenant-all-profiles-fixture",
|
||||||
connectionId: `connection-${collectionProfile.id.replaceAll(".", "-")}`,
|
connectionId: `connection-${collectionProfile.id.replaceAll(".", "-")}`,
|
||||||
collectionProfileId: collectionProfile.id,
|
collectionProfileId: collectionProfile.id,
|
||||||
providerCredentialRef: "ndc-credref:provider-all-profiles-fixture",
|
providerCredentialRef: "ndc-credref:provider-all-profiles-fixture",
|
||||||
});
|
});
|
||||||
const plan = compileL2ExecutionPlan(
|
const plan = compileL2ExecutionPlan(
|
||||||
geliosProviderPackageV8,
|
geliosProviderPackageV9,
|
||||||
connection,
|
connection,
|
||||||
collectionProfile.dataProductId === "fleet.positions.current.v5"
|
collectionProfile.dataProductId === "fleet.positions.current.v5"
|
||||||
? { telemetryFieldRegistry: geliosTelemetryFieldRegistryV1 }
|
? { telemetryFieldRegistry: geliosTelemetryFieldRegistryV2 }
|
||||||
: {},
|
: {},
|
||||||
);
|
);
|
||||||
assert.deepEqual(validateL2ExecutionPlan(plan), { ok: true, errors: [] });
|
assert.deepEqual(validateL2ExecutionPlan(plan), { ok: true, errors: [] });
|
||||||
|
|
@ -157,16 +188,16 @@ for (const collectionProfile of geliosProviderPackageV8.collectionProfiles) {
|
||||||
assert.equal(plan.graphBlueprint.edges.length, plan.steps.length + expectedEntrypoints - 2);
|
assert.equal(plan.graphBlueprint.edges.length, plan.steps.length + expectedEntrypoints - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const secondConnection = instantiateL2Connection(geliosProviderPackageV8, {
|
const secondConnection = instantiateL2Connection(geliosProviderPackageV9, {
|
||||||
tenantId: "tenant-compiler-fixture",
|
tenantId: "tenant-compiler-fixture",
|
||||||
connectionId: "gelios-compiler-fixture-two",
|
connectionId: "gelios-compiler-fixture-two",
|
||||||
collectionProfileId: "gelios.positions.current.realtime.v7",
|
collectionProfileId: "gelios.positions.current.realtime.v7",
|
||||||
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0002",
|
providerCredentialRef: "ndc-credref:provider-compiler-fixture-0002",
|
||||||
});
|
});
|
||||||
const secondPlan = compileL2ExecutionPlan(
|
const secondPlan = compileL2ExecutionPlan(
|
||||||
geliosProviderPackageV8,
|
geliosProviderPackageV9,
|
||||||
secondConnection,
|
secondConnection,
|
||||||
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV1 },
|
{ telemetryFieldRegistry: geliosTelemetryFieldRegistryV2 },
|
||||||
);
|
);
|
||||||
assert.notEqual(secondPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
assert.notEqual(secondPlan.executionPlanDigest, positionsPlan.executionPlanDigest);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import { geliosProviderPackageV5 } from "../providers/gelios/v5/index.mjs";
|
||||||
import { geliosProviderPackageV6 } from "../providers/gelios/v6/index.mjs";
|
import { geliosProviderPackageV6 } from "../providers/gelios/v6/index.mjs";
|
||||||
import { geliosProviderPackageV7 } from "../providers/gelios/v7/index.mjs";
|
import { geliosProviderPackageV7 } from "../providers/gelios/v7/index.mjs";
|
||||||
import { geliosProviderPackageV8 } from "../providers/gelios/v8/index.mjs";
|
import { geliosProviderPackageV8 } from "../providers/gelios/v8/index.mjs";
|
||||||
|
import { geliosProviderPackageV9 } from "../providers/gelios/v9/index.mjs";
|
||||||
import { normalizeDataProductDefinition } from "../../../services/external-data-plane/src/data-product-policy.mjs";
|
import { normalizeDataProductDefinition } from "../../../services/external-data-plane/src/data-product-policy.mjs";
|
||||||
|
|
||||||
const expectedFields = [
|
const expectedFields = [
|
||||||
|
|
@ -47,6 +48,10 @@ assert.deepEqual(validateProviderPackage(geliosProviderPackageV5), { ok: true, e
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV6), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV6), { ok: true, errors: [] });
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV7), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV7), { ok: true, errors: [] });
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV8), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV8), { ok: true, errors: [] });
|
||||||
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV9), { ok: true, errors: [] });
|
||||||
|
assert.equal(geliosProviderPackageV9.id, "gelios.provider.v9");
|
||||||
|
assert.equal(geliosProviderPackageV9.version, "9.0.0");
|
||||||
|
assert.equal(geliosProviderPackageV8.id, "gelios.provider.v8");
|
||||||
|
|
||||||
const profileProduct = geliosProviderPackageV8.dataProducts.find((product) => product.id === "fleet.units.profile.current.v1");
|
const profileProduct = geliosProviderPackageV8.dataProducts.find((product) => product.id === "fleet.units.profile.current.v1");
|
||||||
const registeredProfileProduct = JSON.parse(await readFile(new URL(
|
const registeredProfileProduct = JSON.parse(await readFile(new URL(
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ import {
|
||||||
import {
|
import {
|
||||||
geliosTelemetryFieldRegistryV1,
|
geliosTelemetryFieldRegistryV1,
|
||||||
} from "../providers/gelios/v8/index.mjs";
|
} from "../providers/gelios/v8/index.mjs";
|
||||||
|
import {
|
||||||
|
geliosTelemetryFieldRegistryV2,
|
||||||
|
} from "../providers/gelios/v9/index.mjs";
|
||||||
|
|
||||||
assert.deepEqual(validateTelemetryFieldRegistry(geliosTelemetryFieldRegistryV1), {
|
assert.deepEqual(validateTelemetryFieldRegistry(geliosTelemetryFieldRegistryV1), {
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|
@ -31,6 +34,37 @@ assert.equal(projection.entries.some((entry) => entry.sourceKey === "in_0"), fal
|
||||||
assert.equal(Object.isFrozen(projection), true);
|
assert.equal(Object.isFrozen(projection), true);
|
||||||
assert.equal(Object.isFrozen(projection.entries), true);
|
assert.equal(Object.isFrozen(projection.entries), true);
|
||||||
|
|
||||||
|
assert.deepEqual(validateTelemetryFieldRegistry(geliosTelemetryFieldRegistryV2), {
|
||||||
|
ok: true,
|
||||||
|
errors: [],
|
||||||
|
});
|
||||||
|
const expandedProjection = compileTelemetryFieldProjection(
|
||||||
|
geliosTelemetryFieldRegistryV2,
|
||||||
|
{
|
||||||
|
providerPackageId: "gelios.provider.v9",
|
||||||
|
providerPackageVersion: "9.0.0",
|
||||||
|
dataProductId: "fleet.positions.current.v5",
|
||||||
|
surface: "data_product",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
expandedProjection.entries.map((entry) => entry.sourceKey),
|
||||||
|
["in_0", "in_1", "in0", "in1"],
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
expandedProjection.entries.map((entry) => entry.reading.id),
|
||||||
|
[
|
||||||
|
"sensor.param.in_0",
|
||||||
|
"sensor.param.in_1",
|
||||||
|
"sensor.param.in0",
|
||||||
|
"sensor.param.in1",
|
||||||
|
],
|
||||||
|
);
|
||||||
|
assert.notEqual(
|
||||||
|
digestTelemetryFieldRegistry(geliosTelemetryFieldRegistryV2),
|
||||||
|
digestTelemetryFieldRegistry(geliosTelemetryFieldRegistryV1),
|
||||||
|
);
|
||||||
|
|
||||||
const observedExposed = structuredClone(geliosTelemetryFieldRegistryV1);
|
const observedExposed = structuredClone(geliosTelemetryFieldRegistryV1);
|
||||||
observedExposed.entries.find((entry) => entry.sourceKey === "in_0").allowedSurfaces.push("foundry");
|
observedExposed.entries.find((entry) => entry.sourceKey === "in_0").allowedSurfaces.push("foundry");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue