feat(provider): version gelios items response envelope
This commit is contained in:
parent
f0a4fb43c5
commit
fe274872e4
|
|
@ -0,0 +1,174 @@
|
||||||
|
#!/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 scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const workspaceRoot = resolve(scriptDir, "../../..");
|
||||||
|
const engineRoot = resolve(
|
||||||
|
process.env.NODEDC_ENGINE_SOURCE_ROOT || join(workspaceRoot, "NODEDC_ENGINE_INFRA"),
|
||||||
|
);
|
||||||
|
const artifactDir = resolve(
|
||||||
|
process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(scriptDir, "../deploy-artifacts"),
|
||||||
|
);
|
||||||
|
const [patchId = "engine-mcp-gelios-items-envelope-20260724-046", ...extra] =
|
||||||
|
process.argv.slice(2);
|
||||||
|
|
||||||
|
if (
|
||||||
|
extra.length
|
||||||
|
|| !/^engine-mcp-gelios-items-envelope-\d{8}-\d{3}$/.test(patchId)
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"usage: build-engine-mcp-gelios-items-envelope-artifact.mjs "
|
||||||
|
+ "[engine-mcp-gelios-items-envelope-YYYYMMDD-NNN]",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const expectedSha256 = Object.freeze({
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"eb0c32fa0e8017b23e2d225fcb2d5805aa6dd1bf674e8aa248afc6a4079a7403",
|
||||||
|
"nodedc-source/server/assets/provider-packages/v1/catalog.json":
|
||||||
|
"42104d1267ca7840446c0c02edd3f9ecb29f8da8eb3e8f384cbd6dca0f676c4c",
|
||||||
|
"nodedc-source/server/deployTransitions/geliosItemsEnvelopeV12.json":
|
||||||
|
"16e39f54ebae776de9acfdf0078c79291310eeca5a1f720eb8b82496f4d419a3",
|
||||||
|
});
|
||||||
|
const files = Object.freeze(Object.keys(expectedSha256));
|
||||||
|
const artifact = join(artifactDir, `nodedc-${patchId}.tgz`);
|
||||||
|
const checksum = `${artifact}.sha256`;
|
||||||
|
const stage = await mkdtemp(join(tmpdir(), "nodedc-engine-gelios-items-envelope-"));
|
||||||
|
|
||||||
|
await assertFresh(artifact);
|
||||||
|
await assertExactSources();
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (const relativePath of files) {
|
||||||
|
const destination = join(stage, "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`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
await writeFile(join(stage, "files.txt"), `${files.join("\n")}\n`, "utf8");
|
||||||
|
await mkdir(artifactDir, { recursive: true });
|
||||||
|
run("python3", ["-c", canonicalTarScript(), artifact, stage]);
|
||||||
|
const sha256 = digest(await readFile(artifact));
|
||||||
|
await writeFile(checksum, `${sha256} ${artifact.split("/").at(-1)}\n`, "utf8");
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
ok: true,
|
||||||
|
patchId,
|
||||||
|
artifact,
|
||||||
|
checksum,
|
||||||
|
sha256,
|
||||||
|
services: ["nodedc-backend"],
|
||||||
|
mcpVersion: "0.11.0",
|
||||||
|
providerPackageTransition: "gelios.provider.v11-to-v12",
|
||||||
|
responseCollectionPath: "items",
|
||||||
|
historicalExecutionPackagePreserved: true,
|
||||||
|
activeSecurityAuthority: "gelios.provider.v12",
|
||||||
|
engineCompilerChanged: false,
|
||||||
|
n8nCoreChanged: false,
|
||||||
|
l1Changed: false,
|
||||||
|
ontologyChanged: false,
|
||||||
|
credentialsChanged: false,
|
||||||
|
rawProviderValuesIncluded: false,
|
||||||
|
files,
|
||||||
|
}, null, 2));
|
||||||
|
} finally {
|
||||||
|
await rm(stage, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function assertExactSources() {
|
||||||
|
for (const [relativePath, expected] of Object.entries(expectedSha256)) {
|
||||||
|
const sourcePath = join(engineRoot, relativePath);
|
||||||
|
const info = await lstat(sourcePath);
|
||||||
|
if (!info.isFile() || info.isSymbolicLink()) {
|
||||||
|
throw new Error(`engine_gelios_items_envelope_source_unsafe:${relativePath}`);
|
||||||
|
}
|
||||||
|
const actual = digest(await readFile(sourcePath));
|
||||||
|
if (actual !== expected) {
|
||||||
|
throw new Error(
|
||||||
|
`engine_gelios_items_envelope_target_mismatch:${relativePath}:`
|
||||||
|
+ `expected=${expected}:actual=${actual}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const executionCatalog = JSON.parse(await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/assets/execution-plans/v1/catalog.json"),
|
||||||
|
"utf8",
|
||||||
|
));
|
||||||
|
const securityCatalog = JSON.parse(await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/assets/provider-packages/v1/catalog.json"),
|
||||||
|
"utf8",
|
||||||
|
));
|
||||||
|
const descriptor = JSON.parse(await readFile(
|
||||||
|
join(engineRoot, "nodedc-source/server/deployTransitions/geliosItemsEnvelopeV12.json"),
|
||||||
|
"utf8",
|
||||||
|
));
|
||||||
|
const executionIds = executionCatalog.packages.map(({ id }) => id);
|
||||||
|
const securityIds = securityCatalog.packages.map(({ id }) => id);
|
||||||
|
const v12 = executionCatalog.packages.find(({ id }) => id === "gelios.provider.v12");
|
||||||
|
if (
|
||||||
|
!executionIds.includes("gelios.provider.v11")
|
||||||
|
|| !v12?.profiles?.some((profile) => (
|
||||||
|
profile.id === "gelios.units.identity.warm.v1"
|
||||||
|
&& profile.dataProductId === "fleet.units.identity.current.v1"
|
||||||
|
))
|
||||||
|
|| securityIds.includes("gelios.provider.v11")
|
||||||
|
|| securityIds.filter((id) => id === "gelios.provider.v12").length !== 1
|
||||||
|
|| descriptor?.id !== "engine-mcp-gelios-items-envelope-v12"
|
||||||
|
|| descriptor?.predecessor !== "engine-mcp-l2-execution-plan-sandbox-runtime-v4"
|
||||||
|
|| descriptor?.responseEnvelope?.collectionPath !== "items"
|
||||||
|
|| descriptor?.responseEnvelope?.rawValuesCaptured !== false
|
||||||
|
|| Object.values(descriptor?.boundaries || {}).some((value) => value !== false)
|
||||||
|
) {
|
||||||
|
throw new Error("engine_gelios_items_envelope_boundary_invalid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
if (result.status !== 0) {
|
||||||
|
throw new Error(`${command}_failed:${result.stderr || result.stdout}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,171 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
import { createHash } from "node:crypto";
|
||||||
|
import { readFile, writeFile } from "node:fs/promises";
|
||||||
|
import { resolve } from "node:path";
|
||||||
|
|
||||||
|
import {
|
||||||
|
compileL2ExecutionPlan,
|
||||||
|
instantiateL2Connection,
|
||||||
|
} from "../../packages/external-provider-contract/src/index.mjs";
|
||||||
|
import {
|
||||||
|
geliosProviderPackageV12,
|
||||||
|
geliosTelemetryFieldRegistryV5,
|
||||||
|
} from "../../packages/external-provider-contract/providers/gelios/v12/index.mjs";
|
||||||
|
|
||||||
|
const engineRoot = resolve(
|
||||||
|
process.env.NODEDC_ENGINE_SOURCE_ROOT || "../NODEDC_ENGINE_INFRA",
|
||||||
|
);
|
||||||
|
const executionCatalogPath = resolve(
|
||||||
|
engineRoot,
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
);
|
||||||
|
const securityCatalogPath = resolve(
|
||||||
|
engineRoot,
|
||||||
|
"nodedc-source/server/assets/provider-packages/v1/catalog.json",
|
||||||
|
);
|
||||||
|
|
||||||
|
const executionCatalog = JSON.parse(
|
||||||
|
await readFile(executionCatalogPath, "utf8"),
|
||||||
|
);
|
||||||
|
executionCatalog.packages = executionCatalog.packages.filter(
|
||||||
|
(providerPackage) => providerPackage.id !== geliosProviderPackageV12.id,
|
||||||
|
);
|
||||||
|
executionCatalog.packages.push(executionCatalogEntry());
|
||||||
|
await writeFile(executionCatalogPath, `${JSON.stringify(executionCatalog, null, 2)}\n`);
|
||||||
|
|
||||||
|
const securityCatalog = JSON.parse(
|
||||||
|
await readFile(securityCatalogPath, "utf8"),
|
||||||
|
);
|
||||||
|
securityCatalog.packages = securityCatalog.packages.filter(
|
||||||
|
(providerPackage) => ![
|
||||||
|
"gelios.provider.v11",
|
||||||
|
geliosProviderPackageV12.id,
|
||||||
|
].includes(providerPackage.id),
|
||||||
|
);
|
||||||
|
securityCatalog.packages.push(securityCatalogEntry());
|
||||||
|
await writeFile(securityCatalogPath, `${JSON.stringify(securityCatalog, null, 2)}\n`);
|
||||||
|
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
ok: true,
|
||||||
|
providerPackage: geliosProviderPackageV12.id,
|
||||||
|
executionCatalogPath,
|
||||||
|
securityCatalogPath,
|
||||||
|
historicalExecutionPackagePreserved: executionCatalog.packages.some(
|
||||||
|
(providerPackage) => providerPackage.id === "gelios.provider.v11",
|
||||||
|
),
|
||||||
|
activeIdentityAuthority: geliosProviderPackageV12.id,
|
||||||
|
}, null, 2));
|
||||||
|
|
||||||
|
function executionCatalogEntry() {
|
||||||
|
const profiles = geliosProviderPackageV12.collectionProfiles.map((profile) => {
|
||||||
|
const connection = instantiateL2Connection(geliosProviderPackageV12, {
|
||||||
|
tenantId: "tenant-catalog-build",
|
||||||
|
connectionId: `catalog-${profile.id.replaceAll(".", "-")}`,
|
||||||
|
collectionProfileId: profile.id,
|
||||||
|
providerCredentialRef: "ndc-credref:catalog-build-provider-v12",
|
||||||
|
});
|
||||||
|
const plan = compileL2ExecutionPlan(
|
||||||
|
geliosProviderPackageV12,
|
||||||
|
connection,
|
||||||
|
profile.dataProductId === "fleet.positions.current.v5"
|
||||||
|
? { telemetryFieldRegistry: geliosTelemetryFieldRegistryV5 }
|
||||||
|
: {},
|
||||||
|
);
|
||||||
|
const { packageDigest: _packageDigest, ...artifacts } = plan.artifacts;
|
||||||
|
return {
|
||||||
|
id: profile.id,
|
||||||
|
dataProductId: profile.dataProductId,
|
||||||
|
capabilityIds: [...profile.capabilityIds],
|
||||||
|
stepSignatures: plan.steps.map((step) => ({
|
||||||
|
id: step.id,
|
||||||
|
kind: step.kind,
|
||||||
|
...(step.config.capabilityId ? { capabilityId: step.config.capabilityId } : {}),
|
||||||
|
...(step.config.mappingContractId ? {
|
||||||
|
mappingContractId: step.config.mappingContractId,
|
||||||
|
} : {}),
|
||||||
|
...(step.config.dataProductId ? { dataProductId: step.config.dataProductId } : {}),
|
||||||
|
...(step.config.nodeType ? { nodeType: step.config.nodeType } : {}),
|
||||||
|
})),
|
||||||
|
artifacts,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
id: geliosProviderPackageV12.id,
|
||||||
|
providerId: geliosProviderPackageV12.providerId,
|
||||||
|
version: geliosProviderPackageV12.version,
|
||||||
|
contractDigest: canonicalDigest(geliosProviderPackageV12),
|
||||||
|
providerCredential: {
|
||||||
|
authModeId: "gelios.rest-rotating-bearer.v3",
|
||||||
|
credentialType: "ndcProviderRotatingAccessApi",
|
||||||
|
},
|
||||||
|
publisher: {
|
||||||
|
nodeType: "n8n-nodes-ndc.ndcDataProductPublish",
|
||||||
|
credentialType: "ndcDataProductWriterApi",
|
||||||
|
},
|
||||||
|
capabilities: geliosProviderPackageV12.capabilities.map((capability) => ({
|
||||||
|
id: capability.id,
|
||||||
|
contractDigest: canonicalDigest(capability),
|
||||||
|
requestDigest: canonicalDigest(capability.request),
|
||||||
|
method: capability.request.method,
|
||||||
|
url: requestUrl(capability.request),
|
||||||
|
})),
|
||||||
|
profiles,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function securityCatalogEntry() {
|
||||||
|
const productsByCapability = new Map(
|
||||||
|
geliosProviderPackageV12.capabilities.map((capability) => [capability.id, new Set()]),
|
||||||
|
);
|
||||||
|
for (const profile of geliosProviderPackageV12.collectionProfiles) {
|
||||||
|
if (profile.dataProductId !== "fleet.units.identity.current.v1") continue;
|
||||||
|
for (const capabilityId of profile.capabilityIds) {
|
||||||
|
productsByCapability.get(capabilityId)?.add(profile.dataProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: geliosProviderPackageV12.id,
|
||||||
|
version: geliosProviderPackageV12.version,
|
||||||
|
providerId: geliosProviderPackageV12.providerId,
|
||||||
|
providerCredential: {
|
||||||
|
authModeId: "gelios.rest-rotating-bearer.v3",
|
||||||
|
credentialType: "ndcProviderRotatingAccessApi",
|
||||||
|
},
|
||||||
|
capabilities: geliosProviderPackageV12.capabilities
|
||||||
|
.filter((capability) => productsByCapability.get(capability.id)?.size)
|
||||||
|
.map((capability) => ({
|
||||||
|
id: capability.id,
|
||||||
|
classification: capability.classification,
|
||||||
|
status: capability.status,
|
||||||
|
request: {
|
||||||
|
method: capability.request.method,
|
||||||
|
url: requestUrl(capability.request),
|
||||||
|
},
|
||||||
|
dataProductIds: [...productsByCapability.get(capability.id)].sort(),
|
||||||
|
})),
|
||||||
|
publisher: {
|
||||||
|
nodeType: "n8n-nodes-ndc.ndcDataProductPublish",
|
||||||
|
credentialType: "ndcDataProductWriterApi",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestUrl(request) {
|
||||||
|
const url = new URL(request.path, request.baseUrl);
|
||||||
|
for (const [name, value] of Object.entries(request.query || {})) {
|
||||||
|
url.searchParams.append(name, String(value));
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function canonicalDigest(value) {
|
||||||
|
return `sha256:${createHash("sha256").update(JSON.stringify(stableValue(value)), "utf8").digest("hex")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stableValue(value) {
|
||||||
|
if (Array.isArray(value)) return value.map(stableValue);
|
||||||
|
if (!value || typeof value !== "object") return value;
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.keys(value).sort().map((key) => [key, stableValue(value[key])]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -851,6 +851,41 @@ ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_TARGET_SHA256 = {
|
||||||
ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_NEW_PATHS = (
|
ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_NEW_PATHS = (
|
||||||
ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_DESCRIPTOR_REL,
|
ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_DESCRIPTOR_REL,
|
||||||
)
|
)
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_DESCRIPTOR_REL = (
|
||||||
|
"nodedc-source/server/deployTransitions/geliosItemsEnvelopeV12.json"
|
||||||
|
)
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES = (
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
"nodedc-source/server/assets/provider-packages/v1/catalog.json",
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_DESCRIPTOR_REL,
|
||||||
|
)
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_PREDECESSOR_SHA256 = {
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"2b8e5ee3d73d16f3cd6e34d1f7394946a6270a17b0e9e6511f12921ba2561fd3",
|
||||||
|
"nodedc-source/server/assets/provider-packages/v1/catalog.json":
|
||||||
|
"fe5256fd2ba295819daecc8d2acae34687e807978a6730dfa20703cb3bab0c1b",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_FOUNDATION_SHA256 = {
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/compiler.js":
|
||||||
|
"64f5196a83018505c6dac77a0f8674c27941257a874eed9b024c1c94f169be2b",
|
||||||
|
"nodedc-source/server/l2ExecutionPlan/materializer.js":
|
||||||
|
"dabf0073520049d7a04d1962b29e591ae092b87b287a50534ad2d98b03ae683c",
|
||||||
|
"nodedc-source/server/routes/engineAgentGateway.js":
|
||||||
|
"4a9524fd954320277042c783b7b19cbb2172f075f27652c0eebfd743ffc47872",
|
||||||
|
ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_DESCRIPTOR_REL:
|
||||||
|
"a4692643afb86dfeeee6ca24aefcc181913e715eff38fa158667d2f10b901847",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256 = {
|
||||||
|
"nodedc-source/server/assets/execution-plans/v1/catalog.json":
|
||||||
|
"eb0c32fa0e8017b23e2d225fcb2d5805aa6dd1bf674e8aa248afc6a4079a7403",
|
||||||
|
"nodedc-source/server/assets/provider-packages/v1/catalog.json":
|
||||||
|
"42104d1267ca7840446c0c02edd3f9ecb29f8da8eb3e8f384cbd6dca0f676c4c",
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_DESCRIPTOR_REL:
|
||||||
|
"16e39f54ebae776de9acfdf0078c79291310eeca5a1f720eb8b82496f4d419a3",
|
||||||
|
}
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_NEW_PATHS = (
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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,
|
||||||
)
|
)
|
||||||
|
|
@ -4915,6 +4950,47 @@ process.stdout.write('engine-mcp-execution-plan-sandbox-runtime:0.11.0:n8n-2.3.2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def accept_engine_mcp_gelios_items_envelope_runtime():
|
||||||
|
root = component_root("engine")
|
||||||
|
validate_engine_mcp_gelios_items_envelope_slice(
|
||||||
|
root,
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES,
|
||||||
|
)
|
||||||
|
live = run_engine_backend_probe(
|
||||||
|
(
|
||||||
|
"node",
|
||||||
|
"--input-type=module",
|
||||||
|
"-e",
|
||||||
|
"""
|
||||||
|
const fs=await import('node:fs/promises');
|
||||||
|
const execution=JSON.parse(await fs.readFile('/app/server/assets/execution-plans/v1/catalog.json','utf8'));
|
||||||
|
const security=JSON.parse(await fs.readFile('/app/server/assets/provider-packages/v1/catalog.json','utf8'));
|
||||||
|
const compiler=await fs.readFile('/app/server/l2ExecutionPlan/compiler.js','utf8');
|
||||||
|
const ids=execution.packages.map(({id})=>id);
|
||||||
|
const v12=execution.packages.find(({id})=>id==='gelios.provider.v12');
|
||||||
|
const identity=v12?.profiles?.filter(({id,dataProductId})=>id==='gelios.units.identity.warm.v1'&&dataProductId==='fleet.units.identity.current.v1')||[];
|
||||||
|
const authorities=security.packages.filter(({capabilities=[]})=>capabilities.some(({dataProductIds=[]})=>dataProductIds.includes('fleet.units.identity.current.v1')));
|
||||||
|
if(!ids.includes('gelios.provider.v11')||v12?.version!=='12.0.0'||identity.length!==1||authorities.length!==1||authorities[0].id!=='gelios.provider.v12'||/gelios|robot2b/i.test(compiler)||compiler.includes('TextEncoder'))process.exit(2);
|
||||||
|
process.stdout.write('engine-mcp-gelios-items-envelope:0.11.0:v11-history:v12-authority:items');
|
||||||
|
""".strip(),
|
||||||
|
),
|
||||||
|
"Engine MCP Gelios items envelope",
|
||||||
|
container_id=engine_backend_container_id(),
|
||||||
|
)
|
||||||
|
expected = (
|
||||||
|
"engine-mcp-gelios-items-envelope:"
|
||||||
|
"0.11.0:v11-history:v12-authority:items"
|
||||||
|
)
|
||||||
|
if live != expected:
|
||||||
|
die("Engine MCP Gelios items envelope live acceptance mismatch")
|
||||||
|
return {
|
||||||
|
"target_sha256": dict(
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"live": live,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def accept_engine_mcp_l1_credential_reuse_runtime():
|
def accept_engine_mcp_l1_credential_reuse_runtime():
|
||||||
root = component_root("engine")
|
root = component_root("engine")
|
||||||
validate_engine_mcp_l1_credential_reuse_slice(
|
validate_engine_mcp_l1_credential_reuse_slice(
|
||||||
|
|
@ -6581,6 +6657,120 @@ def validate_engine_mcp_execution_plan_sandbox_runtime_slice(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_engine_mcp_gelios_items_envelope_slice(payload_dir, entries):
|
||||||
|
if tuple(entries) != ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES:
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope files.txt exact set/order "
|
||||||
|
"mismatch"
|
||||||
|
)
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256.items()
|
||||||
|
):
|
||||||
|
path = payload_dir / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(f"Engine MCP Gelios items envelope target is 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 Gelios items envelope target sha256 mismatch: "
|
||||||
|
f"{rel}"
|
||||||
|
)
|
||||||
|
|
||||||
|
descriptor = read_strict_json(
|
||||||
|
payload_dir / ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_DESCRIPTOR_REL,
|
||||||
|
"Engine MCP Gelios items envelope descriptor",
|
||||||
|
max_bytes=32 * 1024,
|
||||||
|
)
|
||||||
|
expected_descriptor = {
|
||||||
|
"schemaVersion": "nodedc.engine.deploy-transition/v1",
|
||||||
|
"id": "engine-mcp-gelios-items-envelope-v12",
|
||||||
|
"component": "engine",
|
||||||
|
"scope": "external-mcp-provider-package-catalog",
|
||||||
|
"mcpVersion": "0.11.0",
|
||||||
|
"predecessor": "engine-mcp-l2-execution-plan-sandbox-runtime-v4",
|
||||||
|
"providerPackageTransition": {
|
||||||
|
"from": "gelios.provider.v11",
|
||||||
|
"to": "gelios.provider.v12",
|
||||||
|
"capabilityId": "gelios.units.identity.read",
|
||||||
|
"dataProductId": "fleet.units.identity.current.v1",
|
||||||
|
},
|
||||||
|
"responseEnvelope": {
|
||||||
|
"collectionPath": "items",
|
||||||
|
"evidence": "bounded-structural-profile",
|
||||||
|
"observedCardinality": 107,
|
||||||
|
"rawValuesCaptured": False,
|
||||||
|
},
|
||||||
|
"catalogPolicy": {
|
||||||
|
"historicalExecutionPackagePreserved": "gelios.provider.v11",
|
||||||
|
"activeSecurityAuthority": "gelios.provider.v12",
|
||||||
|
"ambiguousIdentityAuthority": "forbidden",
|
||||||
|
},
|
||||||
|
"boundaries": {
|
||||||
|
"compilerChanged": False,
|
||||||
|
"n8nCoreChanged": False,
|
||||||
|
"l1Changed": False,
|
||||||
|
"ontologyChanged": False,
|
||||||
|
"credentialsChanged": False,
|
||||||
|
"rawProviderValuesIncluded": False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if descriptor != expected_descriptor:
|
||||||
|
die("Engine MCP Gelios items envelope descriptor mismatch")
|
||||||
|
|
||||||
|
execution_catalog = read_strict_json(
|
||||||
|
payload_dir
|
||||||
|
/ "nodedc-source/server/assets/execution-plans/v1/catalog.json",
|
||||||
|
"Engine MCP Gelios items envelope execution catalog",
|
||||||
|
max_bytes=2 * 1024 * 1024,
|
||||||
|
)
|
||||||
|
security_catalog = read_strict_json(
|
||||||
|
payload_dir
|
||||||
|
/ "nodedc-source/server/assets/provider-packages/v1/catalog.json",
|
||||||
|
"Engine MCP Gelios items envelope security catalog",
|
||||||
|
max_bytes=512 * 1024,
|
||||||
|
)
|
||||||
|
execution_packages = {
|
||||||
|
item.get("id"): item
|
||||||
|
for item in execution_catalog.get("packages", [])
|
||||||
|
if isinstance(item, dict)
|
||||||
|
}
|
||||||
|
security_packages = [
|
||||||
|
item for item in security_catalog.get("packages", [])
|
||||||
|
if isinstance(item, dict)
|
||||||
|
]
|
||||||
|
gelios_v12 = execution_packages.get("gelios.provider.v12", {})
|
||||||
|
identity_profiles = [
|
||||||
|
profile for profile in gelios_v12.get("profiles", [])
|
||||||
|
if (
|
||||||
|
profile.get("id") == "gelios.units.identity.warm.v1"
|
||||||
|
and profile.get("dataProductId")
|
||||||
|
== "fleet.units.identity.current.v1"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
active_identity = [
|
||||||
|
item for item in security_packages
|
||||||
|
if item.get("id") == "gelios.provider.v12"
|
||||||
|
]
|
||||||
|
if (
|
||||||
|
"gelios.provider.v11" not in execution_packages
|
||||||
|
or gelios_v12.get("version") != "12.0.0"
|
||||||
|
or len(identity_profiles) != 1
|
||||||
|
or any(item.get("id") == "gelios.provider.v11"
|
||||||
|
for item in security_packages)
|
||||||
|
or len(active_identity) != 1
|
||||||
|
or [
|
||||||
|
capability.get("id")
|
||||||
|
for capability in active_identity[0].get("capabilities", [])
|
||||||
|
] != ["gelios.units.identity.read"]
|
||||||
|
):
|
||||||
|
die("Engine MCP Gelios items envelope catalog authority 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")
|
||||||
|
|
@ -7105,6 +7295,14 @@ def load_artifact(artifact, work_dir):
|
||||||
payload_dir,
|
payload_dir,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_gelios_items_envelope_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
validate_engine_mcp_gelios_items_envelope_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):
|
||||||
|
|
@ -7154,6 +7352,10 @@ def load_artifact(artifact, work_dir):
|
||||||
manifest["component"],
|
manifest["component"],
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
and not is_engine_mcp_gelios_items_envelope_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
|
||||||
|
|
@ -7410,6 +7612,15 @@ def is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def is_engine_mcp_gelios_items_envelope_slice(component, entries):
|
||||||
|
return (
|
||||||
|
component == "engine"
|
||||||
|
and entries is not None
|
||||||
|
and tuple(entries)
|
||||||
|
== ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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"
|
||||||
|
|
@ -8460,6 +8671,70 @@ def preflight_engine_mcp_execution_plan_sandbox_runtime_predecessor():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def preflight_engine_mcp_gelios_items_envelope_predecessor():
|
||||||
|
root = component_root("engine")
|
||||||
|
actual = {}
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_PREDECESSOR_SHA256.items()
|
||||||
|
):
|
||||||
|
path = root / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(f"Engine MCP Gelios items envelope predecessor is missing: {rel}")
|
||||||
|
if stat.S_ISLNK(path_stat.st_mode) or not stat.S_ISREG(path_stat.st_mode):
|
||||||
|
die(f"Engine MCP Gelios items envelope predecessor is unsafe: {rel}")
|
||||||
|
actual_sha256 = sha256_file(path)
|
||||||
|
if actual_sha256 != expected_sha256:
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope predecessor drift detected: "
|
||||||
|
f"path={rel} expected={expected_sha256} actual={actual_sha256}"
|
||||||
|
)
|
||||||
|
actual[rel] = actual_sha256
|
||||||
|
|
||||||
|
foundation = {}
|
||||||
|
for rel, expected_sha256 in (
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_FOUNDATION_SHA256.items()
|
||||||
|
):
|
||||||
|
path = root / rel
|
||||||
|
try:
|
||||||
|
path_stat = path.lstat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
die(f"Engine MCP Gelios items envelope foundation is 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(f"Engine MCP Gelios items envelope foundation drift: {rel}")
|
||||||
|
foundation[rel] = expected_sha256
|
||||||
|
|
||||||
|
for rel in ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_NEW_PATHS:
|
||||||
|
path = root / rel
|
||||||
|
if path.exists() or path.is_symlink():
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope new path already exists: "
|
||||||
|
f"{rel}"
|
||||||
|
)
|
||||||
|
|
||||||
|
backend = preflight_engine_credential_backend_runtime()
|
||||||
|
if backend["mode"] != "verified-derived-retry":
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope requires the active immutable "
|
||||||
|
"backend"
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"mode": "gelios-provider-v11-to-v12-items-envelope",
|
||||||
|
"predecessor_sha256": actual,
|
||||||
|
"foundation_sha256": foundation,
|
||||||
|
"target_sha256": dict(
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"new_paths": tuple(ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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
|
||||||
|
|
@ -8522,6 +8797,7 @@ def component_services(component, entries=None):
|
||||||
or is_engine_mcp_l1_credential_reuse_slice(component, entries)
|
or is_engine_mcp_l1_credential_reuse_slice(component, entries)
|
||||||
or is_engine_mcp_l1_credential_provenance_slice(component, entries)
|
or is_engine_mcp_l1_credential_provenance_slice(component, entries)
|
||||||
or is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
or is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
||||||
|
or is_engine_mcp_gelios_items_envelope_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.
|
||||||
|
|
@ -10739,6 +11015,7 @@ def plan_artifact(artifact):
|
||||||
mcp_l1_credential_reuse_preflight = None
|
mcp_l1_credential_reuse_preflight = None
|
||||||
mcp_l1_credential_provenance_preflight = None
|
mcp_l1_credential_provenance_preflight = None
|
||||||
mcp_execution_plan_sandbox_runtime_preflight = None
|
mcp_execution_plan_sandbox_runtime_preflight = None
|
||||||
|
mcp_gelios_items_envelope_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))
|
||||||
|
|
@ -10853,6 +11130,13 @@ def plan_artifact(artifact):
|
||||||
mcp_execution_plan_sandbox_runtime_preflight = (
|
mcp_execution_plan_sandbox_runtime_preflight = (
|
||||||
preflight_engine_mcp_execution_plan_sandbox_runtime_predecessor()
|
preflight_engine_mcp_execution_plan_sandbox_runtime_predecessor()
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_gelios_items_envelope_slice(
|
||||||
|
manifest["component"],
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
mcp_gelios_items_envelope_preflight = (
|
||||||
|
preflight_engine_mcp_gelios_items_envelope_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()
|
||||||
|
|
||||||
|
|
@ -10928,6 +11212,9 @@ def plan_artifact(artifact):
|
||||||
touches_mcp_execution_plan_sandbox_runtime = (
|
touches_mcp_execution_plan_sandbox_runtime = (
|
||||||
is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
||||||
)
|
)
|
||||||
|
touches_mcp_gelios_items_envelope = (
|
||||||
|
is_engine_mcp_gelios_items_envelope_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,
|
||||||
|
|
@ -10952,6 +11239,7 @@ def plan_artifact(artifact):
|
||||||
or touches_mcp_l1_credential_reuse
|
or touches_mcp_l1_credential_reuse
|
||||||
or touches_mcp_l1_credential_provenance
|
or touches_mcp_l1_credential_provenance
|
||||||
or touches_mcp_execution_plan_sandbox_runtime
|
or touches_mcp_execution_plan_sandbox_runtime
|
||||||
|
or touches_mcp_gelios_items_envelope
|
||||||
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()
|
||||||
|
|
@ -11067,6 +11355,14 @@ def plan_artifact(artifact):
|
||||||
"Engine MCP execution plan sandbox runtime requires the "
|
"Engine MCP execution plan sandbox runtime requires the "
|
||||||
"active immutable credential backend"
|
"active immutable credential backend"
|
||||||
)
|
)
|
||||||
|
if touches_mcp_gelios_items_envelope:
|
||||||
|
if mcp_gelios_items_envelope_preflight is None:
|
||||||
|
die("Engine MCP Gelios items envelope preflight is missing")
|
||||||
|
if credential_backend_preflight["mode"] != "verified-derived-retry":
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope 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()
|
||||||
|
|
@ -11940,6 +12236,74 @@ def plan_artifact(artifact):
|
||||||
print("credentials=preserved")
|
print("credentials=preserved")
|
||||||
print("mcp_nginx=untouched")
|
print("mcp_nginx=untouched")
|
||||||
print("embedded_ai_workspace=untouched")
|
print("embedded_ai_workspace=untouched")
|
||||||
|
if mcp_gelios_items_envelope_preflight:
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_transition="
|
||||||
|
f"{mcp_gelios_items_envelope_preflight['mode']}"
|
||||||
|
)
|
||||||
|
print("engine_mcp_version=0.11.0")
|
||||||
|
print("engine_mcp_provider_package=gelios.provider.v12")
|
||||||
|
print("engine_mcp_response_collection_path=items")
|
||||||
|
print("engine_mcp_execution_history_v11=preserved")
|
||||||
|
print("engine_mcp_security_authority_v12=exclusive")
|
||||||
|
print("engine_mcp_provider_logic=trusted-package")
|
||||||
|
print("engine_mcp_compiler_changed=no")
|
||||||
|
print("engine_mcp_raw_provider_values_included=no")
|
||||||
|
for foundation_path, foundation_sha256 in (
|
||||||
|
mcp_gelios_items_envelope_preflight[
|
||||||
|
"foundation_sha256"
|
||||||
|
].items()
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_foundation_sha256"
|
||||||
|
f"[{foundation_path}]={foundation_sha256}"
|
||||||
|
)
|
||||||
|
for changed_path in (
|
||||||
|
ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_changed_path="
|
||||||
|
f"{changed_path}"
|
||||||
|
)
|
||||||
|
if changed_path in (
|
||||||
|
mcp_gelios_items_envelope_preflight["predecessor_sha256"]
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_predecessor_sha256"
|
||||||
|
f"[{changed_path}]="
|
||||||
|
f"{mcp_gelios_items_envelope_preflight['predecessor_sha256'][changed_path]}"
|
||||||
|
)
|
||||||
|
elif changed_path in (
|
||||||
|
mcp_gelios_items_envelope_preflight["new_paths"]
|
||||||
|
):
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_predecessor_state"
|
||||||
|
f"[{changed_path}]=absent"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope plan has no predecessor "
|
||||||
|
f"state: {changed_path}"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"engine_mcp_gelios_items_envelope_target_sha256"
|
||||||
|
f"[{changed_path}]="
|
||||||
|
f"{mcp_gelios_items_envelope_preflight['target_sha256'][changed_path]}"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"backend_current_barrier="
|
||||||
|
f"{mcp_gelios_items_envelope_preflight['backend_mode']}"
|
||||||
|
)
|
||||||
|
print("backend_force_recreate=yes")
|
||||||
|
print("backend_pull=never")
|
||||||
|
print("l2_graph=untouched")
|
||||||
|
print("n8n_l1=untouched")
|
||||||
|
print("n8n_core=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']}")
|
||||||
|
|
@ -13083,6 +13447,7 @@ def component_healthchecks(component, entries=None, services=None):
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
or is_engine_mcp_gelios_items_envelope_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)
|
||||||
|
|
@ -13533,6 +13898,9 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
touches_mcp_execution_plan_sandbox_runtime = (
|
touches_mcp_execution_plan_sandbox_runtime = (
|
||||||
is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
is_engine_mcp_execution_plan_sandbox_runtime_slice(component, entries)
|
||||||
)
|
)
|
||||||
|
touches_mcp_gelios_items_envelope = (
|
||||||
|
is_engine_mcp_gelios_items_envelope_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,
|
||||||
|
|
@ -13558,6 +13926,7 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
or touches_mcp_l1_credential_reuse
|
or touches_mcp_l1_credential_reuse
|
||||||
or touches_mcp_l1_credential_provenance
|
or touches_mcp_l1_credential_provenance
|
||||||
or touches_mcp_execution_plan_sandbox_runtime
|
or touches_mcp_execution_plan_sandbox_runtime
|
||||||
|
or touches_mcp_gelios_items_envelope
|
||||||
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
|
||||||
|
|
@ -13587,6 +13956,7 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
or touches_mcp_l1_credential_reuse
|
or touches_mcp_l1_credential_reuse
|
||||||
or touches_mcp_l1_credential_provenance
|
or touches_mcp_l1_credential_provenance
|
||||||
or touches_mcp_execution_plan_sandbox_runtime
|
or touches_mcp_execution_plan_sandbox_runtime
|
||||||
|
or touches_mcp_gelios_items_envelope
|
||||||
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
|
||||||
|
|
@ -14026,6 +14396,48 @@ def run_healthchecks(component, entries=None, services=None):
|
||||||
"Engine MCP execution plan sandbox runtime installed state is "
|
"Engine MCP execution plan sandbox runtime installed state is "
|
||||||
"neither target nor rollback predecessor"
|
"neither target nor rollback predecessor"
|
||||||
)
|
)
|
||||||
|
if touches_mcp_gelios_items_envelope:
|
||||||
|
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_GELIOS_ITEMS_ENVELOPE_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_GELIOS_ITEMS_ENVELOPE_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_GELIOS_ITEMS_ENVELOPE_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_GELIOS_ITEMS_ENVELOPE_FOUNDATION_SHA256.items()
|
||||||
|
)
|
||||||
|
) and all(
|
||||||
|
not (root / rel).exists() and not (root / rel).is_symlink()
|
||||||
|
for rel in ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_NEW_PATHS
|
||||||
|
)
|
||||||
|
if target_state:
|
||||||
|
accept_engine_mcp_gelios_items_envelope_runtime()
|
||||||
|
elif not predecessor_state:
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope 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)
|
||||||
|
|
@ -14255,6 +14667,22 @@ def apply_artifact(artifact):
|
||||||
"Engine MCP execution plan sandbox runtime requires "
|
"Engine MCP execution plan sandbox runtime requires "
|
||||||
"the active immutable credential backend"
|
"the active immutable credential backend"
|
||||||
)
|
)
|
||||||
|
if is_engine_mcp_gelios_items_envelope_slice(
|
||||||
|
component,
|
||||||
|
entries,
|
||||||
|
):
|
||||||
|
preflight_engine_mcp_gelios_items_envelope_predecessor()
|
||||||
|
gelios_items_envelope_backend_preflight = (
|
||||||
|
preflight_engine_credential_backend_runtime()
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
gelios_items_envelope_backend_preflight["mode"]
|
||||||
|
!= "verified-derived-retry"
|
||||||
|
):
|
||||||
|
die(
|
||||||
|
"Engine MCP Gelios items envelope 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()
|
||||||
|
|
@ -14540,6 +14968,10 @@ def apply_artifact(artifact):
|
||||||
component,
|
component,
|
||||||
entries,
|
entries,
|
||||||
)
|
)
|
||||||
|
or is_engine_mcp_gelios_items_envelope_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,319 @@
|
||||||
|
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-gelios-items-envelope-artifact.mjs"
|
||||||
|
)
|
||||||
|
ENGINE_ROOT = SCRIPT_DIR.parent.parent.parent / "NODEDC_ENGINE_INFRA"
|
||||||
|
PATCH_ID = "engine-mcp-gelios-items-envelope-20991231-999"
|
||||||
|
|
||||||
|
|
||||||
|
def load_runner():
|
||||||
|
loader = importlib.machinery.SourceFileLoader(
|
||||||
|
"nodedc_engine_mcp_gelios_items_envelope",
|
||||||
|
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 EngineMcpGeliosItemsEnvelopeTest(unittest.TestCase):
|
||||||
|
def require_current_target_source(self):
|
||||||
|
for relative_path, expected in (
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256.items()
|
||||||
|
):
|
||||||
|
path = ENGINE_ROOT / relative_path
|
||||||
|
if (
|
||||||
|
not path.is_file()
|
||||||
|
or hashlib.sha256(path.read_bytes()).hexdigest() != expected
|
||||||
|
):
|
||||||
|
self.skipTest("Gelios items envelope source advanced")
|
||||||
|
|
||||||
|
def build(self, artifact_dir, engine_root=ENGINE_ROOT):
|
||||||
|
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_is_deterministic_exact_and_backend_only(self):
|
||||||
|
self.require_current_target_source()
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-gelios-items-"
|
||||||
|
) 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["providerPackageTransition"],
|
||||||
|
"gelios.provider.v11-to-v12",
|
||||||
|
)
|
||||||
|
self.assertEqual(first["responseCollectionPath"], "items")
|
||||||
|
self.assertTrue(first["historicalExecutionPackagePreserved"])
|
||||||
|
self.assertFalse(first["engineCompilerChanged"])
|
||||||
|
self.assertFalse(first["rawProviderValuesIncluded"])
|
||||||
|
|
||||||
|
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.assertEqual(
|
||||||
|
entries,
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES,
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
RUNNER.component_services("engine", entries),
|
||||||
|
("nodedc-backend",),
|
||||||
|
)
|
||||||
|
RUNNER.validate_engine_mcp_gelios_items_envelope_slice(
|
||||||
|
payload,
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_catalogs_preserve_history_and_have_one_active_authority(self):
|
||||||
|
self.require_current_target_source()
|
||||||
|
execution = json.loads(
|
||||||
|
(
|
||||||
|
ENGINE_ROOT
|
||||||
|
/ "nodedc-source/server/assets/execution-plans/v1/catalog.json"
|
||||||
|
).read_text(encoding="utf-8")
|
||||||
|
)
|
||||||
|
security = json.loads(
|
||||||
|
(
|
||||||
|
ENGINE_ROOT
|
||||||
|
/ "nodedc-source/server/assets/provider-packages/v1/catalog.json"
|
||||||
|
).read_text(encoding="utf-8")
|
||||||
|
)
|
||||||
|
execution_ids = [item["id"] for item in execution["packages"]]
|
||||||
|
security_ids = [item["id"] for item in security["packages"]]
|
||||||
|
self.assertIn("gelios.provider.v11", execution_ids)
|
||||||
|
self.assertIn("gelios.provider.v12", execution_ids)
|
||||||
|
self.assertNotIn("gelios.provider.v11", security_ids)
|
||||||
|
self.assertEqual(security_ids.count("gelios.provider.v12"), 1)
|
||||||
|
|
||||||
|
def test_preflight_requires_045_foundation_and_absent_descriptor(self):
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-gelios-items-preflight-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
hashes = {}
|
||||||
|
for mapping in (
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_PREDECESSOR_SHA256,
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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_gelios_items_envelope_predecessor()
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
result["mode"],
|
||||||
|
"gelios-provider-v11-to-v12-items-envelope",
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
RUNNER.ENGINE_MCP_EXECUTION_PLAN_SANDBOX_RUNTIME_DESCRIPTOR_REL,
|
||||||
|
result["foundation_sha256"],
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_plan_renders_exact_untouched_boundaries(self):
|
||||||
|
self.require_current_target_source()
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-gelios-items-plan-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
artifact = Path(self.build(root / "artifacts")["artifact"])
|
||||||
|
live_root = root / "live"
|
||||||
|
live_root.mkdir()
|
||||||
|
preflight = {
|
||||||
|
"mode": "gelios-provider-v11-to-v12-items-envelope",
|
||||||
|
"predecessor_sha256": dict(
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_PREDECESSOR_SHA256
|
||||||
|
),
|
||||||
|
"foundation_sha256": dict(
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_FOUNDATION_SHA256
|
||||||
|
),
|
||||||
|
"target_sha256": dict(
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256
|
||||||
|
),
|
||||||
|
"new_paths": tuple(
|
||||||
|
RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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_gelios_items_envelope_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_execution_history_v11=preserved",
|
||||||
|
plan,
|
||||||
|
)
|
||||||
|
self.assertIn("engine_mcp_security_authority_v12=exclusive", plan)
|
||||||
|
self.assertIn("engine_mcp_compiler_changed=no", plan)
|
||||||
|
self.assertIn("l2_graph=untouched", plan)
|
||||||
|
self.assertIn("n8n_core=untouched", plan)
|
||||||
|
self.assertIn("credentials=preserved", plan)
|
||||||
|
|
||||||
|
def test_healthchecks_dispatch_runtime_acceptance(self):
|
||||||
|
entries = RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_ARTIFACT_ENTRIES
|
||||||
|
with tempfile.TemporaryDirectory(
|
||||||
|
prefix="nodedc-engine-mcp-gelios-items-health-"
|
||||||
|
) as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
all_hashes = {
|
||||||
|
**RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_TARGET_SHA256,
|
||||||
|
**RUNNER.ENGINE_MCP_GELIOS_ITEMS_ENVELOPE_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_gelios_items_envelope_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_proves_catalog_authority_and_generic_compiler(self):
|
||||||
|
expected_live = (
|
||||||
|
"engine-mcp-gelios-items-envelope:"
|
||||||
|
"0.11.0:v11-history:v12-authority:items"
|
||||||
|
)
|
||||||
|
with (
|
||||||
|
mock.patch.object(RUNNER, "component_root", return_value=ENGINE_ROOT),
|
||||||
|
mock.patch.object(
|
||||||
|
RUNNER,
|
||||||
|
"validate_engine_mcp_gelios_items_envelope_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_gelios_items_envelope_runtime()
|
||||||
|
self.assertEqual(result["live"], expected_live)
|
||||||
|
probe_source = backend_probe.call_args.args[0][-1]
|
||||||
|
self.assertIn("gelios.provider.v11", probe_source)
|
||||||
|
self.assertIn("authorities.length!==1", probe_source)
|
||||||
|
self.assertIn("/gelios|robot2b/i.test(compiler)", probe_source)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main(verbosity=2)
|
||||||
|
|
@ -6,3 +6,4 @@ export * from "./v8/index.mjs";
|
||||||
export * from "./v9/index.mjs";
|
export * from "./v9/index.mjs";
|
||||||
export { geliosProviderPackageV10 } from "./v10/index.mjs";
|
export { geliosProviderPackageV10 } from "./v10/index.mjs";
|
||||||
export { geliosProviderPackageV11 } from "./v11/index.mjs";
|
export { geliosProviderPackageV11 } from "./v11/index.mjs";
|
||||||
|
export { geliosProviderPackageV12 } from "./v12/index.mjs";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
export {
|
||||||
|
GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
GELIOS_UNIT_IDENTITY_DATA_PRODUCT_ID,
|
||||||
|
GELIOS_UNIT_IDENTITY_DATA_PRODUCT_VERSION,
|
||||||
|
GELIOS_UNIT_IDENTITY_ONTOLOGY_REVISION,
|
||||||
|
geliosProviderPackageV12,
|
||||||
|
} from "./package.mjs";
|
||||||
|
export { geliosTelemetryFieldRegistryV5 } from "./telemetry-field-registry.mjs";
|
||||||
|
export { geliosCapabilityCatalogV3 } from "../capability-catalog-v3.mjs";
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
import { geliosProviderPackageV11 } from "../v11/package.mjs";
|
||||||
|
|
||||||
|
export const GELIOS_PROVIDER_PACKAGE_ID = "gelios.provider.v12";
|
||||||
|
export const GELIOS_PROVIDER_PACKAGE_VERSION = "12.0.0";
|
||||||
|
export const GELIOS_UNIT_IDENTITY_DATA_PRODUCT_ID = "fleet.units.identity.current.v1";
|
||||||
|
export const GELIOS_UNIT_IDENTITY_DATA_PRODUCT_VERSION = "1.0.0";
|
||||||
|
export const GELIOS_UNIT_IDENTITY_ONTOLOGY_REVISION = "ontology.map.moving_object.v3";
|
||||||
|
|
||||||
|
const IDENTITY_CAPABILITY_ID = "gelios.units.identity.read";
|
||||||
|
const IDENTITY_PROFILE_ID = "gelios.units.identity.warm.v1";
|
||||||
|
const IDENTITY_MAPPING_ID = "gelios.units.to.fleet.units.identity.current.v1";
|
||||||
|
const IDENTITY_TEMPLATE_ID = "gelios.units.identity.l2.v1";
|
||||||
|
|
||||||
|
const value = structuredClone(geliosProviderPackageV11);
|
||||||
|
value.id = GELIOS_PROVIDER_PACKAGE_ID;
|
||||||
|
value.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||||
|
value.manifest = {
|
||||||
|
...value.manifest,
|
||||||
|
id: "gelios.provider.manifest.v12",
|
||||||
|
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
};
|
||||||
|
|
||||||
|
const identityCapability = value.capabilities.find(
|
||||||
|
(capability) => capability.id === IDENTITY_CAPABILITY_ID,
|
||||||
|
);
|
||||||
|
if (!identityCapability) throw new Error("gelios_v12_identity_capability_missing");
|
||||||
|
identityCapability.request.response.collectionPaths = [
|
||||||
|
"items",
|
||||||
|
...identityCapability.request.response.collectionPaths.filter(
|
||||||
|
(path) => path !== "items",
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
const identityProfile = value.collectionProfiles.find(
|
||||||
|
(profile) => profile.id === IDENTITY_PROFILE_ID,
|
||||||
|
);
|
||||||
|
if (!identityProfile) throw new Error("gelios_v12_identity_profile_missing");
|
||||||
|
identityProfile.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||||
|
|
||||||
|
const identityMapping = value.mappingContracts.find(
|
||||||
|
(mapping) => mapping.id === IDENTITY_MAPPING_ID,
|
||||||
|
);
|
||||||
|
if (!identityMapping) throw new Error("gelios_v12_identity_mapping_missing");
|
||||||
|
identityMapping.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||||
|
|
||||||
|
const identityTemplate = value.l2Templates.find(
|
||||||
|
(template) => template.id === IDENTITY_TEMPLATE_ID,
|
||||||
|
);
|
||||||
|
if (!identityTemplate) throw new Error("gelios_v12_identity_template_missing");
|
||||||
|
identityTemplate.version = GELIOS_PROVIDER_PACKAGE_VERSION;
|
||||||
|
|
||||||
|
export const geliosProviderPackageV12 = 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,20 @@
|
||||||
|
import { geliosTelemetryFieldRegistryV4 } from "../v11/telemetry-field-registry.mjs";
|
||||||
|
import {
|
||||||
|
GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
} from "./package.mjs";
|
||||||
|
|
||||||
|
const value = structuredClone(geliosTelemetryFieldRegistryV4);
|
||||||
|
value.providerPackage = {
|
||||||
|
id: GELIOS_PROVIDER_PACKAGE_ID,
|
||||||
|
version: GELIOS_PROVIDER_PACKAGE_VERSION,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const geliosTelemetryFieldRegistryV5 = 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;
|
||||||
|
}
|
||||||
|
|
@ -24,6 +24,7 @@ import { geliosProviderPackageV8 } from "../providers/gelios/v8/index.mjs";
|
||||||
import { geliosProviderPackageV9 } from "../providers/gelios/v9/index.mjs";
|
import { geliosProviderPackageV9 } from "../providers/gelios/v9/index.mjs";
|
||||||
import { geliosProviderPackageV10 } from "../providers/gelios/v10/index.mjs";
|
import { geliosProviderPackageV10 } from "../providers/gelios/v10/index.mjs";
|
||||||
import { geliosProviderPackageV11 } from "../providers/gelios/v11/index.mjs";
|
import { geliosProviderPackageV11 } from "../providers/gelios/v11/index.mjs";
|
||||||
|
import { geliosProviderPackageV12 } from "../providers/gelios/v12/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 = [
|
||||||
|
|
@ -53,12 +54,15 @@ assert.deepEqual(validateProviderPackage(geliosProviderPackageV8), { ok: true, e
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV9), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV9), { ok: true, errors: [] });
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV10), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV10), { ok: true, errors: [] });
|
||||||
assert.deepEqual(validateProviderPackage(geliosProviderPackageV11), { ok: true, errors: [] });
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV11), { ok: true, errors: [] });
|
||||||
|
assert.deepEqual(validateProviderPackage(geliosProviderPackageV12), { ok: true, errors: [] });
|
||||||
assert.equal(geliosProviderPackageV9.id, "gelios.provider.v9");
|
assert.equal(geliosProviderPackageV9.id, "gelios.provider.v9");
|
||||||
assert.equal(geliosProviderPackageV9.version, "9.0.0");
|
assert.equal(geliosProviderPackageV9.version, "9.0.0");
|
||||||
assert.equal(geliosProviderPackageV10.id, "gelios.provider.v10");
|
assert.equal(geliosProviderPackageV10.id, "gelios.provider.v10");
|
||||||
assert.equal(geliosProviderPackageV10.version, "10.0.0");
|
assert.equal(geliosProviderPackageV10.version, "10.0.0");
|
||||||
assert.equal(geliosProviderPackageV11.id, "gelios.provider.v11");
|
assert.equal(geliosProviderPackageV11.id, "gelios.provider.v11");
|
||||||
assert.equal(geliosProviderPackageV11.version, "11.0.0");
|
assert.equal(geliosProviderPackageV11.version, "11.0.0");
|
||||||
|
assert.equal(geliosProviderPackageV12.id, "gelios.provider.v12");
|
||||||
|
assert.equal(geliosProviderPackageV12.version, "12.0.0");
|
||||||
assert.equal(geliosProviderPackageV8.id, "gelios.provider.v8");
|
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");
|
||||||
|
|
@ -120,6 +124,16 @@ assert.deepEqual(identityCapability.request.query, {
|
||||||
incldrvrs: "true",
|
incldrvrs: "true",
|
||||||
inclusersav: "true",
|
inclusersav: "true",
|
||||||
});
|
});
|
||||||
|
const identityCapabilityV12 = geliosProviderPackageV12.capabilities.find(
|
||||||
|
(capability) => capability.id === "gelios.units.identity.read",
|
||||||
|
);
|
||||||
|
assert.equal(identityCapability.request.response.collectionPaths.includes("items"), false);
|
||||||
|
assert.deepEqual(identityCapabilityV12.request.response.collectionPaths, [
|
||||||
|
"items",
|
||||||
|
...identityCapability.request.response.collectionPaths,
|
||||||
|
]);
|
||||||
|
assert.equal(Object.isFrozen(geliosProviderPackageV12), true);
|
||||||
|
assert.equal(Object.isFrozen(identityCapabilityV12.request.response.collectionPaths), true);
|
||||||
const identityMapping = geliosProviderPackageV11.mappingContracts.find(
|
const identityMapping = geliosProviderPackageV11.mappingContracts.find(
|
||||||
(mapping) => mapping.id === "gelios.units.to.fleet.units.identity.current.v1",
|
(mapping) => mapping.id === "gelios.units.to.fleet.units.identity.current.v1",
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue