Skip to content

feat(server): let packaged builds override the reported version - #656

Merged
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/version-override
Aug 25, 2026
Merged

feat(server): let packaged builds override the reported version#656
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:fix/version-override

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Server-side half of item 3 in ActivityWatch/aw-android#236.

Problem

GET /api/0/info reports the aw-server-rust package version:

version: format!("v{} (rust)", VERSION.unwrap_or("(unknown)")),

That's the version of a component, not of the product the user installed. On Android the webui footer shows v0.14.0 (rust) (aw-server-rust's Cargo.toml) while the installed app is v0.14.0b2.

Fix

Add version::set_version_override(), which packaged builds call at startup to report their own release version, and a JNI entrypoint setVersionOverride mirroring the existing setDataDir pattern so aw-android can pass BuildConfig.VERSION_NAME.

The override is used verbatim — the caller owns the exact format, including any v prefix. Behaviour with no override set is unchanged.

Verification

  • cargo test -p aw-server --lib version — passes; covers the default (package version, still ends with (rust)), an override, and that a second override replaces the first verbatim.
  • cargo fmt --check clean.
  • cargo clippy -p aw-server --lib — no new warnings (existing ones are pre-existing in aw-transform/aw-datastore).

The JNI shim is #[cfg(target_os = "android")] so it isn't exercised by a host-target build; it will be covered by the aw-android submodule bump.

Follow-up

aw-android needs a matching PR to declare the external and call it from RustInterface, gated on this merging first (same sequencing as #653ActivityWatch/aw-android#237). I'll open it once this lands.

/api/0/info reports the aw-server-rust package version, which is the
version of a *component*, not of the product the user installed. On
Android the webui footer showed "v0.14.0 (rust)" while the installed app
was v0.14.0b2.

Add version::set_version_override() so builds that embed aw-server-rust
can report their own release version, plus a JNI entrypoint
(setVersionOverride) mirroring the existing setDataDir pattern so
aw-android can pass BuildConfig.VERSION_NAME at startup.

The override is used verbatim — the caller owns the format, including
any "v" prefix. Unset behaviour is unchanged.

Refs ActivityWatch/aw-android#236
@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

Greptile Summary

The PR lets packaged builds override the version returned by /api/0/info while retaining the existing package-version fallback.

  • Adds a process-wide version override and package-version fallback.
  • Connects the info endpoint to the new version provider.
  • Adds an Android JNI entry point for supplying the app release version.
  • Restores the test override to its default state when the test exits.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
aw-server/src/version.rs Implements the override, fallback formatting, and test cleanup; the previously reported persistent test-state leak is fixed.
aw-server/src/android/mod.rs Adds the Android JNI bridge that forwards the app-provided release version.
aw-server/src/endpoints/mod.rs Uses the centralized version provider for the server information response.
aw-server/src/lib.rs Exposes the new version module to the server crate.

Reviews (2): Last reviewed commit: "test(version): use Drop guard to reset g..." | Re-trigger Greptile

Comment thread aw-server/src/version.rs
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.33%. Comparing base (656f3c9) to head (9ac6d44).
⚠️ Report is 89 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #656      +/-   ##
==========================================
+ Coverage   70.81%   78.33%   +7.52%     
==========================================
  Files          51       66      +15     
  Lines        2916     5415    +2499     
==========================================
+ Hits         2065     4242    +2177     
- Misses        851     1173     +322     

☔ 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

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 77defef into ActivityWatch:master Aug 25, 2026
8 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