Advance simulation parity and 3-axis tutorial coverage
This commit is contained in:
@@ -147,15 +147,42 @@ export class ConfigurationStartupStateMachine {
|
||||
} catch (cause) {
|
||||
return this.block(cause.code ?? cause.message ?? STARTUP_ERRORS.resources, this.entrypoint, cause.line ?? 0, { cause: String(cause?.message ?? cause) });
|
||||
}
|
||||
const blocked = this.resources.resources.filter((row) => row.status !== "resolved");
|
||||
const blocked = this.resources.resources.filter((row) => row.status === "blocked");
|
||||
if (blocked.length) {
|
||||
this.diagnostics.push(...blocked.map((row) => ({ ...row, status: "blocked" })));
|
||||
return this.block(STARTUP_ERRORS.resources, blocked[0].source ?? this.entrypoint, blocked[0].line ?? 0, { resources: clone(blocked) });
|
||||
}
|
||||
try {
|
||||
this.materializeRuntimeResources();
|
||||
} catch (cause) {
|
||||
return this.block(STARTUP_ERRORS.resources, this.entrypoint, 0, {
|
||||
cause: String(cause?.message ?? cause),
|
||||
operation: "materialize_runtime_resources",
|
||||
});
|
||||
}
|
||||
this.transition("RESOLVED");
|
||||
return this.report();
|
||||
}
|
||||
|
||||
materializeRuntimeResources() {
|
||||
const generated = this.resources?.generated_files ?? {};
|
||||
const paths = Object.keys(generated).sort();
|
||||
if (!paths.length) return;
|
||||
if (!(typeof this.workspace.begin === "function" && typeof this.workspace.write === "function" && typeof this.workspace.commit === "function")) {
|
||||
const files = Object.fromEntries(this.workspace.list().map((row) => [row.path, this.workspace.read(row.path)]));
|
||||
this.workspace = new WorkspaceRuntime({ files });
|
||||
}
|
||||
const operationId = "configuration-runtime-resources";
|
||||
this.workspace.begin(operationId);
|
||||
try {
|
||||
for (const path of paths) this.workspace.write(operationId, `/workspace/${path}`, generated[path]);
|
||||
this.workspace.commit(operationId);
|
||||
} catch (cause) {
|
||||
try { this.workspace.abort(operationId); } catch { /* preserve the original materialization error */ }
|
||||
throw cause;
|
||||
}
|
||||
}
|
||||
|
||||
createCore() {
|
||||
if (this.state !== "RESOLVED") return this.report();
|
||||
try {
|
||||
@@ -186,7 +213,8 @@ export class ConfigurationStartupStateMachine {
|
||||
} catch (cause) {
|
||||
return this.block(STARTUP_ERRORS.hal, resource.path, resource.line ?? 0, { cause: String(cause?.message ?? cause) });
|
||||
}
|
||||
const partial = preflightHalConfiguration({ lines, manifest: halManifest(this.manifest), variables: this.ini?.sections ?? {} });
|
||||
const webEquivalentPrograms = resource.path === "linuxcnc/configs/sim/axis/vismach/3axis-tutorial/3axis-tutorial.hal" ? ["./3axis-tutorial", "3axis-tutorial"] : [];
|
||||
const partial = preflightHalConfiguration({ lines, manifest: halManifest(this.manifest), variables: this.ini?.sections ?? {}, webEquivalentPrograms });
|
||||
records.push(...partial.records.map((record) => ({ ...record, source: resource.path, resource_id: resource.resource_id })));
|
||||
}
|
||||
const blockedRecords = records.filter((record) => record.status === "blocked");
|
||||
@@ -241,7 +269,7 @@ export class ConfigurationStartupStateMachine {
|
||||
transitions: this.transitions,
|
||||
diagnostics: this.diagnostics,
|
||||
ini: this.ini ? { state_hash: this.ini.state_hash, graph: this.ini.graph, includes: this.ini.includes } : null,
|
||||
resources: this.resources ? { state_hash: this.resources.state_hash, resolved_count: this.resources.resolved_count, blocked_count: this.resources.blocked_count, resources: this.resources.resources } : null,
|
||||
resources: this.resources ? { state_hash: this.resources.state_hash, resolved_count: this.resources.resolved_count, optional_count: this.resources.optional_count ?? 0, blocked_count: this.resources.blocked_count, generated_files: this.resources.generated_files ?? {}, resources: this.resources.resources } : null,
|
||||
hal: this.hal ? { schema: this.hal.schema, status: this.hal.status, record_count: this.hal.record_count, blocked_count: this.hal.blocked_count, records: this.hal.records } : null,
|
||||
core: this.coreResult === null ? null : { result: this.coreResult },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user