Load checked installations independently of the running compiler (WI-16)

Keep compiler-dependent checks in Nix builds; load stored plans and programs with original provenance and runtime artifact validation. Allow an identical executable world to receive a new activation epoch after a toolchain rebuild.

Compiler-update/altered-program regression, coordinator and full sandboxed integration checks pass; lint and formatting pass. Default platform/source wiring remains the next task.
This commit is contained in:
Timothy J. Aveni
2026-09-21 22:01:47 -07:00
parent e5544dde21
commit 60b44a6637
5 changed files with 87 additions and 50 deletions
+24 -17
View File
@@ -13,25 +13,32 @@ for (const check of checks) {
if (Object.hasOwn(roots, check.packageRevisionId)) throw Error("Duplicate checked package revision");
roots[check.packageRevisionId] = check.artifactPath;
}
const checked = await compiler.loadCheckedArtifactWorld(
plan,
roots,
createHash("sha256")
.update(await readFile(compilerPath))
.digest("hex"),
);
const installation = await compiler.loadExecutionInstallation(
plan,
roots,
createHash("sha256")
.update(await readFile(compilerPath))
.digest("hex"),
);
const generator = createHash("sha256")
.update(await readFile(compilerPath))
.digest("hex");
// These compiler-dependent checks belong to the Nix build, not runtime recovery.
const candidate = JSON.parse(await readFile(join(output, "candidate.json"), "utf8"));
const { executionContracts: _legacyContracts, ...workspace } = candidate;
if (compiler.hexDigest(compiler.compileExecutionPlan(workspace)) !== compiler.hexDigest(plan))
throw Error("CANDIDATE_PLAN_MISMATCH: build plan differs from source compilation");
const checked = await compiler.loadCheckedArtifactWorld(plan, roots, generator);
const installation = await compiler.loadExecutionInstallation(plan, roots);
const kernel = compiler.compileKernelProgram(plan),
queries = compiler.compileQueryProgram(plan);
for (const [file, value] of [
["execution-world.json", checked.world],
["installation.json", installation],
["kernel.json", compiler.compileKernelProgram(plan)],
["queries.json", compiler.compileQueryProgram(plan)],
["execution-artifacts.json", { codec: "camino-checked-execution-v1", roots, manifests: checked.manifests }],
["kernel.json", kernel],
["queries.json", queries],
[
"execution-artifacts.json",
{
codec: "camino-checked-execution-v2",
generator,
roots,
manifests: checked.manifests,
programs: { kernel: compiler.hexDigest(kernel), queries: compiler.hexDigest(queries) },
},
],
])
await writeFile(join(output, file), JSON.stringify(value) + "\n");