Add exact Engine L2 reconciliation transition
This commit is contained in:
@@ -23,6 +23,22 @@ const engineRoot = resolve(
|
||||
const artifactRoot = resolve(
|
||||
process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(here, "../deploy-artifacts"),
|
||||
);
|
||||
const baselineArtifact = resolve(
|
||||
here,
|
||||
"../deploy-artifacts/nodedc-engine-provider-authority-diagnostics-20260723-029.tgz",
|
||||
);
|
||||
const baselineArtifactSha256 =
|
||||
"b4a0a1f707bf9814a4decc3f7f261b8afffe5727af2129c14bcdc76f81675e38";
|
||||
const descriptorRel =
|
||||
"nodedc-source/services/node-intelligence/activation.json";
|
||||
const baselineDescriptorSha256 =
|
||||
"84b0e15a10cedf334ad04d6f31c908da2dc155503c9974f0eeb75b01e20fb884";
|
||||
const predecessorGatewaySha256 =
|
||||
"5331f6dc8dc306f641370a2968eb025ee3e278e27ae9a217e4cfc2901fec369c";
|
||||
const targetGatewaySha256 =
|
||||
"4f600a2781be9118bec891fa2a6f20d7f55e0892ef2f06af24059193cebd28f4";
|
||||
const targetDescriptorSha256 =
|
||||
"63e7619c6971d02102583bb5d80d33ece293b952f113200fa0b76f0e88c2dd32";
|
||||
const [patchId = "", ...extra] = process.argv.slice(2);
|
||||
if (extra.length || !/^engine-l2-closed-loop-\d{8}-\d{3}$/.test(patchId)) {
|
||||
throw new Error(
|
||||
@@ -45,6 +61,7 @@ const entries = Object.freeze([
|
||||
"nodedc-source/src/utils/n8nApi.ts",
|
||||
"nodedc-source/dist/index.html",
|
||||
"nodedc-source/dist/assets",
|
||||
descriptorRel,
|
||||
]);
|
||||
const targetSha256 = Object.freeze({
|
||||
"nodedc-source/server/index.js":
|
||||
@@ -73,20 +90,30 @@ const targetSha256 = Object.freeze({
|
||||
"18322addd45c126a7b8396f36b005f3085fddba3e9b346dd2c910f6fa6987ebf",
|
||||
"nodedc-source/dist/assets/index-CqvJfRRS.js":
|
||||
"06e6c23b03ea2ba8a4890e1f1714fd08ebaf18d735834200af6ab430af360ca8",
|
||||
[descriptorRel]: targetDescriptorSha256,
|
||||
});
|
||||
const artifact = join(artifactRoot, `nodedc-${patchId}.tgz`);
|
||||
|
||||
await assertFresh(artifact);
|
||||
assertSourceCommit();
|
||||
await assertExactSources();
|
||||
const targetDescriptor = await buildTargetDescriptor();
|
||||
|
||||
const stage = await mkdtemp(join(tmpdir(), "nodedc-engine-l2-closed-loop-"));
|
||||
try {
|
||||
const payload = join(stage, "payload");
|
||||
for (const relativePath of entries) {
|
||||
const source = join(engineRoot, relativePath);
|
||||
const destination = join(payload, relativePath);
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
if (relativePath === descriptorRel) {
|
||||
await writeFile(destination, targetDescriptor, {
|
||||
encoding: "utf8",
|
||||
flag: "wx",
|
||||
mode: 0o644,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
const source = join(engineRoot, relativePath);
|
||||
const info = await lstat(source);
|
||||
if (info.isSymbolicLink()) {
|
||||
throw new Error(`engine_l2_closed_loop_source_symlink:${relativePath}`);
|
||||
@@ -130,6 +157,12 @@ try {
|
||||
],
|
||||
mcpVersion: "0.7.0",
|
||||
graphContract: "semantic-revision-cas-v1",
|
||||
transition: "failed-030-partial-source-reconciliation",
|
||||
predecessorDescriptorSha256: baselineDescriptorSha256,
|
||||
targetDescriptorSha256,
|
||||
predecessorGatewaySha256,
|
||||
targetGatewaySha256,
|
||||
recoveryArtifact: "nodedc-engine-l2-closed-loop-20260723-030.tgz",
|
||||
actorPlanes: ["external_codex_mcp", "ai_workspace", "engine_ui"],
|
||||
untouched: [
|
||||
"L2 graph data",
|
||||
@@ -153,9 +186,12 @@ function assertSourceCommit() {
|
||||
}
|
||||
|
||||
async function assertExactSources() {
|
||||
const expectedPaths = Object.keys(targetSha256).sort();
|
||||
const sourceEntries = entries.filter((entry) => entry !== descriptorRel);
|
||||
const expectedPaths = Object.keys(targetSha256)
|
||||
.filter((entry) => entry !== descriptorRel)
|
||||
.sort();
|
||||
const actualPaths = [];
|
||||
for (const entry of entries) {
|
||||
for (const entry of sourceEntries) {
|
||||
const source = join(engineRoot, entry);
|
||||
const info = await lstat(source);
|
||||
if (info.isSymbolicLink() || (!info.isFile() && !info.isDirectory())) {
|
||||
@@ -188,6 +224,39 @@ async function assertExactSources() {
|
||||
}
|
||||
}
|
||||
|
||||
async function buildTargetDescriptor() {
|
||||
const baselineBytes = await readFile(baselineArtifact);
|
||||
if (digest(baselineBytes) !== baselineArtifactSha256) {
|
||||
throw new Error("engine_l2_closed_loop_baseline_artifact_mismatch");
|
||||
}
|
||||
const baseline = run("tar", [
|
||||
"-xOf",
|
||||
baselineArtifact,
|
||||
`payload/${descriptorRel}`,
|
||||
]).stdout;
|
||||
if (digest(Buffer.from(baseline, "utf8")) !== baselineDescriptorSha256) {
|
||||
throw new Error("engine_l2_closed_loop_baseline_descriptor_mismatch");
|
||||
}
|
||||
const descriptor = JSON.parse(baseline);
|
||||
if (
|
||||
descriptor?.schemaVersion !==
|
||||
"nodedc.engine-node-intelligence-transition/v1" ||
|
||||
descriptor?.action !== "activate" ||
|
||||
descriptor?.releaseId !== "2.33.2-974a9fb3492f" ||
|
||||
descriptor?.source?.gatewaySha256 !== predecessorGatewaySha256 ||
|
||||
descriptor?.source?.upstreamProjectionSha256 !==
|
||||
"2dfa6b4f37d9bfa8b92a8109d4060d02dd2634ceb8f7924504b83ccf3fdd1523"
|
||||
) {
|
||||
throw new Error("engine_l2_closed_loop_baseline_descriptor_contract_mismatch");
|
||||
}
|
||||
descriptor.source.gatewaySha256 = targetGatewaySha256;
|
||||
const rendered = `${JSON.stringify(descriptor, null, 2)}\n`;
|
||||
if (digest(Buffer.from(rendered, "utf8")) !== targetDescriptorSha256) {
|
||||
throw new Error("engine_l2_closed_loop_target_descriptor_mismatch");
|
||||
}
|
||||
return rendered;
|
||||
}
|
||||
|
||||
async function assertFresh(path) {
|
||||
try {
|
||||
await lstat(path);
|
||||
|
||||
Reference in New Issue
Block a user