test: extend existing query-parity harness to heartbeat ingestion

Open
#1,568 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python, rust
Domain
testing-qa

Research direction

Start from the existing query-parity harness in scripts/tests/query_parity/, which the issue says already launches both servers and normalizes results; read how Server.insert_events is used there. Add a heartbeat sequence path that posts identical payloads with fixed pulsetimes to fresh buckets on both servers, then diff the normalized stored events and flood/merge_events_by_keys outputs. Done when the heartbeat cases pass or each mismatch has a minimal sequence and a linked bug.

Written by the indexing model from the issue text.

Description

Test-first collection-integrity child of #724. Reuse the existing Python/Rust query-parity harness from #1467 (scripts/tests/query_parity/); do not build another server launcher or normalization layer.

The current suite inserts events directly with Server.insert_events. It covers overlap/containment, identical ranges and equal timestamps, and runs flood/merge_events_by_keys, but does not send heartbeat sequences through the collection endpoint. The residual scope is heartbeat ingestion and the analysis of the stored results.

Task

Extend that harness to send identical sequential heartbeat payloads and pulsetimes to fresh buckets on both servers, then read back and compare their normalized stored events. Cover:

  • steady identical-data heartbeats;
  • a gap beyond pulsetime;
  • a data change;
  • the exact pulsetime boundary and either side of it;
  • same-timestamp/different-duration inputs and contained/overlapping inputs (negative gaps).

Run the existing flood and merge_events_by_keys query templates on the heartbeat-produced events to check downstream parity. Reuse existing overlap fixtures where suitable instead of duplicating the direct-insert transform corpus.

Acceptance

  • Both servers receive the same payloads in the same sequential order, with identical pulsetimes, in isolated testing instances and fresh buckets.
  • Stored-event results and downstream query results compare through the existing normalization/diff helpers.
  • Each mismatch has the smallest heartbeat sequence, pulsetime, server revisions and a linked bug; no unowned xfails.
  • Existing direct-insert query-parity cases remain intact. No new fixture-sync mechanism or duplicate startup helpers.
  • No production heartbeat changes unless a test first reproduces a defect.

Out of scope: reimplementing the out-of-order replacement fixes (ActivityWatch/aw-server#177 and ActivityWatch/aw-server-rust#555); concurrent requests (tracked separately in #1566); another generic overlap transform suite.

The infrastructure prerequisite is already satisfied by #1467 (merged September 26), not the newly filed duplicate #1567, which has been closed with evidence. Current-master query-parity CI: https://github.com/ActivityWatch/activitywatch/actions/runs/44886830413 (3130 passed, 98 issue-attributed strict xfails).

Dominant language
Python
Stars
19.7k
Forks
1.1k
Avg merge
2d 19h
Merged PRs (30d)
14

Getting set up

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/activitywatch

All issues in ActivityWatch/activitywatch

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.