feat(server): let packaged builds override the reported version - #656
Conversation
/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 SummaryThe PR lets packaged builds override the version returned by
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "test(version): use Drop guard to reset g..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@greptileai review |
|
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. |
Server-side half of item 3 in ActivityWatch/aw-android#236.
Problem
GET /api/0/inforeports the aw-server-rust package version: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'sCargo.toml) while the installed app isv0.14.0b2.Fix
Add
version::set_version_override(), which packaged builds call at startup to report their own release version, and a JNI entrypointsetVersionOverridemirroring the existingsetDataDirpattern so aw-android can passBuildConfig.VERSION_NAME.The override is used verbatim — the caller owns the exact format, including any
vprefix. 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 --checkclean.cargo clippy -p aw-server --lib— no new warnings (existing ones are pre-existing inaw-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 #653 → ActivityWatch/aw-android#237). I'll open it once this lands.