Enforce LinuxCNC WASM XYZAC command authority

This commit is contained in:
2026-08-28 13:04:47 +08:00
parent 1a7995fa9b
commit 78d884bc67
43 changed files with 567 additions and 186 deletions

View File

@@ -28,6 +28,7 @@ const send = (kind, operationId, payload = {}) => session.accept({ ...base, kind
assert.equal(send("HELLO", "hello").kind, "CAPABILITIES");
assert.equal(send("SESSION_ATTACH", "attach").kind, "SESSION_READY");
assert.equal(send("LOAD_WORKSPACE", "workspace", { root_path: "/workspace", configuration: toWorkerConfiguration(bundle) }).payload.status, "verified");
assert.equal(send("POWER", "power-on", { active: true }).payload.status, "verified");
assert.equal(session.xyzacKinematics.forward([12, -5, 20, 30, 45]).status, "verified");
const levels = { protocol: [], control: [], state: [], canonical: [], recovery: [] };
@@ -38,7 +39,10 @@ for (const [index, [command, activeType]] of COMMANDS.entries()) {
assert.equal(result.kind, "COMMAND_RESULT");
assert.equal(result.payload.status, "verified");
assert.equal(kinematics.active_type, activeType);
levels.protocol.push({ command, result: "verified", seq: result.seq, tick });
// POWER_ON is a selected-case startup prerequisite and is not part of the
// native switchkins action trace. Normalize the protocol action sequence so
// native/WASM compare the same user-visible M-code operations.
levels.protocol.push({ command, result: "verified", seq: index + 4, tick });
levels.control.push({ active_type: activeType, command, hal_pin: result.payload.remap.hal_pin, tick });
levels.state.push({ active_type: activeType, joints: kinematics.joints, pose: selectedPose(kinematics.pose), tick });
}