Skip to content

fix(transform): skip contained zero markers without losing flood bridges - #202

Merged
ErikBjare merged 4 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/flood-skip-zero-duration-before-pairwise
Nov 17, 2026
Merged

ErikBjare merged 4 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/flood-skip-zero-duration-before-pairwise

Conversation

@TimeToBuildBob

@TimeToBuildBob TimeToBuildBob commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix a contained zero-duration marker blocking a short-gap comparison without removing standalone zero-duration bridges.

Fixes #201.

Verification

  • Erik's counterexample A(0,1), X(5,0), B(10,1) failed on the prior PR (2s); now retains the exact existing 11s bridge.
  • Original reporter fixture still totals 10s with and without the contained marker, and is idempotent.
  • Standalone, endpoint, nested-positive and later-wins/prefix-maximum controls remain unchanged.
  • Flood tests: 20 passed. Full Python suite: 435 passed, 5 skipped. An initial full run hit the existing random test-bucket ID collision; a fresh full rerun passed.
  • Ruff format/check, diff check and enabled commit hooks pass. Rebased onto fetched upstream master.

Design boundary

A running maximum end is deliberately not used to change positive-event midpoint/threshold semantics. For A[0,10], X[5,7], B[12,13], the established split is 9.5, not 11. Likewise A[0,10], X[5,6], Z[8,8], B[12,13] needs Z retained because the later-wins X has already superseded A. Prefix-max marker filtering would remove a valid bridge. This repair is scoped to the reported contained-zero defect, not a flood rewrite.

Synthetic transform coverage; not a released-server/query-engine acceptance claim. Merge and containing release remain outstanding.

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The change skips contained zero-duration markers before filling short gaps, while keeping standalone and endpoint markers available to bridge events.

  • Flooding skips contained zero markers without losing standalone bridges.

No actionable issues found.

Reviews (4) · Last reviewed commit: "fix(transform): skip flood zero markers ..." · Reviewed by Greptile

@TimeToBuildBob

TimeToBuildBob commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Superseded after Erik’s batch review: the previous blanket zero-duration filter lost standalone bridges. Repaired in 3e7f59a; the PR body now records the paired fix and regression controls. Awaiting current-head CI/review, not ready solely on the old green checks.

@TimeToBuildBob

TimeToBuildBob commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Adds a pre-pass to flood() that drops zero-duration events whose timestamp falls inside the half-open span of the preceding retained event, where that span may be extended by overlapping equal-data events. Adds five tests covering contained-marker skipping, standalone/endpoint bridges, later-wins precedence, and equal-data span extension.

Safe to merge — no P0/P1 findings

Confidence 5/5

✅ No findings. The diff looks correct to me on this pass.

Files changed (2) — the diff as I read it
  • aw_transform/flood.py — Introduces a span-tracking pre-filter that removes selected zero-duration markers before the existing pairwise and normalization passes.
  • tests/test_flood.py — Adds five tests for zero-duration marker containment, bridging, endpoint markers, merged equal-data spans, and idempotence.
Previous review passes
commit score findings engine when
bbfb5456f075 5/5 0 subscription 2026-11-07 00:43 UTC
3e7f59a55b91 5/5 0 subscription 2026-11-07 18:02 UTC
d2cf138cd04f 4/5 1 llm 2026-11-17 13:21 UTC
8660dc4eb836 5/5 0 llm 2026-11-17 14:12 UTC
4555d6f86102 3/5 1 llm 2026-11-17 20:04 UTC

Reviewed e416516ca333 · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 200s · about this reviewer

Maintainer commands

@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.

@TimeToBuildBob
TimeToBuildBob force-pushed the fix/flood-skip-zero-duration-before-pairwise branch from bbfb545 to 3e7f59a Compare November 7, 2026 17:16
@TimeToBuildBob TimeToBuildBob changed the title fix(transform): skip zero-duration events before flood() pairwise fix(transform): skip contained zero markers without losing flood bridges Nov 7, 2026
@TimeToBuildBob

TimeToBuildBob commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Correction (2026-11-07 audit): the earlier ready claim used Greptile 5/5 on pre-rework bbfb545 and was invalid. Refreshed through greptile-helper on the actual head.

Verified 2026-11-07 19:39 UTC: current head 3e7f59a; Greptile now explicitly reviews that exact commit at 5/5 (updated 19:36:48Z), current-head checks SUCCESS, MERGEABLE, zero review threads. Maintainer merge remains separate; this is not a released-server acceptance claim. Any new push invalidates this readiness evidence.

@TimeToBuildBob

This comment has been minimized.

@TimeToBuildBob

TimeToBuildBob commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto current master (75ccb41) after the branch went DIRTY; conflict in tests/test_flood.py resolved by keeping both sides — master's test_flood_does_not_mutate_input (one-level-deep copy perf change, #204) and this PR's four marker tests. aw_transform/flood.py auto-merged: the contained-marker filter now runs after the new shallow-copy normalization.

Current head verification: tests/test_flood.py 21 passed; full suite 499 passed, 5 skipped with one failure in tests/test_datastore.py::test_replace[bucket_cm0] from the pre-existing random bucket-ID collision (test_datastore.py alone re-runs clean, 90 passed); ruff check + ruff format --check clean on both changed files.

CI on the new head is pending. The earlier readiness evidence applied to 3e7f59a and is superseded. Merge remains a maintainer click — the bot has pull-only access to this repo.

Comment thread aw_transform/flood.py Resolved
@TimeToBuildBob

TimeToBuildBob commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Current head 4555d6f86102 is waiting on a macOS CI rerun, not fully CI-green. Build run 44157106480 failed because GitHub could not allocate its hosted runner: “The job was not acquired by Runner of type hosted even after multiple attempts,” with macOS arm64 capacity notices. The macOS job has no executed steps. Linux, Windows, lint and CodeQL passed; the latest three master Builds are green.

The previous rerun attempt on the earlier head was rejected with “Must have admin rights to Repository”; the bot still has pull/triage access, not push/admin. A maintainer needs to rerun the macOS job in the current run linked above. No code or workflow change is warranted for this runner-allocation failure. Maintainer merge remains separate after CI clears.

The Greptile 5/5 and Bob review currently reference the older 8660dc4eb836 head; they are not current-head readiness evidence.

@TimeToBuildBob

This comment has been minimized.

A duration-0 event is dropped from flood() output but still occupied a
zip() slot, so a pulsetime-sized gap between its neighbours was never
filled (ActivityWatch#201). Filter duration<=0 after sort and
before pairing; keep dropping zeros from the result.

Git-Session-Id: 7fc44e80-fb4f-4bfb-91a6-b7073b59f193
Git-Session-Id: e4eca198-7b3f-513e-824a-410b51d9a94d
Git-Session-Id: 6b1f3c57-7a6d-568e-9271-37c2e2a70ad9
@TimeToBuildBob
TimeToBuildBob force-pushed the fix/flood-skip-zero-duration-before-pairwise branch from 8660dc4 to 4555d6f Compare November 17, 2026 19:18
Comment thread aw_transform/flood.py Resolved
Git-Session-Id: 9dc14d5c-2227-487a-aae7-971ed70df4d5
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

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.

@ErikBjare
ErikBjare merged commit 4496e2e into ActivityWatch:master Nov 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flood(): a zero-duration event silently blocks gap flooding between its neighbours

2 participants