Skip to content

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

Open
TimeToBuildBob wants to merge 4 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/flood-skip-zero-duration-before-pairwise
Open

TimeToBuildBob wants to merge 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.

Rust counterpart for ActivityWatch/aw-core#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: 22 passed. Full aw-transform library: 99 passed. The standalone bridge test failed before this repair.
  • rustfmt, diff check and enabled commit hooks pass; checked against 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.

Match aw-core: a duration-0 event is dropped from flood() output but
still occupied a neighbour slot, so a pulsetime-sized gap was never
filled (ActivityWatch/aw-core#201). Retain duration>0 after sort and
before pairing.

Git-Session-Id: 7fc44e80-fb4f-4bfb-91a6-b7073b59f193
@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; the reported invalid-duration issue is fixed.

Summary

flood skips contained zero-duration markers while keeping standalone and endpoint markers that bridge short gaps.

  • Contained zero markers no longer block nearby event gaps.
  • Negative-duration events no longer affect nearby event pairs.

Reviews (3) · Last reviewed commit: "fix(transform): discard negative duratio..." · Reviewed by Greptile

@TimeToBuildBob

TimeToBuildBob commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Safe to merge — no P0/P1 findings

Confidence 5/5

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

Previous review passes
commit score findings engine when
0be70d27e235 5/5 0 subscription 2026-11-07 00:29 UTC
21575c053264 3/5 1 subscription 2026-11-07 22:23 UTC

Reviewed 8e10c7b4364d · openrouter/deepseek/deepseek-v4-flash-0731 · panel (in-band) engine · 33s · about this reviewer

Maintainer commands

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

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The test-file advisory above is a false positive: Rust keeps unit tests in the source file, and this diff adds test_flood_zero_duration_does_not_block_neighbour_gap under #[cfg(test)]. No separate test file is needed.

The single-pass review found no code defects. This is outage coverage only (quorum_mode=degraded-1), not consensus merge evidence; the merge remains with the maintainer. Code coverage is still running; the other seven checks have passed.

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.79%. Comparing base (656f3c9) to head (8e10c7b).
⚠️ Report is 236 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #858       +/-   ##
===========================================
+ Coverage   70.81%   85.79%   +14.97%     
===========================================
  Files          51       89       +38     
  Lines        2916    12938    +10022     
===========================================
+ Hits         2065    11100     +9035     
- Misses        851     1838      +987     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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 ddb5234, paired with ActivityWatch/aw-core#202 at 3e7f59a55b91. The PR body records standalone/endpoint/later-wins controls and 99 passing aw-transform tests. Awaiting current-head CI/review; the old green checks and old readiness note are not current-head merge evidence.

Git-Session-Id: e4eca198-7b3f-513e-824a-410b51d9a94d
@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 0be70d2 and was invalid. Refreshed through greptile-helper on the actual head.

Verified 2026-11-07 19:39 UTC: current head ddb5234; Greptile now explicitly reviews that exact commit at 5/5 (updated 19:36:28Z), checks SUCCESS and MERGEABLE. HOWEVER Greptile raised a new unresolved P2: negative-duration imported events can gain activity time, discussion_r4503444837. This PR is NOT waiting only on a maintainer click; adjudicate or repair that finding first. A 5/5 score does not erase an unresolved finding.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread aw-transform/src/flood.rs Resolved
Git-Session-Id: 53b1247b-5460-5385-861d-2d3872d8fc23
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread aw-transform/src/flood.rs Resolved
Git-Session-Id: e5b4b9f5-8ae1-562b-b1e9-4503b1da9205
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.

1 participant