Skip to content

fix(ci): use 'poetry run' in test target + run typecheck#129

Merged
ErikBjare merged 1 commit into
masterfrom
fix/ci-test-poetry-run
Jun 24, 2026
Merged

fix(ci): use 'poetry run' in test target + run typecheck#129
ErikBjare merged 1 commit into
masterfrom
fix/ci-test-poetry-run

Conversation

@ErikBjare

Copy link
Copy Markdown
Member

Problem

The test target invoked the bare console script:

test:
	aw-watcher-window --help

This only resolves when the venv's bin/ is on PATH. In the main repo's unified release workflow (ActivityWatch/activitywatch#1313) the step does source venv/bin/activate && make test, which makes this flaky — the macOS Tauri job passed this step on one run and failed on the next with:

Running tests for aw-watcher-window
aw-watcher-window --help
make[1]: aw-watcher-window: No such file or directory

The nick-fields/retry wrapper then just re-ran the identical deterministic failure 3×. (Example: activitywatch run 28040663454, attempt 2.)

Fix

Use poetry run, matching aw-watcher-afk and aw-watcher-input, which resolve the entrypoint regardless of PATH. Also run make typecheck here like the sibling watchers — window was skipping mypy entirely.

test:
	poetry run aw-watcher-window --help  # Ensures that it at least starts
	make typecheck

The aw-watcher-window console script is defined in pyproject.toml (aw-watcher-window = "aw_watcher_window:main"), so poetry run resolves it reliably.

The test target called the bare 'aw-watcher-window' console script, which
only resolves when the venv's bin/ is on PATH. Under the unified release
workflow (activates venv, then 'make test') this is flaky: the same job
that passes on one run fails with 'aw-watcher-window: No such file or
directory' on another, and the retry wrapper just re-runs the identical
failure.

Switch to 'poetry run aw-watcher-window --help' to match aw-watcher-afk
and aw-watcher-input, which resolves the entrypoint regardless of PATH.
Also run 'make typecheck' here like the sibling watchers (window was
skipping mypy entirely).
@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a flaky CI failure where the bare aw-watcher-window console script couldn't be resolved when the venv's bin/ wasn't on PATH. It also adds make typecheck (mypy) to the test target, aligning aw-watcher-window with sibling watchers.

  • Replaces the bare aw-watcher-window --help invocation with poetry run aw-watcher-window --help, which resolves the entry point through Poetry's venv regardless of PATH.
  • Chains make typecheck into the test target so type-checking is no longer silently skipped in CI.

Confidence Score: 5/5

Safe to merge — the change is a two-line fix that replaces a PATH-dependent invocation with a reliable poetry run call and wires in the existing typecheck target.

The fix directly addresses the described flaky CI failure with a minimal, well-understood change. The only note is that make typecheck should ideally be $(MAKE) typecheck to propagate parent make flags, but the pattern is already present elsewhere in the file and has no practical impact on normal CI runs.

No files require special attention.

Important Files Changed

Filename Overview
Makefile Replaces bare script invocation with poetry run and adds make typecheck; uses make instead of $(MAKE) (consistent with existing pattern in the file)

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant CI as CI Runner
    participant Make as make test
    participant Poetry as poetry run
    participant Watcher as aw-watcher-window
    participant Mypy as make typecheck

    CI->>Make: make test
    Make->>Poetry: poetry run aw-watcher-window --help
    Poetry->>Watcher: resolve via venv (PATH-independent)
    Watcher-->>Poetry: exit 0
    Poetry-->>Make: success
    Make->>Mypy: make typecheck
    Mypy->>Poetry: poetry run mypy aw_watcher_window/
    Poetry-->>Mypy: type-check results
    Mypy-->>Make: exit 0
    Make-->>CI: test target complete
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant CI as CI Runner
    participant Make as make test
    participant Poetry as poetry run
    participant Watcher as aw-watcher-window
    participant Mypy as make typecheck

    CI->>Make: make test
    Make->>Poetry: poetry run aw-watcher-window --help
    Poetry->>Watcher: resolve via venv (PATH-independent)
    Watcher-->>Poetry: exit 0
    Poetry-->>Make: success
    Make->>Mypy: make typecheck
    Mypy->>Poetry: poetry run mypy aw_watcher_window/
    Poetry-->>Mypy: type-check results
    Mypy-->>Make: exit 0
    Make-->>CI: test target complete
Loading

Reviews (1): Last reviewed commit: "fix(ci): use 'poetry run' in test target..." | Re-trigger Greptile

Comment thread Makefile
test:
aw-watcher-window --help
poetry run aw-watcher-window --help # Ensures that it at least starts
make typecheck

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 Using a bare make subprocess here works but loses any flags passed to the parent invocation (e.g., -j, --dry-run, or custom MAKEFLAGS). The idiomatic way to recurse into make is $(MAKE), which forwards the parent's flags automatically. The existing build target has the same pattern, so this is consistent — but worth fixing in both places if CI options ever expand.

Suggested change
make typecheck
$(MAKE) typecheck

@ErikBjare ErikBjare merged commit fd5cfcb into master Jun 24, 2026
6 checks passed
@ErikBjare ErikBjare deleted the fix/ci-test-poetry-run branch June 24, 2026 10:56
ErikBjare added a commit to ActivityWatch/activitywatch that referenced this pull request Jun 24, 2026
Pulls in ActivityWatch/aw-watcher-window#129, which switches the Makefile
test target to 'poetry run aw-watcher-window --help' (+ typecheck). Fixes
the flaky 'aw-watcher-window: No such file or directory' failure in the
unified release workflow when the venv bin/ isn't on PATH.
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.

1 participant