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:
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import { loadCheckedArtifactWorld } from "./receipts.js";
|
||||
import { contentArtifactUrl } from "./files.js";
|
||||
import { contentArtifactUrl, loadArtifactWorld, type LoadedArtifactWorld } from "./files.js";
|
||||
import { selectArtifactImplementation, type ArtifactImplementation, type ComponentArtifact } from "./artifacts.js";
|
||||
import { ExecutionPlanError, hexDigest, type ExecutionPlan } from "./plan.js";
|
||||
import {
|
||||
@@ -108,15 +108,32 @@ export interface InstalledComponent {
|
||||
readonly compatibility: ComponentArtifact["compatibility"];
|
||||
readonly sharedModules: Readonly<Record<keyof ComponentArtifact["sharedModules"], string>>;
|
||||
}
|
||||
/** Verify candidate receipts before assembling process entrypoints and browser assets.
|
||||
* This grants no authority to activate a world or run optional modules in process. */
|
||||
export async function loadExecutionInstallation(
|
||||
/** Build-time validation uses the compiler selected by the Nix derivation. */
|
||||
export async function checkExecutionInstallation(
|
||||
plan: ExecutionPlan,
|
||||
roots: Readonly<Record<string, string>>,
|
||||
generator: string,
|
||||
selections: Readonly<Record<string, PackageInstallationSelection>> = {},
|
||||
): Promise<ExecutionInstallation> {
|
||||
const loaded = await loadCheckedArtifactWorld(plan, roots, generator);
|
||||
return assembleExecutionInstallation(plan, roots, loaded, selections);
|
||||
}
|
||||
/** Load immutable artifacts without regenerating bindings with the host compiler.
|
||||
* Format, coverage, content and runtime ABI checks still apply. This grants no
|
||||
* authority to activate a world or run optional modules in process. */
|
||||
export async function loadExecutionInstallation(
|
||||
plan: ExecutionPlan,
|
||||
roots: Readonly<Record<string, string>>,
|
||||
selections: Readonly<Record<string, PackageInstallationSelection>> = {},
|
||||
): Promise<ExecutionInstallation> {
|
||||
return assembleExecutionInstallation(plan, roots, await loadArtifactWorld(plan, roots), selections);
|
||||
}
|
||||
function assembleExecutionInstallation(
|
||||
plan: ExecutionPlan,
|
||||
roots: Readonly<Record<string, string>>,
|
||||
loaded: LoadedArtifactWorld,
|
||||
selections: Readonly<Record<string, PackageInstallationSelection>>,
|
||||
): ExecutionInstallation {
|
||||
const fail = (where: string, message: string): never => {
|
||||
throw new ExecutionPlanError("INSTALLATION_INVALID", where, message);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user