Merge release/1.0 (SAFETY-07) into FCST-03, and close two degenerate stimuli
checks / unit (pull_request) Successful in 3m13s
checks / unit (pull_request) Successful in 3m13s
CHANGELOG.md was the entire collision - SAFETY-07 lands in peakguard.py, main.py and the arbiter, none of which this branch touches. Both entries kept. X1. `_firm_or_die` guarding only `cheapest` survived, because the check passed the SAME provisional point as both cheapest and dearest: a guard on either role alone raises, so the stimulus could not tell "the buy hour is guarded" from "both are". Now one call per role with a firm point in the other seat, plus the positive arm so the two refusals are discriminating. X6. `firm_points()` returning the carried hours too survived, because its two consumers - the §11.4 refusal and cheap_now - guard provenance independently and both keep answering correctly. The accessor is now graded directly: exactly the published points, by identity and in order. Both are the degeneracy rule this file states at the top, in a new dress - a stimulus that cannot distinguish the two things it grades. ⚠️ AND THE REASON THE M9 MUTATION "SURVIVED" IN MY EARLIER REPORT: a stale __pycache__. Reverting `self.provisional` to `here.provisional` changes neither the file size nor, at one-second resolution, the mtime, so CPython kept the MUTATED bytecode and a green run afterwards proved nothing about that line. Every mutation here now clears __pycache__ first; re-run that way, M9 is caught. The committed source was always correct - the checks were not being run against it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015VXjA3LWccN1rJsk3okyPC
This commit is contained in:
@@ -595,12 +595,33 @@ check("...so a block with no reason is a TypeError at the call site, not a "
|
||||
and raises(lambda: Gate.block(""), ValueError))
|
||||
check("...and the same holds for the refusal FCST-03 added to Arbitrage",
|
||||
raises(lambda: Arbitrage.refuse(), TypeError))
|
||||
check("an ALLOWED arbitrage verdict cannot be constructed around a provisional "
|
||||
"hour even directly - §8.3 is enforced at the constructor, not only in "
|
||||
"the ladder above it",
|
||||
raises(lambda: Arbitrage.allow(0.1, _prov_pt, _prov_pt, "normal",
|
||||
# ⚠️ ONE CALL PER ROLE, AND THE FIRST DRAFT SHOWED WHY. Passing the provisional
|
||||
# point as BOTH `cheapest` and `dearest` is a stimulus that cannot distinguish
|
||||
# "the constructor guards the cheapest hour" from "the constructor guards both
|
||||
# hours": a guard on either one alone raises, and the check goes green for an
|
||||
# implementation that leaves the sell hour unguarded. That is the degeneracy
|
||||
# rule this file states at the top, in a new dress - so the two roles are
|
||||
# stimulated SEPARATELY, each with a firm point in the other seat.
|
||||
_firm_pt = TODAY_PART.points[0]
|
||||
check("the two points these constructor checks use really differ in provenance, "
|
||||
"or neither of them grades anything",
|
||||
_prov_pt.provisional is True and _firm_pt.provisional is False)
|
||||
check("an ALLOWED arbitrage verdict cannot be constructed with a provisional "
|
||||
"CHEAPEST hour - the buy hour - even directly: §8.3 is enforced at the "
|
||||
"constructor, not only in the ladder above it",
|
||||
raises(lambda: Arbitrage.allow(0.1, _prov_pt, _firm_pt, "normal",
|
||||
PriceProduct.DAY_AHEAD, 0.0, frozenset()),
|
||||
ValueError))
|
||||
check("...nor with a provisional DEAREST hour - the sell hour - which a guard "
|
||||
"written for `cheapest` alone would have let through",
|
||||
raises(lambda: Arbitrage.allow(0.1, _firm_pt, _prov_pt, "normal",
|
||||
PriceProduct.DAY_AHEAD, 0.0, frozenset()),
|
||||
ValueError))
|
||||
check("...while two firm points build the verdict perfectly well, so the two "
|
||||
"refusals above are discriminating rather than universal",
|
||||
Arbitrage.allow(0.1, _firm_pt, _firm_pt, "normal",
|
||||
PriceProduct.DAY_AHEAD, 0.0, frozenset()).kind
|
||||
== "allowed")
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
@@ -789,6 +810,17 @@ check("the cheap-window flag is decided per HOUR: a provisional hour is never "
|
||||
check("...while a firm hour below the firm mean still is, so carry-forward "
|
||||
"filling does not switch the maintenance charge floor off every morning",
|
||||
_mixed.cheap_now(_firm_hour) is True)
|
||||
# ⚠️ GRADED DIRECTLY, BECAUSE ITS CONSUMERS CANNOT GRADE IT. The §11.4 refusal
|
||||
# and `cheap_now` both guard provenance independently, so `firm_points()`
|
||||
# returning the carried hours TOO still leaves both of them answering correctly
|
||||
# - a stimulus that cannot distinguish an over-reporting accessor from a
|
||||
# correct one. So the tuple itself is compared with the published points, by
|
||||
# identity and in order, rather than only the mean it feeds.
|
||||
check("firm_points() returns EXACTLY the published points, in order - not the "
|
||||
"carried ones as well, which its two consumers would have absorbed "
|
||||
"without either of them changing its answer",
|
||||
list(_mixed.firm_points()) == _firm_rest
|
||||
and all(a is b for a, b in zip(_mixed.firm_points(), _firm_rest)))
|
||||
check("...and the firm mean it compares against is derived from published "
|
||||
"hours only",
|
||||
near(sum(p.eur_per_kwh for p in _mixed.firm_points())
|
||||
|
||||
Reference in New Issue
Block a user