B1.4: cooldown-guard ROOT CAUSE — schema strip of constraint keys

Root cause: configUtils.initConfig was silently stripping the four
unknown constraint keys (nominalFlowMin, flowMax, maxRainRef,
minSampleIntervalSec) because they weren't declared in the schema.
With those keys gone, validateFlowBounds saw NaN/NaN and routed every
i_start into the invalid-bounds branch — _beginRun never fired, so
sumPuls stayed 0.

Fix is in generalFunctions/src/configs/monster.json (declared the
four keys with sensible defaults). Plus a 4-line comment at the guard
site documenting the schema dependency. 10/10 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-11 17:29:17 +02:00
parent 2aa7f88f03
commit 0038a8c2c2

View File

@@ -17,6 +17,10 @@ function applyBoundsAndTargets(m) {
} }
function validateFlowBounds(m) { function validateFlowBounds(m) {
// nominalFlowMin / flowMax must be declared in monster.json's `constraints`
// section. If they aren't, configUtils strips them as unknown keys and the
// bounds collapse to undefined → NaN → invalid here, which silently blocks
// every sampling run. (Fixed 2026-05-11.)
const min = Number(m.nominalFlowMin); const min = Number(m.nominalFlowMin);
const max = Number(m.flowMax); const max = Number(m.flowMax);
const valid = Number.isFinite(min) && Number.isFinite(max) && min >= 0 && max > 0 && min < max; const valid = Number.isFinite(min) && Number.isFinite(max) && min >= 0 && max > 0 && min < max;