OPT-11 P1 review: a mode never beats the peak floor; SAFETY-03 kept at the rail
checks / unit (pull_request) Successful in 11m4s
infra-pin / fresh (pull_request) Successful in 2s

- arbiter: a mode now gives way only as far as a site limit above P_MODE
  needs (_unit_modes at N>1, _site_mode at N=1). Before, the modes were
  released only when the peak floor bound S, so a trade won above the floor
  kept them and placed less than the floor (an Off battery at N=1 went to 0 W
  under a 2000 W floor), and a capped grid charge released an Off battery.
  While released, held batteries weigh 0 and carry only the shortfall.
- control: a side of the loop bound that reaches the rail is left to the
  rail, so SAFETY-03's i_clamped still fires with every battery on.
- opt11_identity: add maintenance scenarios and a 6000-case arbiter digest
  (peak floor, trades, maintenance, refusals); a5dddad digests pinned.
- tests: test_arbiter part 11, test_control (g), test_modes (0/1 refused,
  loop bound counts live units only). DOCS and DECISIONS say the new rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UBtqPrG1mDLXzTEBnhEkkV
This commit is contained in:
glenn schrooyen
2026-09-28 19:41:36 +02:00
co-authored by Claude Opus 5.5
parent d69fd8fbfd
commit ffc9a4d721
10 changed files with 365 additions and 40 deletions
+24
View File
@@ -1268,6 +1268,30 @@ for _ in range(4000):
check("a bound wider than the rail changes no Decision (4000 random cycles)",
_wide)
# (g) Review of PR #149: a bound EQUAL to the rail - every battery on, the
# default once modes are on - must leave SAFETY-03 exactly as it was. Before
# the fix the mode clamp ran first and took `i_clamped` away from the rail.
_rail_same, _rail_hits = True, 0
for _tb in (TB, Tuning(gain=0.6, max_w=5000.0, slew_w=400.0, deadband_w=15.0,
step_w=10, target_grid_w=-10.0,
integrator_max_w=7000.0)):
_lim = _tb.max_w
for _ in range(4000):
args = (_rngc.uniform(-5000, 5000), _rngc.uniform(-12000, 12000),
_rngc.uniform(-5000, 5000), _tb, _rngc.randint(0, 5),
_rngc.choice((None, _rngc.uniform(-8000, 8000))))
_d0 = compute(*args)
_rail_hits += _d0.i_clamped
if compute(*args, bound=(-_lim, _lim)) != _d0:
_rail_same = False
check(f"a bound equal to the rail changes no Decision, SAFETY-03's i_clamped "
f"included ({_rail_hits} of 8000 random cycles wind into the rail), and "
f"with integrator_max_w above max_w too", _rail_same and _rail_hits > 100)
_one_side = compute(4000.0, 12000.0, 4000.0, TB, 0, 4990.0,
bound=(0.0, 5000.0))
check("...and a bound that closes only the other side still lets the rail "
"flag a loop winding into it", _one_side.i_clamped)
print()
if fails:
print(f"{len(fails)} FAILED: {', '.join(fails)}")