Align AXIS Web control lifecycle with LinuxCNC

This commit is contained in:
2026-09-07 13:47:10 +08:00
parent 35adac6471
commit 0a679b5eeb
34 changed files with 2598 additions and 177 deletions

View File

@@ -40,10 +40,16 @@ assert.equal(loaded.payload.preview.source, "linuxcnc-wasm-sim_program");
assert.equal(loaded.payload.preview.line_count, 4711);
assert.equal(loaded.payload.preview.segments.length, 4684);
assert.equal(send("POWER", { active: true }).kind, "COMMAND_RESULT");
assert.equal(send("HOME", { all: true }).kind, "COMMAND_RESULT");
const power = send("POWER", { active: true });
assert.equal(power.kind, "COMMAND_RESULT");
assert.equal(Object.hasOwn(power.payload.panel_snapshot.visual, "toolpath"), false);
const home = send("HOME", { all: true });
assert.equal(home.kind, "COMMAND_RESULT");
assert.equal(Object.hasOwn(home.payload.panel_snapshot.visual, "toolpath"), false);
const run = send("PROGRAM_RUN");
assert.equal(run.kind, "COMMAND_RESULT");
assert.equal(Object.hasOwn(run.payload.panel_snapshot.visual, "toolpath"), false);
assert.equal(run.payload.xyzac_ledger.entries.some((entry) => Object.hasOwn(entry, "response")), false);
let stepped = null;
let executionTraceEntries = 0;
let runningQueueGaps = 0;
@@ -69,6 +75,18 @@ assert.equal(session.timeline.snapshots.snapshots.size, 0);
assert.equal(session.ledger.audit({ maxEntries: 32 }).entries.length, 32);
assert.equal(runningQueueGaps, 0);
// Replacing a large preview must leave the worker responsive for the next
// control transaction and must publish only the new program's path.
const aborted = send("PROGRAM_ABORT");
assert.equal(aborted.kind, "COMMAND_RESULT");
const replacement = send("PROGRAM_LOAD", { source: "G21 G90\nG1 X1 Y2 F100\nM2\n", path: "replacement.ngc" });
assert.equal(replacement.kind, "COMMAND_RESULT");
assert.equal(replacement.payload.program.path, "replacement.ngc");
assert.equal(replacement.payload.panel_snapshot.visual.toolpath.length, 1);
const replacementPower = send("POWER", { active: false });
assert.equal(replacementPower.kind, "COMMAND_RESULT");
assert.equal(Object.hasOwn(replacementPower.payload.panel_snapshot.visual, "toolpath"), false);
console.log(JSON.stringify({
schema: "xyzac-3d-chips-program.v1",
status: "verified",
@@ -84,4 +102,5 @@ console.log(JSON.stringify({
motion_authority: stepped.payload.motion_authority,
motion_delta_snapshots: session.timeline.snapshots.snapshots.size,
ledger_audit_window: session.ledger.audit({ maxEntries: 32 }).entries.length,
replacement_segments: replacement.payload.panel_snapshot.visual.toolpath.length,
}));