Skip to content

fix(sync): use case-insensitive filter for 'zero peers' warning - #323

Merged
ErikBjare merged 7 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/zero-peers-case-insensitive-filter
Oct 7, 2026
Merged

ErikBjare merged 7 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/zero-peers-case-insensitive-filter

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Summary

The push-only device filter at SyncSettingsActivity.kt:103 was checking
"zero peers" !in it (lowercase), but aw-server-rust emits:

Found 0 remote db files to pull from …. Zero peers in a configured sync dir…

The capital Z means the filter never matched, so the warning was always shown
on push-only Android devices even though it's meaningless there (SAF mirror is
outbound-only until sync v2).

Fix: use it.lowercase() for a case-insensitive containment check.

Root cause

Found during investigation of #321 (Android double-start / data-loss bugs).
aw-sync/src/util.rs:1102 has Zero peers (capital Z); the Android filter
had "zero peers" (lowercase) — one-character case mismatch.

Test plan

  • Build and install on a push-only device (no configured sync dir peers)
  • Open Sync Settings — confirm the "Zero peers in a configured sync dir"
    warning no longer appears

Ref: #321

aw-server-rust emits 'Zero peers in a configured sync dir…' (capital Z)
but the push-only filter checked 'zero peers' (lowercase), so the warning
was never suppressed. Use it.lowercase() to make the match case-insensitive.

Fixes: ActivityWatch#321
Git-Session-Id: f63a
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Fixes case sensitivity in a warning filter.

The PR appears safe to merge.

What we checked:

  • Other warnings stay visible: The filter removes only warnings containing zero peers. The updated mixed-warning test still expects push aborted after pull failure.

Summary

Makes the push-only warning filter ignore case, so Android hides the server’s Zero peers warning.

  • Adds capital-Z coverage and keeps the lowercase case.
  • Checks that unrelated warnings remain visible.
  • The previous test-coverage finding is fully addressed. No new issues were found.
  • Tests were inspected but not run.

Reviews (2) · Last reviewed commit: "test(sync): use capital-Z warning in sup..."

// (aw-server-rust#687) — not meaningful on Android where pull is a no-op by
// construction (SAF mirror is outbound-only until sync v2).
val warnings = if (isPushOnlyDevice) status.warnings.filter { "zero peers" !in it } else status.warnings
val warnings = if (isPushOnlyDevice) status.warnings.filter { "zero peers" !in it.lowercase() } else status.warnings

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Case mismatch lacks test coverage

Both existing warning tests use lowercase "zero peers", so they still pass with the broken, case-sensitive filter. Update the suppression test to use "Zero peers" or add a mixed-case case that fails without this change. That would catch a future change that brings back the misleading warning.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ae02c9a: updated the primary suppression test to use "Zero peers" (capital Z, as emitted by aw-server-rust) and added a lowercase variant. The original tests were passing with the broken case-sensitive filter — now the capital-Z case would have caught the bug.

Both suppression tests used lowercase "zero peers" — they passed with the old
broken case-sensitive filter, so they provided no coverage for the actual bug.

aw-server-rust emits "Zero peers" (capital Z); update the primary suppression
test to use that form and add a lowercase variant to verify both cases are
handled by the case-insensitive filter.

Git-Session-Id: 10abe743-3a89-594d-98d8-b385b7ff3722
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The E2E failure (NativeWindowInsetsTest > syncToggleReceivesRealTap) is unrelated to this PR — the same test fails on master today with the identical error. This PR only touches SyncSettingsActivity.kt and its unit test.

Attempted a CI rerun but don't have admin rights for that. A maintainer rerun should confirm this is a flaky emulator test, not a regression from this change.

ErikBjare and others added 4 commits October 6, 2026 22:08
…ivityWatch#322)

Six light-mode screenshots of v0.14.2 with demo data (Pixel-class 1080x2400):
activity day, day categories, 30 days, week, category sunburst, timeline.
Git-Session-Id: 3a67ecec-28dc-57d8-b918-bdc6f9f45f68
…tch#326)

* fix(ui): let SyncSettingsActivity follow system dark mode

applySafeWindowInsets() always called applySystemBarAppearance(darkContent=false),
hardcoding white background for all native screens even in dark mode. This made
system bar icons and window background stay light regardless of the device theme,
causing white-on-white text in SyncSettingsActivity when dark mode is on.

Add a followNightMode parameter (default false — preserves existing behaviour for
MainActivity which drives appearance from the embedded web UI). SyncSettingsActivity
passes followNightMode=true so its DayNight theme attributes resolve to the correct
colours automatically.

Fixes item 5 in ActivityWatch#321.

Git-Session-Id: 766d

* docs(colors): update night-mode guidance — SyncSettings now follows DayNight

Git-Session-Id: 766d
…ctivityWatch#327)

With gesture navigation a back-swipe finished MainActivity even when the
embedded web UI had pages to go back to. Back now closes the drawer first,
then goes back in the WebView, and only finishes when there is no history
left.

Part of ActivityWatch#321 (item 6).

Git-Session-Id: f4b5
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The CI failure is in NativeWindowInsetsTest which is a pre-existing flaky E2E suite. The same test class (different method) also fails on master run 37530698857 within the same hour. The sync case-sensitivity change in this PR doesn't touch window insets or UI interaction code.

No code change needed; can merge once a clean E2E run lands or the maintainer is comfortable with the known flake.

…lter' into fix/zero-peers-case-insensitive-filter

Git-Session-Id: d056
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The E2E failure is in NativeWindowInsetsTest.syncToggleReceivesRealTap — this test checks that tapping a UI toggle persists the setting, and is unrelated to the sync filter change in this PR (which only changes a case-sensitivity check on a log message string). This looks like an emulator flake. Could a maintainer re-run the E2E job?

@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 500cc11 into ActivityWatch:master Oct 7, 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.

2 participants