feat(commands): unit shorthand + collapse duplicated value/unit parsing; wiki sync

- 5 descriptors -> unit: shorthand (cmd.calibrate.volume/level, set.inflow/
  outflow/demand).
- setInflow/setOutflow: drop the hand-rolled scalar-vs-object parsing — the
  registry now normalises every shape to a number in the descriptor unit; the
  handlers become guarded one-liners (matching setDemand).
- Regenerate wiki topic-contract + command-envelope note (msg.origin).

143/143 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-29 18:41:32 +02:00
parent fc6491dc23
commit e47de87adb
3 changed files with 36 additions and 45 deletions

View File

@@ -26,9 +26,10 @@ module.exports = [
{
topic: 'cmd.calibrate.volume',
aliases: ['calibratePredictedVolume'],
// any: payload may be a number or numeric string.
// any: payload may be a number, numeric string, or { value, unit } object —
// the registry normalises all of them to a number in `unit` before the handler.
payloadSchema: { type: 'any' },
units: { measure: 'volume', default: 'm3' },
unit: 'm3',
description: 'Calibrate the predicted-volume integrator to a known basin volume.',
handler: handlers.calibrateVolume,
},
@@ -36,16 +37,15 @@ module.exports = [
topic: 'cmd.calibrate.level',
aliases: ['calibratePredictedLevel'],
payloadSchema: { type: 'any' },
units: { measure: 'length', default: 'm' },
unit: 'm',
description: 'Calibrate the predicted-volume integrator to a known basin level.',
handler: handlers.calibrateLevel,
},
{
topic: 'set.inflow',
aliases: ['q_in'],
// any: number, numeric string, or { value, unit, timestamp } object.
payloadSchema: { type: 'any' },
units: { measure: 'volumeFlowRate', default: 'm3/h' },
unit: 'm3/h',
description: 'Push a measured inflow value into the basin balance.',
handler: handlers.setInflow,
},
@@ -53,7 +53,7 @@ module.exports = [
topic: 'set.outflow',
aliases: ['q_out'],
payloadSchema: { type: 'any' },
units: { measure: 'volumeFlowRate', default: 'm3/h' },
unit: 'm3/h',
description: 'Push a measured outflow value into the basin balance.',
handler: handlers.setOutflow,
},
@@ -61,7 +61,7 @@ module.exports = [
topic: 'set.demand',
aliases: ['Qd'],
payloadSchema: { type: 'any' },
units: { measure: 'volumeFlowRate', default: 'm3/h' },
unit: 'm3/h',
description: 'Operator outflow demand setpoint for the station.',
handler: handlers.setDemand,
},