Skip to content

Commit ffd84e4

Browse files
fix(octopus): say "same as logged in full at", not "unchanged since", on a brief repeat line
The gate keeps several texts per key, so a response or slot list can change and change back within the hour (A, B, then A again). The brief line for the third was worded "unchanged since logged in full at" the time A was logged, which is false: it changed in between. "Same as" is true in every case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b2b2818 commit ffd84e4

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎apps/predbat/octopus.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,7 @@ def log_request_beside_failure():
24042404
("response", request_context),
24052405
"{} {}".format(response.status, body_text),
24062406
["OctopusAPI: GraphQL response for {} (status {}): {}".format(request_context, response.status, body_text)],
2407-
lambda when: "OctopusAPI: GraphQL response for {} (status {}) unchanged since logged in full at {}, {} characters".format(request_context, response.status, when, len(body_text)),
2407+
lambda when: "OctopusAPI: GraphQL response for {} (status {}) same as logged in full at {}, {} characters".format(request_context, response.status, when, len(body_text)),
24082408
always_full=failed,
24092409
)
24102410

@@ -3951,7 +3951,7 @@ def rate_add_io_slots(self, car_n, rates, octopus_slots):
39513951

39523952
# The slot list is re-derived every plan but rarely changes, so log it only when it does, and at least hourly
39533953
if slot_lines:
3954-
self.io_slot_log_gate.log(self.log, ("slots", car_n), "\n".join(slot_lines), slot_lines, lambda when: "Octopus: Intelligent slots for car {} unchanged since logged in full at {}, {} half-hour slot lines".format(car_n, when, len(slot_lines)))
3954+
self.io_slot_log_gate.log(self.log, ("slots", car_n), "\n".join(slot_lines), slot_lines, lambda when: "Octopus: Intelligent slots for car {} same as logged in full at {}, {} half-hour slot lines".format(car_n, when, len(slot_lines)))
39553955

39563956
# Log daily slot counts for debugging
39573957
for day_offset in sorted(slots_per_day.keys()):

‎apps/predbat/tests/test_octopus_logging.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async def test_octopus_logging(my_predbat):
8989
await api.async_graphql_query("query { account }", "test-logging", returns_data=True)
9090
repeat = "\n".join(log_lines)
9191
brief_request = "Making GraphQL request test-logging to " in repeat and "(query as logged in full at" in repeat
92-
brief_response = "GraphQL response for test-logging (status 200) unchanged since logged in full" in repeat
92+
brief_response = "GraphQL response for test-logging (status 200) same as logged in full" in repeat
9393
if "A-LOG-12345" in repeat or "query { account }" in repeat or not brief_request or not brief_response:
9494
print("ERROR: a repeated query and response should be logged briefly, got {}".format(log_lines))
9595
failed = True
@@ -121,7 +121,7 @@ async def test_octopus_logging(my_predbat):
121121
await api.async_graphql_query("query { device(id: 2) }", "test-device", returns_data=True)
122122
log_lines.clear()
123123
await api.async_graphql_query("query { device(id: 1) }", "test-device", returns_data=True)
124-
if not any("(query as logged in full at" in line for line in log_lines) or not any("unchanged since logged in full" in line for line in log_lines):
124+
if not any("(query as logged in full at" in line for line in log_lines) or not any("same as logged in full" in line for line in log_lines):
125125
print("ERROR: a repeated query should be logged briefly even when another query shares its context, got {}".format(log_lines))
126126
failed = True
127127

‎apps/predbat/tests/test_rate_add_io_slots.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ def run(slot_list):
655655
print("ERROR: the first slot list should be logged in full, got {}".format(first))
656656
failed = True
657657
repeat = run(slots)
658-
if len(repeat) != 1 or "unchanged since logged in full at" not in repeat[0] or "1 half-hour slot lines" not in repeat[0]:
658+
if len(repeat) != 1 or "same as logged in full at" not in repeat[0] or "1 half-hour slot lines" not in repeat[0]:
659659
print("ERROR: an unchanged slot list should be one line, got {}".format(repeat))
660660
failed = True
661661
changed = [dict(slots[0], charge_in_kwh=3.0)]

0 commit comments

Comments
 (0)