Align AXIS control flow and fix pause and program rendering
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.
This commit is contained in:
@@ -3,6 +3,7 @@ import { readFile } from "node:fs/promises";
|
||||
import createModule from "../../build-wasm/linuxcnc-sim-core.js";
|
||||
import { loadSimulationCase, toWorkerConfiguration } from "../workspace/sim-case-loader.mjs";
|
||||
import { SimSession, CONTEXT_ID } from "./sim-session.mjs";
|
||||
import { fnv1a64 } from "./replay.mjs";
|
||||
|
||||
const CASE = "linuxcnc/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini";
|
||||
const fetchImpl = async (url) => {
|
||||
@@ -29,6 +30,38 @@ assert.equal(second.payload.program.path, "second.ngc");
|
||||
assert.notEqual(second.payload.program.source_hash, first.payload.program.source_hash);
|
||||
assert.equal(second.payload.panel_snapshot.visual.toolpath.length, 1);
|
||||
|
||||
const epoch = () => session.livePathEpoch;
|
||||
const before = epoch();
|
||||
const source = "G21 G90\nG1 X2 Y2 Z3 F100\nM2\n";
|
||||
const replaced = send("PROGRAM_LOAD", { source, path: "web-replacement.ngc", clear_live_plot_on_replace: true });
|
||||
assert.equal(replaced.kind, "COMMAND_RESULT");
|
||||
assert.equal(replaced.payload.visual_clear, undefined);
|
||||
assert.equal(epoch(), before, "changed file retains the native trace, even from an old caller");
|
||||
assert.equal(replaced.payload.program.source_hash, fnv1a64(source));
|
||||
assert.equal(session.xyzacProgram.snapshot().source_hash, fnv1a64(source));
|
||||
assert.equal(send("PROGRAM_LOAD", { source, path: "web-replacement.ngc", clear_live_plot_on_replace: true }).kind, "COMMAND_RESULT");
|
||||
assert.equal(epoch(), before, "unchanged reload preserves live history");
|
||||
const failedReplacement = send("PROGRAM_LOAD", { source: "G999\n", path: "bad-web.ngc", clear_live_plot_on_replace: true });
|
||||
assert.equal(failedReplacement.kind, "ERROR");
|
||||
assert.equal(epoch(), before, "failed parse does not clear history");
|
||||
const native = send("PROGRAM_LOAD", { source, path: "native.ngc" });
|
||||
assert.equal(native.kind, "COMMAND_RESULT");
|
||||
assert.equal(epoch(), before, "default source PROGRAM_LOAD preserves history");
|
||||
send("POWER", { active: true }); send("HOME", { all: true }); send("PROGRAM_RUN");
|
||||
const blocked = send("PROGRAM_LOAD", { source, path: "blocked.ngc", clear_live_plot_on_replace: true });
|
||||
assert.equal(blocked.kind, "ERROR");
|
||||
assert.equal(epoch(), before, "gate rejection does not clear history");
|
||||
send("PROGRAM_ABORT");
|
||||
const edited = send("PROGRAM_LOAD", { source: source.replace("X2", "X3"), path: "native.ngc", clear_live_plot_on_replace: true });
|
||||
assert.equal(edited.kind, "COMMAND_RESULT");
|
||||
assert.equal(epoch(), before, "edited text retains the native live trace");
|
||||
assert.equal(edited.payload.program.source_hash, fnv1a64(source.replace("X2", "X3")));
|
||||
const cleared = send("VISUAL_CLEAR");
|
||||
assert.equal(cleared.kind, "COMMAND_RESULT");
|
||||
assert.equal(epoch(), before + 1);
|
||||
assert.deepEqual(cleared.payload.before, cleared.payload.after, "clear must not change CNC state");
|
||||
assert.deepEqual(cleared.payload.panel_snapshot.visual.toolpath, edited.payload.panel_snapshot.visual.toolpath);
|
||||
|
||||
console.log(JSON.stringify({
|
||||
schema: "xyzac-program-replacement.v1",
|
||||
status: "verified",
|
||||
|
||||
Reference in New Issue
Block a user