feat(pumpingstation): warn when control engages with no machine group registered
A station engaged above startLevel computes a real demand, but if no machine group is registered (e.g. the Port 2 parent↔group registration was dropped by a partial redeploy) the demand is silently forwarded nowhere and the pumps never react — invisible to the operator. levelBased now warns once when engaged with an empty machineGroups map (throttled via host._warnedNoMachineGroup, re-arms when a group reappears); manual.forwardDemand warns when neither a group nor a direct machine is registered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -253,6 +253,26 @@ async function run(ctx, controlState, direction) {
|
||||
`Level-based: level=${level} dir=${direction} armed=${shiftArmed} hold=${shiftHold} pct=${percControl}`
|
||||
);
|
||||
|
||||
// We are past every off-gate, so the station is engaged and the computed
|
||||
// demand is meant to drive pumps. If no machine group is registered the
|
||||
// demand has nowhere to go and the pumps stay silent — the signature of a
|
||||
// dropped Port 2 parent↔group registration (e.g. after a partial redeploy
|
||||
// that recreated this node). Warn once until a group reappears so the
|
||||
// failure isn't invisible.
|
||||
const groupCount = machineGroups ? Object.keys(machineGroups).length : 0;
|
||||
if (groupCount === 0) {
|
||||
if (host && !host._warnedNoMachineGroup) {
|
||||
logger?.warn?.(
|
||||
`Level-based control engaged (demand ${percControl.toFixed(1)} %) but no machine group is registered — `
|
||||
+ `pumps cannot be driven. The parent↔group registration was likely lost on a partial redeploy; `
|
||||
+ `redeploy/restart fully to re-run the Port 2 registration handshake.`
|
||||
);
|
||||
host._warnedNoMachineGroup = true;
|
||||
}
|
||||
} else if (host) {
|
||||
host._warnedNoMachineGroup = false;
|
||||
}
|
||||
|
||||
await _applyMachineGroupLevelControl(machineGroups, percControl, logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,18 @@ async function forwardDemand(ctx, demand) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Neither a group nor a direct machine is registered, so the operator's
|
||||
// demand silently goes nowhere. Surface it — the usual cause is a dropped
|
||||
// Port 2 parent↔child registration after a partial redeploy.
|
||||
const noGroups = !machineGroups || Object.keys(machineGroups).length === 0;
|
||||
const noMachines = !machines || Object.keys(machines).length === 0;
|
||||
if (noGroups && noMachines) {
|
||||
logger?.warn?.(
|
||||
`Manual demand ${demand} not forwarded — no machine group or machine is registered to this pumping station. `
|
||||
+ `Check the parent↔child Port 2 registration (redeploy/restart fully to restore it).`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user