Repository navigation
fix(api): reject non-string JSON event timestamps - #209
TimeToBuildBob wants to merge 7 commits into
Conversation
[Low impact] The PR appears safe to merge; no blocking issues were found. SummaryThe PR rejects non-string JSON event timestamps before constructing an
No actionable issues were found. Tests were not run during this review. Reviews (2) · Last reviewed commit: "fix(api): use TypeError for type validat..." · Reviewed by Greptile |
|
All eight hosted checks now pass on |
|
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 reviewSafe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Previous review passes
Reviewed Maintainer commands
|
6202372 to
c56c7cc
Compare
|
Rebased and force-pushed with an explicit lease as Verification on the rebased head: 33 input-validation tests passed, 246 offline tests passed (excluding |
|
The replacement CI on I attempted to rerun just that job, but GitHub denied it with HTTP 403 (repository admin rights required). No code or runner configuration changed. A maintainer can retry the cancelled macOS job in run 42244383331; macOS validation on this head remains pending. |
c56c7cc to
57c6ea1
Compare
|
Rebased onto current master and force-pushed with an explicit lease as Verification: 41 input-validation tests passed, 279 offline tests passed (excluding GitHub now reports the PR mergeable. Replacement hosted checks are in progress; previous review scores belong to older heads, not this rebase. Maintainer merge remains pending. |
|
On The existing repair is #224. I reproduced 148 lint errors on this exact head, then verified that using #224's configuration clears all of them without changing any tracked files. No duplicate repair, rerun or timestamp-code change made. Next step: land the shared lint repair, then refresh this branch and verify replacement CI. #224 itself still has a cancelled macOS check requiring maintainer attention; this is not an all-green merge claim. |
cdb33c1 to
9035e6c
Compare
|
Fixed ruff TRY004 lint failures: both isinstance-guard raises now use |
|
@greptileai review |
|
Pushed Verified locally: Black 26.10.1 passes across all 36 Python files; 56 import/input-validation tests and 279 offline tests pass (the latter excludes The remaining Ruff failure is the shared baseline issue, not resolved by the two TRY004 edits: master's latest three Lint runs also fail, and #224 remains open. Running Ruff 0.17.3 on this head with #224's configuration passes without changing tracked files. I have not duplicated that repair here. Replacement hosted checks are pending; next step is to land #224, refresh this branch, and verify CI before merge. |
fff5b2c to
bc14d45
Compare
|
Rebased on TimeToBuildBob/fix/restore-ruff-ci-baseline (see #224) to fix lint CI failure — ruff 0.17.3 introduced new default rules that break the existing codebase. The rebase includes the ruff config fix (preserve E4/E7/E9/F baseline) so lint CI should pass again. |
|
The latest rebase has not restored hosted CI: current head I did not overwrite the branch: another session holds its active write lease. I sent that owner the conflict/check evidence and the rebase handoff. Next step is to reconcile this branch with current master and #224, then verify fresh hosted checks. This PR is not merge-ready; the earlier 5/5 reviews do not cover this head. |
Git-Session-Id: ff1f7458-0544-5835-8d4c-86f6cfbc620d
Git-Session-Id: f69034e5-7be4-4e81-a24b-e7b45ae284f2
Without target-version, Ruff infers no floor, so pyupgrade-style fixes (e.g. UP017 -> datetime.UTC, 3.11+) could break the declared ^3.8 support if those rule families are adopted later. Refs ActivityWatch#225 Git-Session-Id: 9b655f9c-758f-5b15-b198-639d6fcfb45c
Git-Session-Id: f9b41099-5af9-441d-b867-64a38316194e
Git-Session-Id: ed9b5097-f7d1-4302-86c4-91e331f1b21f
Git-Session-Id: f087e85e-3fa7-51b1-b962-a4f7fd1060d3
bc14d45 to
8f34142
Compare
|
Rebased onto current master (conflict came from the |
The _parse_event check in rest.py only guards the POST /events endpoint. The import path in ServerAPI.import_bucket built Event(**e) directly, so an exported event with a numeric timestamp bypassed that check and reached aw-core's datetime parser, raising AttributeError → HTTP 500. Add the same string-or-null guard in import_bucket (raises ValueError so ImportAllResource.post's existing (KeyError, TypeError, ValueError) handler returns a structured 400) and add regression tests in test_import.py. Git-Session-Id: c511536f-90c3-54a0-86d2-edc7dddf01dc
Problem
Numeric JSON event timestamps reach aw-core's datetime parser and return HTTP 500 (AttributeError). Event POST does not enforce the heartbeat schema because it also accepts batches.
Change
test_input_validation.pyinmake testso hosted CI executes the regressions.Verification
994ea988: integer timestamp returns 500 with AttributeError in aw-core.test_client.pyexcluded because it requires a separately running server).git diff --checkclean.Maintainer merge and replay on master remain required. No live server or personal ActivityWatch data used. Independent of the nonfinite heartbeat pulse repair in #207.
Hosted CI setup repair
Initial Linux build/typecheck failed before tests:
setup-pythoncannot install Python 3.9 on Ubuntu 26.04, now selected byubuntu-latest(run 40729263872). Commit6202372pins those two Linux jobs to Ubuntu 22.04, retaining Python 3.9 and all workflow steps. Replacement checks are pending; local passing tests are not a claim of green hosted CI.