SAFETY-119: re-pin test_safety84/87 digests (log only); prove it
The re-pinned digests differ only in OUTPUT_CLAMP log rows; every command and claim is the same as without the fix (test_safety119.py part 5). DECISIONS: the delay at a 5 s meter and the open swap case. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
c4e15ec4cd
commit
b0c2e5977d
@@ -22,6 +22,8 @@ DECISIONS/SAFETY-119-bound-after-hand-back.md.
|
||||
3. With a usable forecast: the same commands and the same alarms as without
|
||||
the fix.
|
||||
4. The rule at its boundaries (`Controller._settling`).
|
||||
5. test_safety84's and test_safety87's re-pinned digests: the same commands
|
||||
and claims; only OUTPUT_CLAMP log rows differ.
|
||||
|
||||
Mutations (MUTATION.md, purged copies) are listed in the pull request.
|
||||
"""
|
||||
@@ -81,7 +83,8 @@ def _power(self, u, lag=1.0):
|
||||
return float(round(a))
|
||||
|
||||
|
||||
_real_number = rig._Hass.number
|
||||
_real_number, _real_power = rig._Hass.number, rig._Hass.power
|
||||
_real_feed = s79._feed
|
||||
|
||||
|
||||
async def _number(self, e, invert=False):
|
||||
@@ -338,6 +341,43 @@ _ctl._loop_alarm_input(_Res())
|
||||
check("a stop clears it: the next start is not a hand-back",
|
||||
(_ctl._wire_lost, _ctl._handback) == (False, None))
|
||||
|
||||
# ============================================================================ #
|
||||
print("\n5. the pinned digests of test_safety84 and test_safety87: only the "
|
||||
"log changes")
|
||||
# Those harnesses run at the 5 s tick with a battery that follows at once.
|
||||
rig._Hass.power, rig.TICK, s79._feed = _real_power, 5.0, _real_feed
|
||||
rig._Hass.number = _real_number
|
||||
import safety87_identity as s87 # noqa: E402
|
||||
|
||||
RUNS = dict({f"s84 {k}": (lambda v=v: s84.run(**v))
|
||||
for k, v in s84.SCENARIOS.items()},
|
||||
**{f"s87 {k}": (lambda v=v: s87_run(v))
|
||||
for k, v in s87.SCENARIOS.items()})
|
||||
|
||||
|
||||
def s87_run(v):
|
||||
v = dict(v)
|
||||
return s84.run(1, dur=s87.DUR, store=s87.store(v.pop("store", None)), **v)
|
||||
|
||||
|
||||
_moved, _gone = [], 0
|
||||
for k, fn in RUNS.items():
|
||||
new, old = fn()[0], no_fix(fn)[0]
|
||||
same = all(a[:-1] == b[:-1] and a[-1][:4] == b[-1][:4]
|
||||
for a, b in zip(new, old)) and len(new) == len(old)
|
||||
logs = {e for r in old for e in [r[-1][5]] if e} - {
|
||||
e for r in new for e in [r[-1][5]] if e}
|
||||
_gone += len(logs)
|
||||
if not same or any("OUTPUT_CLAMP episode" not in e for e in logs):
|
||||
_moved.append(k)
|
||||
print(f" {k}: commands and claims "
|
||||
f"{'the same' if same else 'DIFFER'}, log rows differ {len(logs)}, "
|
||||
f"digest {s84.digest(new)[:16]}")
|
||||
check("⭐ in all twelve, every command, loop field, claim, guard decision "
|
||||
"and phase is the same as without the fix; the only log rows that "
|
||||
"differ are OUTPUT_CLAMP rows (gone, or a lower count)",
|
||||
not _moved and _gone > 0)
|
||||
|
||||
print()
|
||||
if fails:
|
||||
print(f"FAILED: {len(fails)} check(s)")
|
||||
|
||||
Reference in New Issue
Block a user