Commit d7996e8
Address fifth Copilot review: thread safety, MQTT precision, integer timestamps
override_manager.py:
- get_override() now returns a defensive copy via dataclasses.replace()
instead of the live internal OverrideState instance; callers (including
other threads) can no longer mutate expires_at/charge_rate without
holding the manager lock, preserving the thread-safety guarantee
mqtt_api.py:
- publish_override_duration() changed from :.0f to :.1f so that
fractional-minute durations (e.g. 45.5) are published accurately
instead of being silently rounded to the nearest whole minute
mcp_server.py:
- _format_forecast_array() now uses integer floor division for base_time
(int(run_time) // interval_seconds * interval_seconds) and casts each
time_start to int, eliminating floating-point drift in JSON timestamps
All 373 tests pass; pylint 9.46/10.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 00e1835 commit d7996e8
3 files changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
| 467 | + | |
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
0 commit comments