PRICE-02: pin the modes-off identity with a digest that hides only the changed words
checks / unit (pull_request) Successful in 48m44s
infra-pin / fresh (pull_request) Successful in 2s

test_price_run_fixes.py part 5 and test_modes_p3.py part 1 compare the modes-off
replay with digests printed on older trees. The trade sentence now says
"price period", and a sale quotes another "above the cheapest" figure once the
first cheap period is over. ident.trade_digest() hides exactly those two
things; re-measured on e3e4ba6, 7a00f12, 90bc901 and this tree, the digests
are the same, so every command is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-10-22 08:20:50 +02:00
co-authored by Claude
parent 4297f7f3f1
commit ecd9822861
3 changed files with 49 additions and 29 deletions
+11 -19
View File
@@ -68,33 +68,25 @@ A, B = "inverter-a", "inverter-b"
print("1. modes off: byte-identical to 7a00f12 on the trade path")
# Printed on release/1.0 7a00f12 (2026-09-29), goodwe-addon-checks:1, 1080
# cycles each; the trade CHARGEs and DISCHARGEs. PRICE-02 (2026-10-22): the
# digest is over every row with the trade's SENTENCE left out (action and
# watts stay). The plan now drops price periods that have ended, so the
# sentence of a sale quotes a smaller "above the cheapest" figure once the
# first cheap period is over, and the idle sentence says "price period".
# Re-measured on 7a00f12, on release/1.0 90bc901 and on this tree: the same
# four digests, so no command, integrator or allocation moved.
# digest is `ident.trade_digest()`, which hides two things in the trade
# sentence: the "above the cheapest" figure (the plan now drops price periods
# that have ended, so it is another number once the first cheap period is
# over) and "hour" -> "price period". Re-measured with it on 7a00f12, on
# release/1.0 90bc901 and on this tree: the same four digests.
AT_7A00F12 = {
"n1": "2f3cf03655f19a172e83ccae1e1308a8eef9d1023ab632a68b943920b032800d",
"n2": "59ba1cbfe33aeca74d96b50dbcfde5337a8f82de0fde598a048afeef46fe64de",
"n1_off": "2f3cf03655f19a172e83ccae1e1308a8eef9d1023ab632a68b943920b032800d",
"n2_off": "59ba1cbfe33aeca74d96b50dbcfde5337a8f82de0fde598a048afeef46fe64de",
"n1": "33886ef03f364852883f0370230e6e04823fbb46a4704f88ca75bf9082d98c01",
"n2": "666a31f41491c22750720524853d95944d5fba395d1d14040c460d71414b275f",
"n1_off": "33886ef03f364852883f0370230e6e04823fbb46a4704f88ca75bf9082d98c01",
"n2_off": "666a31f41491c22750720524853d95944d5fba395d1d14040c460d71414b275f",
}
def _cmd_digest(rows):
"""`ident.digest()` over rows whose trade is (action, watts) only."""
return ident.digest([r[:-1] + (None if r[-1] is None else r[-1][:2],)
for r in rows])
_cmd_digest = ident.trade_digest
_rows = {k: ident.run(**ident.SCENARIOS[k])[0] for k in AT_7A00F12}
_got = {k: _cmd_digest(v) for k, v in _rows.items()}
for k in AT_7A00F12:
print(f" {k} {'same' if _got[k] == AT_7A00F12[k] else 'DIFFERS'} "
f"{_got[k][:16]}")
check("with battery modes off (option absent or false), every command, "
"integrator, allocation and trade action equals 7a00f12's, at one "
"integrator, allocation and trade sentence equals 7a00f12's, at one "
"inverter and at two", _got == AT_7A00F12)
_acts = {r[-1][0] for r in _rows["n2"] if r[-1]}
check("...and the runs reach the trade P3 now skips with modes on: a charge "