Return structured 400 when event storage rejects a foreign-bucket ID

Open
#211 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@TimeToBuildBob is already working on this.

Since Oct 28, 2026.

  • #214 by @TimeToBuildBob — open

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Start at EventsResource.post, where event creation errors become HTTP responses, and inspect the Peewee HTTP tests. Add regression coverage for single, one-element, and mixed batches, supported writes, and failed-write cache behavior; verify invalid writes return structured InvalidEvent 400 while storage failures remain server errors. The issue reports linked core work and unchanged stored events during reproduction; pull request #214 is already open.

Written by the indexing model from the issue text.

Description

Companion to ActivityWatch/aw-core#195. Peewee currently accepts a supplied ID belonging to another bucket and moves the row. The core repair rejects it with ValueError before mutation, but EventsResource.post does not map write-time ValueError, so the HTTP response becomes 500.

Expected: catch invalid event-write ValueError at the event creation HTTP boundary and return structured InvalidEvent 400; preserve storage failures that are not input errors as server failures. Add disposable Peewee HTTP regressions for single/one-element/mixed batches, unchanged source/destination events, supported updates/inserts/heartbeats and failed-write cache behavior.

Reproduced on server master 994ea988 with repaired core worktree; both single and one-element batch return 500 while leaving stored events unchanged. No live data/listeners used.

Dominant language
Python
Stars
129
Forks
104
Avg merge
5d 14h
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ActivityWatch/aw-server

All issues in ActivityWatch/aw-server

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.