Document source UI gates, explicit native live-plot clearing, and remaining parity boundaries. Fix pause/resume transport continuity, repeated stepping, coordinate previews, and spindle override state. Optimize large program snapshots and rendering, and cover the control flows with native Tcl, WASM, and browser checks. Validation: 22 native tests and source/browser checks pass. Worker/App regression: 113 of 123 pass; 10 pre-existing failures remain documented with no new failures.
28 lines
2.0 KiB
JavaScript
28 lines
2.0 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { AxisOperationController } from "./axis-operation-controller.mjs";
|
|
|
|
const calls = [];
|
|
const client = { send: async (kind, payload, operationId) => { calls.push({ kind, payload, operationId }); return { kind: "COMMAND_RESULT", payload: { status: "verified" } }; } };
|
|
const controller = new AxisOperationController(client);
|
|
const ready = { task: { state: "READY", mode: "MANUAL" }, program: { path: "main.ngc", program_status: "loaded" } };
|
|
const run = await controller.execute("PROGRAM_RUN", {}, { state: ready });
|
|
assert.equal(run.operationId, "axis-program-run-000001");
|
|
assert.equal(run.gate.reason, "linuxcnc_wasm_worker_authority");
|
|
assert.equal(calls[0].operationId, run.operationId);
|
|
const jog = await controller.execute("JOG_START", { axis: "x" }, { state: { task: { state: "ESTOP" } } });
|
|
assert.equal(jog.operationId, "axis-jog-start-000002");
|
|
const tick = await controller.execute("SIM_STEP", { cycles: 1 }, { state: ready, gate: false });
|
|
assert.equal(tick.operationId, "axis-sim-step-000003");
|
|
assert.deepEqual(controller.exportTrace().map((entry) => entry.phase), ["pending", "result", "pending", "result", "pending", "result"]);
|
|
for (const response of [
|
|
{ kind: "ERROR", payload: { gate_reason: "xyzac_machine_off" } },
|
|
{ kind: "COMMAND_RESULT", payload: { status: "blocked", code: "abi_missing" } },
|
|
{ kind: "COMMAND_RESULT", payload: { status: "error", message_key: "interpreter_error" } },
|
|
]) {
|
|
const rejected = new AxisOperationController({ send: async () => response });
|
|
await assert.rejects(rejected.execute("PROGRAM_RUN"), (error) => error.response === response);
|
|
assert.equal(rejected.exportTrace().some((entry) => entry.phase === "result"), false);
|
|
assert.equal(rejected.exportTrace()[1].phase, "blocked");
|
|
}
|
|
console.log(JSON.stringify({ schema: "axis-operation-controller-sample.v1", status: "verified", calls: calls.length, phases: controller.exportTrace().map((entry) => entry.phase), last_operation: tick.operationId }));
|