Skip to content

build(windows): embed PE version resource in aw-server and aw-sync - #863

Merged
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/windows-version-resource
Nov 15, 2026
Merged

ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/windows-version-resource

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Part of Windows code signing via SignPath Foundation (ActivityWatch/activitywatch#632, raised in priority by ActivityWatch/activitywatch#1558: Smart App Control blocks unsigned v0.14.2 with no "run anyway"). SignPath requires product name/version metadata on every signed binary. ActivityWatch/activitywatch#1559 adds it to the PyInstaller exes. This PR covers the two Rust exes in the Windows bundles: aw-server.exe (Qt bundle) and aw-sync.exe (both bundles).

What it does

  • build-support/windows_resource.rs, included by the aw-server and new aw-sync build scripts, writes a VERSIONINFO resource script to OUT_DIR and links it with embed-resource's compile_for.
  • compile_for emits rustc-link-arg-bin=<bin>=…, so the resource reaches only that binary target. The aw-server library that aw-tauri depends on gets none, so aw-tauri's own VERSIONINFO is not duplicated.
  • For non-Windows targets, including Android, it does nothing (checked through CARGO_CFG_TARGET_OS, so cross builds also work).
  • Strings match build(windows): embed PE version info in PyInstaller executables activitywatch#1559: ProductName ActivityWatch, CompanyName ActivityWatch Contributors. FileVersion is the crate version. ProductVersion comes from AW_VERSION when set, otherwise the crate version, so the bundle can make every exe report the release version.
  • CI: a new step in the windows-latest build reads VersionInfo for both exes and fails if the resource is missing.

Verified locally (Linux): the workspace builds with the resource step as a no-op, and cargo fmt --check, rustfmt --check on the included file and cargo clippy on aw-server/aw-sync are clean. The Windows link path is verified only by this PR's windows-latest job.

New build-only dependencies: embed-resource plus its small dependency tree (vswhom, winreg, rustc_version). Nothing changes in the runtime dependency graph.

Open-PR cap override: Bob has 12 open PRs here (the cap is 10). I opened this one anyway because it is a small prerequisite for the Windows signing that was re-prioritized on #632 today. It is not new feature scope.

Code-signing services (SignPath Foundation, ActivityWatch/activitywatch#632)
require product name/version metadata on each signed executable. The Rust
binaries in the Windows bundle currently ship without a VERSIONINFO resource.

Generate the resource script in OUT_DIR and link it via embed-resource's
compile_for, which scopes it to the named binary target only: the aw-server
library (used by aw-tauri) gets no resource, so no duplicate VERSIONINFO.
No-op for non-Windows targets, including Android. AW_VERSION, when set,
overrides the product version so all bundled exes report the release version.

CI asserts the resource on the windows-latest build.

Git-Session-Id: 8ff886b3-a994-4b4f-9425-e72784bd3d1c
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Review guide (auto-posted)

Structured warm-up for reviewers — what changed, what to run, where to look.

Key files

  • Cargo.lock (+91/-5, Δ96)
  • build-support/windows_resource.rs (+85/-0, Δ85)
  • .github/workflows/build.yml (+12/-0, Δ12)
  • aw-sync/build.rs (+5/-0, Δ5)
  • aw-server/build.rs (+4/-0, Δ4)
  • aw-server/Cargo.toml (+3/-0, Δ3)
  • aw-sync/Cargo.toml (+3/-0, Δ3)

Suggested verification

  • Run the repo's usual CI-equivalent checks locally

Known risks / watch points

  • No automatic high-risk tags; use file list + diff for judgment.

Suggested review focus

  • Confirm behavior matches the PR description acceptance criteria.
  • Skim the largest diffs first (listed above).
  • If CI is green, spot-check the highest-risk paths called out here.

Generated by scripts/github/pr-warmup-review-guide.py for #863.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the previous finding is fixed and no new actionable issues were found.

Summary

Adds Windows version metadata to aw-server.exe and aw-sync.exe, with resources linked only to the named binaries.

  • Windows server and sync files now carry ActivityWatch version details.

Reviews (2) · Last reviewed commit: "fix(windows): require resource compiler ..." · Reviewed by Greptile

Comment thread .github/workflows/build.yml Resolved
@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #863       +/-   ##
===========================================
+ Coverage   70.81%   85.87%   +15.05%     
===========================================
  Files          51       89       +38     
  Lines        2916    13030    +10114     
===========================================
+ Hits         2065    11189     +9124     
- Misses        851     1841      +990     

☔ 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 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Adds a shared Windows VERSIONINFO resource generator used by the aw-server and aw-sync build scripts, with embed-resource added as a build dependency. FileVersion uses the crate version, while ProductVersion accepts an AW_VERSION override. The Windows CI workflow checks both executables’ metadata, rebuilds with a synthetic override, and restores the fallback versions.

Safe to merge — no P0/P1 findings

Confidence 5/5

⚠️ 1 generated file excluded and NOT reviewed: Cargo.lock (+91/-5 lines, 4KB). Machine-generated output is removed from the diff before review — from what the model sees and from the size gate alike — so nothing below says anything about it.

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

Files changed (6) — the diff as I read it
  • .github/workflows/build.yml — Adds Windows executable metadata assertions and rebuilds both binaries with and without an AW_VERSION override.
  • aw-server/Cargo.toml — Adds embed-resource version 3 as a build dependency.
  • aw-server/build.rs — Includes the shared resource helper and calls embed_windows_version_resource for aw-server.
  • aw-sync/Cargo.toml — Adds embed-resource version 3 as a build dependency.
  • aw-sync/build.rs — Adds a build script that includes the shared resource helper and calls embed_windows_version_resource for aw-sync.
  • build-support/windows_resource.rs — Adds Windows resource generation, binary-specific linking, AW_VERSION normalization and fallback, and conversion of version prefixes into four numeric components.
Previous review passes
commit score findings engine when
3c111184906d 4/5 1 subscription 2026-11-14 17:05 UTC

Reviewed fa816992ba04 · panel: codex:gpt-6.1-sol · subscription engine · 67s · about this reviewer

Maintainer commands

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

Comment thread build-support/windows_resource.rs Resolved
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Verified the uploaded Windows binaries from run 43618351989, head 3c11118: both contain ProductName=ActivityWatch and the correct OriginalFilename; FileVersion and fallback ProductVersion are 0.14.0 for aw-server and 0.1.0 for aw-sync. The native Windows metadata check and test steps passed.

Two changes remain: assert the actual file/product versions in CI, including a known AW_VERSION override (Greptile's finding), and fail rather than silently omit resources when a Windows resource compiler is unavailable (the outage review's finding). No code changed in this monitoring pass: the originating signing session still holds the branch/worktree lease, and I requested its handoff rather than editing concurrently. These findings remain open for the next fix pass. No merge attempted.

Git-Session-Id: 7e20fb0e-1567-5ea7-bba7-499e7eeeafa8
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Review disposition — maintainer decision

  • Fixed: No additional code changes in this pass. The preceding fix, fa816992ba0421571d9fae5ab81279e460da2bdf, addresses both correctness findings: CI now asserts file/product versions through fallback → AW_VERSION=v9.8.7 → fallback rebuilds, and manifest_required() rejects a missing Windows resource compiler instead of silently omitting metadata. Both inline threads already have fix replies and are resolved.
  • Remaining: None in the current review threads; no findings dismissed as nitpicks or false positives. No unanswered human comments.
  • Verified against: fa816992ba0421571d9fae5ab81279e460da2bdf. Greptile's latest summary names this head at 5/5; the automated AI-review sweep has now also published its current-head 5/5, no-findings pass. That AI review is a single subscription pass, not a multi-reviewer consensus claim.
  • CI: Windows, macOS, Linux, Android, format and clippy passed. Code coverage is still running, so this is not an all-checks-green claim. The native Windows version-resource step passed in run 43621811000.
  • Domain risk: This supplies executable metadata, not signing or Smart App Control acceptance. Maintainers should verify the final release bundle's shared product version and signing acceptance in the downstream signing workflow.
  • Convergence: Detector verdict converged, round_convergence.status=no_current_blocking, stable_rounds=0 (required: 2); zero unresolved P1/P2 findings. The stable-round counter is not evidence of two stable rounds.

No further Greptile review requested and no merge attempted. Recommend maintainer consideration once the remaining CI check completes; this does not waive repository merge gates.

@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 pushed a commit to ActivityWatch/activitywatch that referenced this pull request Nov 15, 2026
* build(windows): export AW_VERSION to the Rust builds

The aw-server-rust and aw-notify build scripts embed AW_VERSION as the
PE ProductVersion (ActivityWatch/aw-server-rust#863,
ActivityWatch/aw-notify-rs#48). Export it from the bundle Makefile on
Windows, using the same value package-all.sh gives the Python
executables and the installer (no v prefix, no -research suffix), so
every signed executable in the bundle reports one release version.
An explicit AW_VERSION in the environment is kept.

Git-Session-Id: 10536267-7445-4d74-b935-9a27edb7aed2

* fix(tests): normalize research suffix in AW_VERSION expectation

Git-Session-Id: cfb8409c-0e1b-5e0e-9ced-0399f97d2c4d
@ErikBjare
ErikBjare merged commit c41f32a into ActivityWatch:master Nov 15, 2026
8 checks passed
ErikBjare pushed a commit to ActivityWatch/aw-notify-rs that referenced this pull request Nov 15, 2026
Code-signing services (SignPath Foundation, ActivityWatch/activitywatch#632)
require product name/version metadata on each signed executable. Same
build-script approach as ActivityWatch/aw-server-rust#863: generate a
VERSIONINFO .rc in OUT_DIR and link it to the aw-notify binary only via
embed-resource's compile_for. No-op for non-Windows targets. AW_VERSION,
when set, overrides the product version.

CI asserts the resource on the Windows release build.

Git-Session-Id: 8ff886b3-a994-4b4f-9425-e72784bd3d1c
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