B1.2: drop legacy 'overfillLevel' alias from thresholdValidator

Decision 2026-05-11: 'highVolumeSafetyLevel' is canonical. The legacy
'overfillLevel' name is gone from computeSafetyPoints + the validator
issue tuple. 'overfillVol' parallel alias kept (out of scope for this
task; flagged for follow-up). 130/130 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-11 17:13:21 +02:00
parent e991ea64ef
commit ef81013e96
2 changed files with 19 additions and 24 deletions

View File

@@ -19,8 +19,8 @@ function computeSafetyPoints(basin, safety = {}) {
const dryRunPct = Number(safety.dryRunThresholdPercent) || 0;
const rawHighPct = safety.highVolumeSafetyThresholdPercent ?? safety.overfillThresholdPercent;
// When neither high-volume nor overfill pct is supplied, use 100 % so
// the validator's `maxLevel <= overfillLevel` check is a no-op (the
// basin can't physically exceed overflow anyway). Tests pin this.
// the validator's `maxLevel <= highVolumeSafetyLevel` check is a no-op
// (the basin can't physically exceed overflow anyway). Tests pin this.
const highPct = Number(rawHighPct);
const effectiveHighPct = Number.isFinite(highPct) ? highPct : 100;
const minVol = Number(basin?.minVol) || 0;
@@ -41,7 +41,6 @@ function computeSafetyPoints(basin, safety = {}) {
highVolumeSafetyVol,
highVolumeSafetyLevel,
// Back-compat alias — pre-basin-docs name.
overfillLevel: highVolumeSafetyLevel,
overfillVol: highVolumeSafetyVol,
};
}
@@ -55,22 +54,17 @@ function computeSafetyPoints(basin, safety = {}) {
function validateThresholdOrdering(basin, levelbased, safety) {
const lvl = levelbased || {};
const points = computeSafetyPoints(basin, safety);
const { dryRunLevel, overfillLevel } = points;
const { dryRunLevel, highVolumeSafetyLevel } = points;
// basin-docs added `startLevel <= inflowLevel` and `inflowLevel <
// maxLevel`; HEAD had only the `startLevel < maxLevel` and
// `maxLevel <= overfillLevel` checks. We keep the `overfillLevel`
// name (rather than basin-docs's `highVolumeSafetyLevel`) for
// back-compat with consumers reading issue.bName.
const checks = [
['outflowLevel', basin.outflowLevel, '<', 'inflowLevel', basin.inflowLevel],
['inflowLevel', basin.inflowLevel, '<', 'overflowLevel', basin.overflowLevel],
['overflowLevel', basin.overflowLevel, '<=', 'basinHeight', basin.heightBasin],
['dryRunLevel', dryRunLevel, '<=', 'minLevel', lvl.minLevel],
['minLevel', lvl.minLevel, '<=', 'startLevel', lvl.startLevel],
['startLevel', lvl.startLevel, '<=', 'inflowLevel', basin.inflowLevel],
['startLevel', lvl.startLevel, '<', 'maxLevel', lvl.maxLevel],
['maxLevel', lvl.maxLevel, '<=', 'overfillLevel', overfillLevel],
['outflowLevel', basin.outflowLevel, '<', 'inflowLevel', basin.inflowLevel],
['inflowLevel', basin.inflowLevel, '<', 'overflowLevel', basin.overflowLevel],
['overflowLevel', basin.overflowLevel, '<=', 'basinHeight', basin.heightBasin],
['dryRunLevel', dryRunLevel, '<=', 'minLevel', lvl.minLevel],
['minLevel', lvl.minLevel, '<=', 'startLevel', lvl.startLevel],
['startLevel', lvl.startLevel, '<=', 'inflowLevel', basin.inflowLevel],
['startLevel', lvl.startLevel, '<', 'maxLevel', lvl.maxLevel],
['maxLevel', lvl.maxLevel, '<=', 'highVolumeSafetyLevel', highVolumeSafetyLevel],
];
const issues = [];