Skip to content

Comments

Replace aw-notify with Rust implementation aw-notify-rs#1211

Merged
ErikBjare merged 2 commits intoActivityWatch:masterfrom
0xbrayo:feat/replace-aw-notify-rust
Feb 23, 2026
Merged

Replace aw-notify with Rust implementation aw-notify-rs#1211
ErikBjare merged 2 commits intoActivityWatch:masterfrom
0xbrayo:feat/replace-aw-notify-rust

Conversation

@0xbrayo
Copy link
Member

@0xbrayo 0xbrayo commented Feb 22, 2026

Important

Replace aw-notify with aw-notify-rs in submodules and update README.md accordingly.

  • Submodules:
    • Replace aw-notify submodule with aw-notify-rs in .gitmodules.
  • Documentation:
    • Update README.md to link aw-notify to 0xbrayo/aw-notify-rs in the architecture diagram.

This description was created by Ellipsis for 22c0ee6. You can customize this summary. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 22c0ee6 in 5 seconds. Click for details.
  • Reviewed 41 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_kx3k3drzyWAyyRMT

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@greptile-apps
Copy link

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR replaces the Python-based aw-notify implementation with a new Rust implementation (aw-notify-rs) from the 0xbrayo repository. The changes update the submodule URL in .gitmodules and the corresponding link in the README.md architecture diagram.

Key Changes:

  • Submodule URL changed from github.com/ErikBjare/aw-notify to github.com/0xbrayo/aw-notify-rs
  • Architecture diagram updated to reflect new repository location
  • Submodule commit pointer updated to the Rust implementation

No Issues Found:

  • All references have been properly updated
  • The change is clean and straightforward
  • Build scripts (Makefile, aw.spec) reference the module by directory name only, so no updates needed there

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • This is a straightforward submodule replacement with only three files changed: the submodule configuration, documentation link, and submodule commit pointer. All changes are consistent and properly coordinated. Build scripts and CI configurations reference the module by path only, not by repository URL, so they remain compatible. No code logic is modified.
  • No files require special attention

Important Files Changed

Filename Overview
.gitmodules Replaced aw-notify submodule URL from ErikBjare/aw-notify to 0xbrayo/aw-notify-rs, pointing to a Rust implementation
README.md Updated architecture diagram to link aw-notify to 0xbrayo/aw-notify-rs repository
aw-notify Updated submodule commit pointer to new Rust implementation

Last reviewed commit: 22c0ee6

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@TimeToBuildBob
Copy link
Contributor

The macOS CI failures here (macos-14 and macos-latest) are a pre-existing infrastructure issue unrelated to this PR's changes.

Root cause: Apple Developer Agreement has expired — xcrun notarytool submit is getting HTTP 403. I investigated and reported this in #1212, tagging @ErikBjare to accept the updated agreement on developer.apple.com.

This PR itself looks great — both Ellipsis and Greptile give it a thumbs up (5/5 confidence). Once Erik resolves the Apple Developer account issue, the macOS jobs should pass. In the meantime, the PR is ready from a code quality perspective.

@TimeToBuildBob
Copy link
Contributor

Correction to my previous comment: I was wrong about the macOS failures being unrelated.

The actual root cause: aw.spec calls build_analysis("aw_notify", aw_notify_location, ...) which looks for Python files at:

  • aw-notify/aw_notify/__main__.py
  • aw-notify/src/aw_notify/__main__.py

Since this PR replaces Python aw-notify with Rust aw-notify-rs, neither path exists, causing the Package dmg step to fail with:

Exception: Could not find aw_notify location from [PosixPath('aw-notify/aw_notify/__main__.py'), PosixPath('aw-notify/src/aw_notify/__main__.py')]

Fix needed in aw.spec: Make aw-notify optional when it's not a Python package. The build_analysis() function needs a skip_if_not_found option, or the call to it needs a guard:

# Check if aw-notify is a Python package
_notify_candidates = [
    aw_notify_location / "aw_notify/__main__.py",
    aw_notify_location / "src/aw_notify/__main__.py",
]
skip_aw_notify = not any(p.exists() for p in _notify_candidates)
if skip_aw_notify:
    print("Skipping aw-notify Python packaging (Rust-based implementation detected)")

aw_notify_a = None if skip_aw_notify else build_analysis(
    "aw_notify", aw_notify_location, hiddenimports=["desktop_notifier.resources"]
)

Then wrap all subsequent uses (MERGE, build_collect, BUNDLE) in if aw_notify_a is not None: guards.

The Rust binary itself (aw-notify-rs) would be compiled separately and included as a binary (similar to aw-server-rust). The packaging of the Rust binary can be addressed in a follow-up once the build no longer crashes.

@ErikBjare
Copy link
Member

@0xbrayo Could you move aw-notify-rs into the ActivityWatch org? :)

@0xbrayo
Copy link
Member Author

0xbrayo commented Feb 23, 2026

transferred to AW

@0xbrayo
Copy link
Member Author

0xbrayo commented Feb 23, 2026

@TimeToBuildBob reupdate the links, now aw-notify-rs is located at activitywatch/aw-notify-rs

@TimeToBuildBob
Copy link
Contributor

@0xbrayo Now that aw-notify-rs is at ActivityWatch/aw-notify-rs, two places in this PR need updating:

  1. .gitmodules — change url = https://github.com/0xbrayo/aw-notify-rs.git to url = https://github.com/ActivityWatch/aw-notify-rs.git
  2. README.md — change <a href='https://github.com/0xbrayo/aw-notify-rs'> to <a href='https://github.com/ActivityWatch/aw-notify-rs'>

Also make sure the submodule commit points to the new repo's commit (you may need to git submodule set-url aw-notify https://github.com/ActivityWatch/aw-notify-rs.git && git submodule update --remote aw-notify).

@0xbrayo 0xbrayo force-pushed the feat/replace-aw-notify-rust branch from 22c0ee6 to 1ee371c Compare February 23, 2026 09:26
@0xbrayo 0xbrayo changed the title Replace aw-notify with Rust implementation from 0xbrayo/aw-notify-rs Replace aw-notify with Rust implementation aw-notify-rs Feb 23, 2026
@ErikBjare
Copy link
Member

@0xbrayo Fixed the Apple Notarization stuff (just needed to accept new ToS), re-triggered the CI.

@ErikBjare
Copy link
Member

@TimeToBuildBob Is the remaining failing CI just a consequence of running from Brayo's fork? Safe to merge? Or do we still need to do something about #1211 (comment)?

(also, I think Brayo gave him access to his fork, unless that was just aw-tauri, so you should maybe be able to push directly to it and fix this instead of telling us to)

- Check if aw-notify is a Python package before building
- Skip Python packaging when Rust implementation (aw-notify-rs) is detected
- Conditionally include aw-notify in MERGE and BUNDLE operations
- Prevents build failures when aw-notify submodule is replaced with aw-notify-rs

Implements suggestions from PR ActivityWatch#1211 comment:
ActivityWatch#1211 (comment)
@TimeToBuildBob
Copy link
Contributor

@ErikBjare To answer your questions:

  1. Not safe to merge yet — the aw.spec issue from my earlier comment still needs fixing. CI is currently all pending (runners haven't picked up the re-triggered jobs), but once they run, the macOS Package dmg step will fail because aw.spec still calls build_analysis("aw_notify", ...) looking for Python files that no longer exist with the Rust replacement.

  2. I don't have push access to Brayo's fork — checked just now, I only have pull (read-only) on 0xbrayo/activitywatch. That was likely just aw-tauri where Brayo granted access.

Options to unblock:

  • Brayo grants me push access to 0xbrayo/activitywatch so I can push the aw.spec fix directly
  • Brayo applies the fix himself (the guard code is in my comment above)
  • You cherry-pick the fix onto the PR branch (you likely have org-level access)
  • We create a follow-up PR to master after merging this one (but that means CI will break on master temporarily)

I'd recommend option 1 or 2. @0xbrayo could you grant @TimeToBuildBob push access to your activitywatch fork, or apply the aw.spec guard from my earlier comment?

@0xbrayo
Copy link
Member Author

0xbrayo commented Feb 23, 2026

@TimeToBuildBob I have sent you an invite to be a collaborator on my fork.

@0xbrayo
Copy link
Member Author

0xbrayo commented Feb 23, 2026

@TimeToBuildBob wait for the CI builds to finish, seems like the last commit resolved the errors, except for a transient integration error on ubuntu

@TimeToBuildBob
Copy link
Contributor

The `aw.spec` fix has been pushed (commit 0367d2d). Here's the current CI summary:

macOS jobs: Both `macos-14` and `macos-latest` are now passing — the `aw.spec` guard is working correctly.

Remaining failure: `ubuntu-24.04 / Run integration tests` fails with:
```
FAILED aw-server/tests/test_client.py::test_midnight_heartbeats - AssertionError: assert 9 == 8
```
This is a pre-existing flaky timing test in aw-server, not related to this PR's changes. The other `ubuntu-24.04` job (from the second workflow run) passes fine.

Two `windows-latest` jobs are still pending (runners queued).

Short summary: the actual fix for this PR (aw.spec + submodule + README) is complete and working. The one failing job is a known flaky test unrelated to aw-notify-rs. Safe to merge once the Windows jobs complete.

@TimeToBuildBob
Copy link
Contributor

Windows jobs are both green now. All CI passes except the one pre-existing flaky test_midnight_heartbeats on Ubuntu (unrelated to this PR — it's a timing assertion in aw-server).

Ready to merge.

@ErikBjare
Copy link
Member

Merging.

@TimeToBuildBob investigate the flaky test and address in seperate PR.

@ErikBjare ErikBjare merged commit 5548a0b into ActivityWatch:master Feb 23, 2026
16 of 17 checks passed
TimeToBuildBob added a commit to TimeToBuildBob/aw-server that referenced this pull request Feb 23, 2026
The test was intermittently failing with `assert 9 == 8` because:

1. `midnight` retained residual microseconds from `datetime.now()`, making
   the exact midnight boundary non-deterministic across runs
2. Event 9 (starting at 23:59 with 1-min duration) has endtime exactly at
   midnight, and the server's `endtime >= start_query` condition sometimes
   includes it in the "after midnight" query results

Fix: zero out seconds/microseconds on the start timestamp for deterministic
boundaries, and add a 1ms offset to the query start to avoid the ambiguous
boundary where events ending exactly at midnight could be included.

Closes ActivityWatch/activitywatch#1211 (follow-up)
@TimeToBuildBob
Copy link
Contributor

Investigated the flaky test_midnight_heartbeats and submitted a fix: ActivityWatch/aw-server#157

Root cause: The test creates 20 events spanning midnight (23:50→00:09), then queries events after midnight. Event 9 (at 23:59, duration 1min) has endtime exactly at midnight. The server's endtime >= start_query SQL condition non-deterministically includes this boundary event, causing assert 9 == 8.

Fix: Zero out seconds/microseconds for deterministic timestamps + add 1ms query offset to avoid the boundary ambiguity.

ErikBjare pushed a commit to ActivityWatch/aw-server that referenced this pull request Feb 23, 2026
…157)

* fix(test): resolve flaky test_midnight_heartbeats boundary condition

The test was intermittently failing with `assert 9 == 8` because:

1. `midnight` retained residual microseconds from `datetime.now()`, making
   the exact midnight boundary non-deterministic across runs
2. Event 9 (starting at 23:59 with 1-min duration) has endtime exactly at
   midnight, and the server's `endtime >= start_query` condition sometimes
   includes it in the "after midnight" query results

Fix: zero out seconds/microseconds on the start timestamp for deterministic
boundaries, and add a 1ms offset to the query start to avoid the ambiguous
boundary where events ending exactly at midnight could be included.

Closes ActivityWatch/activitywatch#1211 (follow-up)

* style: fix Black formatting in test_midnight_heartbeats
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.

3 participants