Enforce LinuxCNC WASM authority for XYZAC frontend

This commit is contained in:
2026-09-02 07:43:47 +08:00
parent c60e3a1e8f
commit 6b689fd69e
36 changed files with 514 additions and 210 deletions

View File

@@ -49,7 +49,9 @@ let executionTraceEntries = 0;
// The first long Z feed is planned at the configured LinuxCNC TP limit. Give
// the fixed-tick simulation enough servo time to complete it before checking
// that the interpreter has advanced beyond the historical line-82 boundary.
for (let cycle = 0; cycle < 1500; cycle += 1) {
const cyclesToRun = Number(process.env.XYZAC_CHIPS_CYCLES ?? 3000);
assert.ok(Number.isSafeInteger(cyclesToRun) && cyclesToRun > 0);
for (let cycle = 0; cycle < cyclesToRun; cycle += 1) {
stepped = send("SIM_STEP", { cycles: 1, response: "motion_delta" });
assert.equal(stepped.kind, "COMMAND_RESULT");
executionTraceEntries += stepped.payload.execution_trace.length;
@@ -61,6 +63,8 @@ assert.ok(executionTraceEntries > 0);
assert.ok(stepped.payload.program.execution_line_text.length > 0);
assert.equal(stepped.payload.motion_authority, "wasm");
assert.equal(Object.hasOwn(stepped.payload.xyzac_ledger.entries.at(-1), "response"), false);
assert.equal(session.timeline.snapshots.snapshots.size, 0);
assert.equal(session.ledger.audit({ maxEntries: 32 }).entries.length, 32);
console.log(JSON.stringify({
schema: "xyzac-3d-chips-program.v1",
@@ -70,7 +74,10 @@ console.log(JSON.stringify({
source_hash: loaded.payload.program.source_hash,
line_count: loaded.payload.program.line_count,
preview_segments: loaded.payload.preview.segments.length,
cycles: cyclesToRun,
execution_line: stepped.payload.program.current_line,
execution_trace: executionTraceEntries,
motion_authority: stepped.payload.motion_authority,
motion_delta_snapshots: session.timeline.snapshots.snapshots.size,
ledger_audit_window: session.ledger.audit({ maxEntries: 32 }).entries.length,
}));