Skip to content

fix: treat naive datetime query params as UTC#752

Merged
vdusek merged 1 commit intomasterfrom
fix/naive-datetime-query-param-tz
Apr 22, 2026
Merged

fix: treat naive datetime query params as UTC#752
vdusek merged 1 commit intomasterfrom
fix/naive-datetime-query-param-tz

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Apr 22, 2026

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).

Calling `.astimezone(UTC)` on a naive datetime presumed the host's local
timezone and produced a timestamp with a misleading `Z` suffix, silently
corrupting timestamp filters (e.g. `started_before`/`started_after`) on
non-UTC hosts. Attach UTC explicitly when `tzinfo` is missing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Apr 22, 2026
@vdusek vdusek self-assigned this Apr 22, 2026
@github-actions github-actions Bot added this to the 139th sprint - Tooling team milestone Apr 22, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Apr 22, 2026
@vdusek vdusek requested a review from Pijukatel April 22, 2026 07:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.22%. Comparing base (6b8001e) to head (147bc6e).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #752      +/-   ##
==========================================
- Coverage   95.45%   95.22%   -0.24%     
==========================================
  Files          45       45              
  Lines        5125     5126       +1     
==========================================
- Hits         4892     4881      -11     
- Misses        233      245      +12     
Flag Coverage Δ
integration 95.22% <100.00%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek merged commit 9ab096a into master Apr 22, 2026
25 of 26 checks passed
@vdusek vdusek deleted the fix/naive-datetime-query-param-tz branch April 22, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants