Skip to content

fix(octopus): scope the zero-kWh dispatch exemption to genuinely parsed input - #4810

Open
chalfontchubby wants to merge 3 commits into
fix/iog-limit-future-slots-by-ev-socfrom
fix/rate-io-slot-kwh-valid-scoping
Open

fix(octopus): scope the zero-kWh dispatch exemption to genuinely parsed input#4810
chalfontchubby wants to merge 3 commits into
fix/iog-limit-future-slots-by-ev-socfrom
fix/rate-io-slot-kwh-valid-scoping

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Stacked on #4483 - fixes #4807.

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. #4483's zero-kWh 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.

This threads a kwh_valid flag through decode_octopus_slot()'s return - True unless a present charge_in_kwh/energy/chargeKwh value failed to parse as a number, True for legitimately-absent (synthesised) or genuinely empty/zero-length entries - and requires it in the exemption condition, closing the gap regardless of source.

Test plan

  • New test (test31_malformed_smart_kwh_not_exempt) covering a malformed charge_in_kwh with source == "SMART" - fails without this commit, passes with it
  • ./run_all --quick full suite passes
  • run_pre_commit clean

chalfontchubby and others added 2 commits August 28, 2026 18:46
…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>
…y-real-start

fix(octopus): compare a dispatch's real start, not its rounded settlement block, for 'already underway'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants