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

@@ -8,7 +8,8 @@ const { validateThresholdOrdering } = require('../../src/basin/thresholdValidato
const BasinGeometry = require('../../src/basin/BasinGeometry');
// A valid baseline: outlet 0.2 < inflow 3 < overflow 4.5 ≤ height 5,
// dryRun = 0.2 * 1.10 = 0.22 ≤ minLevel 1 ≤ start 2 < max 4 ≤ overfill 4.275.
// dryRun = 0.2 * 1.10 = 0.22 ≤ minLevel 1 ≤ start 2 < max 4
// ≤ highVolumeSafetyLevel 4.275.
function validBasinAndCfg() {
const basin = new BasinGeometry(
{ volume: 50, height: 5, inflowLevel: 3, outflowLevel: 0.2, overflowLevel: 4.5 },
@@ -40,17 +41,17 @@ test('outflowLevel >= inflowLevel triggers issue with correct shape', () => {
assert.match(hit.msg, /outflowLevel.*<.*inflowLevel/);
});
test('maxLevel >= overfillLevel triggers issue', () => {
test('maxLevel >= highVolumeSafetyLevel triggers issue', () => {
const { basin } = validBasinAndCfg();
// overfillLevel = overflowLevel × overfillPct/100 = 4.5 × 0.80 = 3.6.
// maxLevel 4 > 3.6 → expect a `maxLevel <= overfillLevel` issue.
// highVolumeSafetyLevel = overflowLevel × highPct/100 = 4.5 × 0.80 = 3.6.
// maxLevel 4 > 3.6 → expect a `maxLevel <= highVolumeSafetyLevel` issue.
const issues = validateThresholdOrdering(
basin,
{ minLevel: 1, startLevel: 2, maxLevel: 4 },
{ dryRunThresholdPercent: 10, overfillThresholdPercent: 80 }
);
const hit = issues.find((i) => i.aName === 'maxLevel' && i.bName === 'overfillLevel');
assert.ok(hit, 'expected a maxLevel <= overfillLevel issue');
const hit = issues.find((i) => i.aName === 'maxLevel' && i.bName === 'highVolumeSafetyLevel');
assert.ok(hit, 'expected a maxLevel <= highVolumeSafetyLevel issue');
assert.equal(hit.op, '<=');
assert.equal(hit.a, 4);
assert.ok(Math.abs(hit.b - 3.6) < 1e-9);
@@ -66,7 +67,7 @@ test('NaN / undefined values are skipped, not flagged as issues', () => {
// dryRunLevel <= minLevel skipped (minLevel undefined → NaN)
// minLevel <= startLevel skipped (both NaN-ish)
// startLevel < maxLevel skipped (startLevel NaN)
// maxLevel <= overfillLevel still checked → 4 ≤ 4.275 OK.
// maxLevel <= highVolumeSafetyLevel still checked → 4 ≤ 4.275 OK.
// Geometry checks also OK.
assert.deepEqual(issues, []);
});