Commit 9ab096a
fix: treat naive datetime query params as UTC (#752)
## Summary
`HttpClientBase._parse_params` called `.astimezone(UTC)` directly on
incoming `datetime` values. Per Python's stdlib, a naive datetime is
presumed to represent time in the system's local timezone, so on a
non-UTC host the value was shifted by the host's offset and then
serialized with a `Z` suffix — a wire format that *looks* like UTC but
isn't. This silently corrupted timestamp filters such as
`started_before`/`started_after` on `runs().list()` whenever a caller
passed a naive datetime.
The fix attaches `UTC` to the value when `tzinfo` is missing, so naive
datetimes round-trip as UTC instead of being relocalized.
Added a unit test that pins `TZ=Asia/Karachi` with `time.tzset()` to
reproduce the bug deterministically on Unix CI (skipped on Windows,
where `time.tzset` is unavailable).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5a32f25 commit 9ab096a
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
204 | 219 | | |
205 | 220 | | |
206 | 221 | | |
| |||
0 commit comments