diff --git a/src/specificClass.js b/src/specificClass.js index 2979856..99b697d 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -719,8 +719,17 @@ class MachineGroup { } async abortActiveMovements(reason = "new demand") { + // Safety net: in normal operation the _dispatchInFlight gate + // (handleInput) ensures no pump movement is in flight when a + // new dispatch starts, so this is a no-op. If a pump IS still + // moving here, the gate was bypassed (direct call to + // abortActiveMovements, mode change racing a dispatch, etc.) — + // surface that loudly so the bypass can be diagnosed. + const movementStates = new Set(['accelerating', 'decelerating']); await Promise.all(Object.values(this.machines).map(async machine => { - this.logger.warn(`Aborting active movements for machine ${machine.config.general.id} due to: ${reason}`); + const state = machine.state?.getCurrentState?.(); + if (!movementStates.has(state)) return; + this.logger.warn(`Force-aborting in-flight movement on ${machine.config.general.id} (state=${state}) due to: ${reason} — _dispatchInFlight gate bypassed.`); if (typeof machine.abortMovement === "function") { await machine.abortMovement(reason); }