fix(octopus): scope the zero-kWh dispatch exemption to genuinely parsed input - #4810
Open
chalfontchubby wants to merge 3 commits into
Open
Conversation
…ed input decode_octopus_slot() previously coerced any unparseable charge_in_kwh value to 0.0, indistinguishable by value alone from a real zero-kWh SMART grid-flex event. rate_add_io_slots()'s exemption from the octopus_slot_max cap and the #4482 need-check was scoped to source == "SMART" as a first pass, but a malformed entry can carry that source too. Threads a kwh_valid flag through decode_octopus_slot()'s return - True unless a present kwh value failed to parse as a number - and requires it in the exemption condition, closing the gap regardless of source. #4807, review follow-up on #4483 from Speshman. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ment block, for "already underway" rate_add_io_slots()'s exemption from the #4482 future-need check compared the 30-min-rounded slot_start against a similarly rounded current_block, so a dispatch starting partway through the current settlement period (e.g. 10:20, checked at 10:05) read as already-underway from the top of that period (10:00), before it had actually started. Captures the dispatch's real, unrounded start separately and compares that against minutes_now instead - current_block is no longer needed and is removed. #4808, review follow-up on #4483 from Speshman. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
…y-real-start fix(octopus): compare a dispatch's real start, not its rounded settlement block, for 'already underway'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #4483 - fixes #4807.
decode_octopus_slot()previously coerced any unparseablecharge_in_kwhvalue to0.0, indistinguishable by value alone from a real zero-kWh SMART grid-flex event. #4483's zero-kWh exemption from theoctopus_slot_maxcap and the #4482 need-check was scoped tosource == "SMART"as a first pass, but a malformed entry can carry that source too.This threads a
kwh_validflag throughdecode_octopus_slot()'s return -Trueunless a presentcharge_in_kwh/energy/chargeKwhvalue failed to parse as a number,Truefor legitimately-absent (synthesised) or genuinely empty/zero-length entries - and requires it in the exemption condition, closing the gap regardless of source.Test plan
test31_malformed_smart_kwh_not_exempt) covering a malformedcharge_in_kwhwithsource == "SMART"- fails without this commit, passes with it./run_all --quickfull suite passesrun_pre_commitclean