fix(datastore): serialize native bucket datetimes - #158
Conversation
Git-Session-Id: ec77
|
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
🤖 AI code reviewThe PR modifies BucketModel.json() in aw_datastore/storages/peewee.py to accept Peewee's native datetime value for the 'created' field, while still parsing string values for compatibility. It assigns self.created to a local variable, converts it to a datetime if it is a string, and then normalizes to UTC ISO 8601 as before. Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No thread-worthy findings. Advisory notes follow; they are retained without opening review threads. 1 advisory finding (summary-only, not scored)These P2 guard, heuristic, trade-off, or documentation claims are retained for judgment without opening review threads.
This is a How this was verified: static preflight: fix-commit + touched-files scan (rule 7) Files changed (1) — the diff as I read it
Reviewed Maintainer commands
|
* build(deps): bump aw-core to include ActivityWatch/aw-core#158 The pinned aw-core fails to create buckets through aw-server (iso8601 ParseError on the bucket's created time, ActivityWatch/aw-core#157), which the query parity tests need. * test: add query parity tests for aw-server vs aw-server-rust Start both servers on free ports with throwaway data dirs, insert identical events, run a query corpus through /api/0/query/ and diff the normalized results. Covers each shared transform on its own, the aw-client canonical queries and the aw-webui multidevice query, over hand-written edge cases and seeded random event sets. Also checks invariants on each server's output (sorting, no overlap after unions and flood, duration conservation). Current divergences are listed in known_failures.txt as strict xfails, each attributed to an issue in known_issues.py, so the suite is green now and fails (XPASS) when a fix lands in the pinned submodules. Runs in CI in a new query-parity workflow and locally via make test-query-parity. * test(query-parity): absolute time tolerance, request timeouts, keep unrun known failures - Compare times with an absolute 2 us tolerance. The relative term allowed about 1.8 s on epoch timestamps. With it gone, the sub-ms precision divergence in the fractional scenario shows up (13 more known failures). - Time out bucket, event and query requests after 60 s. - --update-known-failures only updates cases that ran, so a filtered or interrupted run no longer drops entries.
Summary
datetimevalue when serializing bucket metadataVerification
master:test_create_bucket[datastore0]failed withiso8601.ParseError232 passed, 2 skippedruff check .ruff format --check aw_datastore/storages/peewee.pyThe existing
test_create_bucketalready covers this exact path and failed before the fix, so this PR does not add duplicate coverage.Fixes #157