fix(quota-planner): normalize datetimes before database use#1043
fix(quota-planner): normalize datetimes before database use#1043zvladru wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f34df1c66b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the automated review feedback in @codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
The quota planner can handle timezone-aware datetimes from scheduler/runtime code, while the database columns and query comparisons are treated as UTC-naive timestamps. In Postgres setups this can surface as scheduler/database errors when aware values are written to
timestamp without time zonecolumns or compared against naive stored values.Changes
scheduled_at,executed_at, and quota-windowobserved_atvalues before writes.sincebounds before executed-warmup counts, warmup-cost queries, and demand-history queries.Impact
This keeps the quota planner's database boundary consistent: application code may pass aware datetimes, while persistence/query code stores and compares naive UTC values. It avoids scheduler failures caused by timezone-aware values reaching naive DB fields.
Tests
uv run pytest -q tests/unit/test_quota_planner.py