Preserve Web machine reset protocol continuity

This commit is contained in:
2026-08-28 22:54:51 +08:00
parent cbd0bc1003
commit a97971ea19
7 changed files with 53 additions and 35 deletions

View File

@@ -4,10 +4,12 @@
"authority": "linuxcnc-wasm-worker",
"case": "linuxcnc/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini",
"gates": {
"mdi_requires_home": true,
"off_blocks_motion": true,
"pause_resume_exclusive": true,
"running_blocks_manual": true,
"running_blocks_power_off": true
"power_off_aborts_running": true,
"running_allows_power_off": true,
"running_blocks_manual": true
},
"schema": "xyzac-button-constraints.v1",
"sequence": [
@@ -22,7 +24,7 @@
"ABORT",
"ESTOP"
],
"state_hash": "fnv1a64:71e86a767aa1a074",
"state_hash": "fnv1a64:d4bf8b7256c7300a",
"status": "verified"
},
"candidate_eligible": true,
@@ -97,7 +99,7 @@
}
},
"release_status": "STOP_RELEASE",
"report_sha256": "7fc97babb800be213cb6fc8be5bde213dec2d16905198bfaa5fbb9b1a5f2d24a",
"report_sha256": "d8422ee0001675094cbcba651f85e438bda4b3c45491823d61d32b1dca1f492c",
"schema": "xyzac-gate-matrix-rtcp-03.v1",
"scope": "xyzac_only",
"state_hash": "fnv1a64:7014ca3ef3a4a3dd",
@@ -118,7 +120,7 @@
"node",
"web/worker/test_xyzac_button_constraints.mjs"
],
"output_sha256": "b9e6345ebba8dd794f8d407c68e208565a2b849f9fbfb184b3cc00b38927834e",
"output_sha256": "872cd1a9293f6db876daa5692734ff2b695410417fc7b3b2db8490281a86db62",
"returncode": 0,
"status": "verified"
}

View File

@@ -205,7 +205,7 @@
"recovery": "Chromium SIGKILL/profile-reopen, corruption detection and Firefox OPFS round-trip are verified"
},
"release_status": "STOP_RELEASE",
"report_sha256": "2ca53b1aa5e691f44280473301772ac7dcace0f492fc309ebacb1f66677bfdff",
"report_sha256": "a294fdb56b21d9a8bddca753229d41b045e3b7887a1cf2f5e255c32e2da1fabd",
"scans": {
"js_gcode_matches": [
{
@@ -292,7 +292,7 @@
"opfs_writer_matches": [
{
"line": 1,
"path": "web/react/dist/assets/sim-worker-entry-DUl-hrwT.js",
"path": "web/react/dist/assets/sim-worker-entry-DqcdiXWu.js",
"text": "(function(){var e=(()=>{var e=self.location.href;return(function(t){t||={};var t=t===void 0?{}:t,n,r;t.ready=new Promise(function(e,t){n=e,r=t});var i=Object.assign({},t),a=[],o=typeof window==`object`,s=typeof importScripts==`function`;typ"
},
{
@@ -1968,7 +1968,7 @@
},
{
"path": "web/worker/test_xyzac_button_constraints.mjs",
"sha256": "faf7aa191e66b4c7a2f4642db19ee7b1712e7781ab474502ab1b01585554c1d0"
"sha256": "4fd9712eb20a0d58465489f0e73492097c34bac46ebd1ec7e9a06c80c75af4e9"
},
{
"path": "web/worker/test_xyzac_exact_preview.mjs",

View File

@@ -57,8 +57,8 @@
},
"recovery": {
"at_checkpoint_equal": true,
"continuous_hash": "fnv1a64:b105b6fc1bcc8a70",
"restored_hash": "fnv1a64:857caa278d03c259",
"continuous_hash": "fnv1a64:dc228a5abee74af6",
"restored_hash": "fnv1a64:6c4a6b85b192d794",
"status": "verified"
},
"scope_exclusions": {
@@ -96,7 +96,7 @@
"failure_samples": [],
"input": {
"path": "coverage/xyzac-trt-web-wasm-parity.report.json",
"sha256": "6e4935ebe55b771bb9a7f831b50cadda9ba7b10e09cb4b495d29faee6cf86f80"
"sha256": "1ef84b02927a83c4221c11ecd896ac9a3a8d4ec1febc5363c6088ef04202a84f"
},
"known_blockers": [
"STOP_RELEASE is intentional until an owner authorizes scope expansion"
@@ -104,7 +104,7 @@
"outputs": [],
"release_decision": "selected_case_verified_but_release_stopped_by_scope_exclusions",
"release_status": "STOP_RELEASE",
"report_sha256": "971e5b6ec19213d5bbdf414e65868fd440391e9e27579d3d3bf5b3186c741816",
"report_sha256": "98269d8e9f60e22cc65c1eceff0ad714a614d368bdec9b20b14048db7114ce7f",
"schema": "xyzac-trt-wasm-only-release-gate.v1",
"status": "verified",
"task_id": "RELEASE-00"

View File

@@ -86,27 +86,27 @@
},
"recovery": {
"at_checkpoint_equal": true,
"continuous_hash": "fnv1a64:b105b6fc1bcc8a70",
"restored_hash": "fnv1a64:857caa278d03c259"
"continuous_hash": "fnv1a64:dc228a5abee74af6",
"restored_hash": "fnv1a64:6c4a6b85b192d794"
},
"release_status": "STOP_RELEASE",
"report_hashes": {
"coverage/xyzac-trt-gate-matrix.report.json": "b2a74bc5e8440728dbbbfb917ae1949e6acae9c4c1f973649e4b19edd8755034",
"coverage/xyzac-trt-hal-tool-alarm.report.json": "99ac60c9a2d58f08063ffc07f0c2eea62d8ec97212d6d2b74d6c139f176b592e",
"coverage/xyzac-trt-manual-control.report.json": "9ebb8ef2c97a57d77666c92e210ad1415a63852730b37993f995ca95cbc275b5",
"coverage/xyzac-trt-program-preview.report.json": "b95a59986c0bd0cb098c49fbc8c9ced80bbe024888dcbcc14c15dd6e67432814",
"coverage/xyzac-trt-protocol-react.report.json": "1179b708f9f3185ea7cbd66f97aed984cfc22bcc4f35ea3d30293183e9bce011",
"coverage/xyzac-trt-recovery.report.json": "351b3d5f51a6ef38f34c5e42f318a3b565618ebecf122f5d21d83ef8a54f2b4e",
"coverage/xyzac-trt-gate-matrix.report.json": "6b1d7fa299ceaf6d9a355fc3d201dd872b586e8cbd3042f886b6be9ffa990603",
"coverage/xyzac-trt-hal-tool-alarm.report.json": "666fb1273c2471cd5869aea83e847a657309ee8cb4915713e25f4a99c94b3943",
"coverage/xyzac-trt-manual-control.report.json": "bd38d4f20322ae3e246438740b3e35827ab2ac6b7b16b8cee22920d2c24c1847",
"coverage/xyzac-trt-program-preview.report.json": "c4db73f5ebe63e26921425d44c9e914ca453300a54f51b9da05d709a9e68cf15",
"coverage/xyzac-trt-protocol-react.report.json": "af78f0fd639fca95c5406b8afdcf5305225d97aba448637745bd5a941aa19689",
"coverage/xyzac-trt-recovery.report.json": "4452efdf6de6975221f4944bda53688bbb5be5b256525cf0d4f108408d8191da",
"coverage/xyzac-trt-rtcp.report.json": "b1562d6d2c9cd5144c7c8c9b334bd8bf67919ea7297f103ec67cb32773608d08",
"coverage/xyzac-trt-source-slice-inventory.report.json": "bf5f3fd36e1943e0dc42bafb2ed195fad147bcb3e56a8d208d7f01a3641829de",
"coverage/xyzac-trt-startup.report.json": "56e040b645bcefc3d6c57244cb2d3aba16f421ff5137089d9c3336970dfd968b",
"coverage/xyzac-trt-threejs.report.json": "5172d7118c555fca5f92bcb443b9c259ea0225346482558d4c33ef8a4f8da5cb",
"coverage/xyzac-trt-tool-preview.report.json": "e7093b1039a26fd62c3352f9260989a120902e3a88b4c68b751f47f05f495b05",
"coverage/xyzac-trt-tool-preview.report.json": "09b670a1c952d0629a19bce1cf584a37b92bacb1d6a5c1430fc939cd2668a3ea",
"coverage/xyzac-trt-trace-parity.report.json": "6c6b3500bc1189ff68513b74f0e5144879c3af7641349cb61737191303b76950",
"coverage/xyzac-trt-wasm-authority-audit.report.json": "19fd46cca7043ed633f55cae0d7cdd3bf8bda96567fdc93cc047da39e766f9f9",
"coverage/xyzac-trt-workflow.report.json": "acbb6dcfdff385dc839ddb94724f9fdcebc391ccde995881ba6be14dd5a6b5c4"
"coverage/xyzac-trt-wasm-authority-audit.report.json": "4f5431e951c4384c90e4ef31988189dc4f1018ddfc9d0f5e76e8f89ac09557be",
"coverage/xyzac-trt-workflow.report.json": "9d0ed087b17ec14c906f4268d2d616dbc3800da03f731376b2ef9ae44ca5c6e7"
},
"report_sha256": "888838e4d4242ff562530eb547fa3ed6dafc940502e822b182d8abf4a9ddb4d2",
"report_sha256": "8c182cef79f750228660479587d5fa12675479dc898ba353f52e57e63b604dfb",
"schema": "xyzac-trt-web-wasm-parity-report.v1",
"source_coverage": {
"axis_keyboard": 10,

View File

@@ -77,7 +77,14 @@ int32_t sim_protocol_accept(uint32_t schema_version, uint32_t seq,
else if (is_kind(kind, "PROGRAM_PAUSE")) state.state = SIM_PROTOCOL_PAUSED;
else if (is_kind(kind, "PROGRAM_RESUME") || is_kind(kind, "RESUME")) state.state = SIM_PROTOCOL_READY;
else if (is_kind(kind, "DESTROY")) state.state = SIM_PROTOCOL_DESTROYED;
else if (is_kind(kind, "RESET")) sim_protocol_reset();
else if (is_kind(kind, "RESET")) {
/* RESET is a machine/task reset once attached. Keep the transport
sequence alive so a Web client can continue issuing commands. A
RESET received after DESTROY remains the protocol reinitialization
edge used by the session lifecycle. */
if (state.state == SIM_PROTOCOL_DESTROYED) sim_protocol_reset();
else state.state = SIM_PROTOCOL_READY;
}
return SIM_PROTOCOL_OK;
}

View File

@@ -11,14 +11,16 @@ int main(void) {
assert(sim_protocol_state_value() == SIM_PROTOCOL_READY);
assert(sim_protocol_accept(1, 3, "MDI_EXECUTE", NULL, 0) == SIM_PROTOCOL_ERR_OPERATION_ID);
assert(sim_protocol_accept(1, 3, "MDI_EXECUTE", "op-3", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 4, "PROGRAM_PAUSE", "op-4", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 5, "MDI_EXECUTE", "op-5", 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 5, "PROGRAM_RESUME", "op-5", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(2, 6, "PING", NULL, 2) == SIM_PROTOCOL_ERR_SCHEMA);
assert(sim_protocol_accept(1, 6, "PING", NULL, 1) == SIM_PROTOCOL_ERR_TICK);
assert(sim_protocol_accept(1, 6, "DESTROY", NULL, 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 7, "PING", NULL, 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 8, "RESET", "reset-1", 0) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 4, "RESET", "reset-machine", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_last_seq() == 4);
assert(sim_protocol_accept(1, 5, "PROGRAM_PAUSE", "op-4", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 6, "MDI_EXECUTE", "op-5", 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 6, "PROGRAM_RESUME", "op-5", 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(2, 7, "PING", NULL, 2) == SIM_PROTOCOL_ERR_SCHEMA);
assert(sim_protocol_accept(1, 7, "PING", NULL, 1) == SIM_PROTOCOL_ERR_TICK);
assert(sim_protocol_accept(1, 7, "DESTROY", NULL, 2) == SIM_PROTOCOL_OK);
assert(sim_protocol_accept(1, 8, "PING", NULL, 2) == SIM_PROTOCOL_ERR_STATE);
assert(sim_protocol_accept(1, 9, "RESET", "reset-1", 0) == SIM_PROTOCOL_OK);
assert(sim_protocol_state_value() == SIM_PROTOCOL_NEW);
assert(sim_protocol_set_tick(4) == SIM_PROTOCOL_ERR_TICK);
return 0;

View File

@@ -21,6 +21,9 @@ send("SESSION_ATTACH");
const loaded = send("LOAD_WORKSPACE", { root_path: "/workspace", configuration: toWorkerConfiguration(bundle) });
assert.equal(loaded.payload.panel_snapshot.axis_state.machine_state, "ESTOP_RESET");
assert.equal(send("PROGRAM_LOAD", { source: PROGRAM, path: "button.ngc" }).payload.status, "verified");
assert.equal(send("RESET").payload.gate_reason, "xyzac_machine_off");
const restarted = send("PROGRAM_RESTART");
assert.equal(restarted.payload.program.path, "button.ngc");
for (const [kind, payload, reason] of [["PROGRAM_RUN", {}, "xyzac_machine_off"], ["HOME", { all: true }, "xyzac_machine_off"], ["JOG_START", { axis: "x", direction: 1, speed: 1 }, "xyzac_machine_off"], ["MDI_EXECUTE", { block: "G0 X1" }, "xyzac_machine_off"], ["KINEMATICS_SELECT", { type: 1 }, "xyzac_machine_off"], ["POWER", { active: false }, "xyzac_power_already_off"]]) {
const blocked = send(kind, payload);
@@ -32,12 +35,16 @@ const powered = send("POWER", { active: true });
assert.equal(powered.payload.panel_snapshot.axis_state.machine_state, "ON");
assert.equal(send("HOME", { all: true }).payload.wasm_home_limit.state.homed, true);
assert.equal(send("KINEMATICS_SELECT", { type: 1 }).payload.kinematics.active_type, 1);
assert.equal(send("RESET").payload.command, "RESET");
assert.equal(send("MDI_EXECUTE", { block: "G0 X1" }).payload.task.mode, "MDI");
assert.equal(send("JOG_STOP").payload.command, "JOG_STOP");
assert.equal(send("SET_MODE", { mode: "MANUAL" }).payload.mode, "MANUAL");
assert.equal(send("POWER", { active: false }).payload.panel_snapshot.axis_state.machine_state, "OFF");
assert.equal(send("PROGRAM_RUN").payload.gate_reason, "xyzac_machine_off");
assert.equal(send("POWER", { active: true }).payload.panel_snapshot.axis_state.machine_state, "ON");
assert.equal(send("PROGRAM_RUN").payload.task.state, "RUNNING");
for (const [kind, payload, reason] of [["HOME", { all: true }, "xyzac_interp_running"], ["MDI_EXECUTE", { block: "G0 X1" }, "mdi_while_program_active"], ["KINEMATICS_SELECT", { type: 0 }, "xyzac_interp_running"]]) {
for (const [kind, payload, reason] of [["HOME", { all: true }, "xyzac_interp_running"], ["MDI_EXECUTE", { block: "G0 X1" }, "mdi_while_program_active"], ["KINEMATICS_SELECT", { type: 0 }, "xyzac_interp_running"], ["SET_MODE", { mode: "MANUAL" }, "linuxcnc_wasm_auto_interp_active"]]) {
const blocked = send(kind, payload);
assert.equal(blocked.kind, "ERROR", kind);
assert.equal(blocked.payload.gate_reason, reason, kind);
@@ -59,6 +66,6 @@ console.log(JSON.stringify({
case: CASE,
sequence: ["ESTOP", "ESTOP_RESET", "POWER_ON", "HOME", "IDLE", "RUNNING", "PAUSED", "RESUME", "ABORT", "ESTOP"],
authority: "linuxcnc-wasm-worker",
gates: { off_blocks_motion: true, running_blocks_manual: true, running_blocks_power_off: true, pause_resume_exclusive: true },
gates: { off_blocks_motion: true, running_blocks_manual: true, running_allows_power_off: true, power_off_aborts_running: true, pause_resume_exclusive: true, mdi_requires_home: true },
state_hash: reset.payload.panel_snapshot.state_hash,
}));