Skip to content

fix(dirs): keep install-relative discovery paths out of the persisted defaults - #283

Merged
ErikBjare merged 4 commits into
masterfrom
fix/appimage-in-place-modules
Oct 10, 2026
Merged

ErikBjare merged 4 commits into
masterfrom
fix/appimage-in-place-modules

Conversation

@ErikBjare

@ErikBjare ErikBjare commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

On first run, UserConfig::default() writes get_discovery_paths() into config.toml. That list included the install-relative paths: the deb/rpm lib dir and $APPDIR, which is a different /tmp/.mount_* dir on every AppImage run. Saved config paths outrank the runtime ones, so after moving or reinstalling, aw-tauri kept searching (and preferring) the first install's paths.

The module manager already adds get_install_discovery_paths() at runtime (discover_modules), so this drops them from the persisted defaults. The first-run awatcher check still searches them. New test: test_discovery_defaults_exclude_install_paths.

Scope change: this PR originally also discovered modules next to the .AppImage file (for the release zip layout). That's dropped. The AppImage should be self-contained and runnable from anywhere, with awatcher + aw-sync bundled inside it (ActivityWatch/activitywatch#1499), not depend on folders next to it. The review comment about persisting those paths led to the fix that remains here.

cargo test --lib: 49 passed; cargo clippy --all-targets -D warnings clean (macOS; the Linux paths are cfg(any(target_os = "linux", test))).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T12:42:44.554729Z 5abecf3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 209d882ffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/dirs.rs Outdated
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes module discovery path handling for configuration defaults.

The PR appears safe to merge; no new actionable issues were found.

What we checked:

  • Tests use separate install paths: Only the new test touches APPDIR. The other install-path tests pass their paths directly, so they do not use its temporary value.

Summary

The PR keeps install-relative module paths out of newly saved defaults while still searching them at runtime.

  • The first-run Linux watcher check still includes bundled modules.
  • The updated Linux test creates a fake AppImage tree and checks that its paths are not saved.
  • No new actionable issues were found in the changes since the previous review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User discovery paths] --> B[Saved config defaults]
  A --> C[First-run Linux watcher check]
  D[Current install paths] --> C
  D --> E[Runtime module discovery]
  B --> E
Loading

Reviews (4) · Last reviewed commit: "test(dirs): make the persisted-defaults ..." · Reviewed by Greptile

@TimeToBuildBob

TimeToBuildBob commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI code review

This PR removes install-relative discovery paths (from get_install_discovery_paths) from the persisted defaults written by UserConfig::default() into config.toml, so that first-run config no longer pins paths like $APPDIR/usr/lib/aw-tauri/modules. It updates the Linux default module selection in lib.rs to still search install-relative paths at runtime when deciding whether aw-awatcher is available. It adds a Linux test that fakes an APPDIR mount and asserts those install paths are not present in get_discovery_paths().

Safe to merge — no P0/P1 findings

Confidence 5/5

✅ No thread-worthy findings. Advisory notes follow; they are retained without opening review threads.

1 advisory finding (summary-only, not scored)

These P2 guard, heuristic, trade-off, or documentation claims are retained for judgment without opening review threads.

⚠️ P2 medium — src-tauri/src/lib.rs

This is a fix(...) PR but no test files are included in the diff. Erik's feedback: 'where is the repro & fixes they are supposed to catch' (gptme#3441), 'that measurement should come with a regression test' (gptme#3446). Add a test that would have caught this bug. (Advisory: Erik merged all such PRs but consistently requested tests.)

Add a test file that reproduces the bug before the fix and passes after it.

How this was verified: static preflight: fix-commit + touched-files scan (rule 7)

Files changed (2) — the diff as I read it
  • src-tauri/src/dirs.rs — Removes get_install_discovery_paths() from get_discovery_paths() on Linux and macOS, adds doc comment, and adds test_discovery_defaults_exclude_install_paths.
  • src-tauri/src/lib.rs — In UserConfig::default() Linux branch, chains get_install_discovery_paths() into the search paths used by module_available for aw-awatcher.
Previous review passes
commit score findings engine when
209d882ffb33 5/5 0 llm 2026-10-07 10:18 UTC
4bd0744fa61a 4/5 1 llm 2026-10-07 12:34 UTC
86e84040496f 4/5 1 llm 2026-10-07 12:52 UTC
be4f292f3a69 4/5 1 llm 2026-10-07 13:30 UTC
42992cee009b 4/5 1 llm 2026-10-07 21:52 UTC

Reviewed 42992cee009b · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 30s · about this reviewer

Maintainer commands

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

@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Checked 7baa209: install-relative paths are now runtime-only, and the first-run aw-awatcher availability check still includes them. That addresses the stale-bundle-path finding.

My earlier review's “no test files” advisory was incorrect: the regression tests are inline in dirs.rs, including test_linux_install_paths_appimage_run_in_place and test_discovery_defaults_exclude_install_paths. No extra test file is needed.

No code change or review retrigger from me. Greptile is green on this head; format, clippy, and release checks are still queued. I inspected the diff, but did not independently run the tests.

@ErikBjare
ErikBjare force-pushed the fix/appimage-in-place-modules branch 2 times, most recently from 1b7cf1e to 4bd0744 Compare October 7, 2026 11:44
@ErikBjare ErikBjare changed the title fix(linux): discover modules next to the AppImage, so the release zip runs in place fix(dirs): keep install-relative discovery paths out of the persisted defaults Oct 7, 2026
@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review

ErikBjare added a commit to ActivityWatch/activitywatch that referenced this pull request Oct 7, 2026
aw-tauri only descends into aw-* dirs when discovering modules, so the
zip's `awatcher/` dir was never found; ship it as `aw-awatcher/`. Drop
move-to-aw-modules.sh (copying into ~/aw-modules was a workaround for
aw-tauri not looking next to the AppImage, fixed in ActivityWatch/aw-tauri#283)
and rewrite README.txt for running in place.
@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Checked the revised scope at 4bd0744: adjacent-.AppImage discovery is now dropped; the remaining diff only keeps install-relative paths out of persisted defaults while retaining them for the first-run watcher check. test_discovery_defaults_exclude_install_paths remains in the diff. This supersedes my earlier reference to the run-in-place test, which was removed with that feature.

Your latest Greptile request completed at 5/5 on this head, with no new findings. Format, clippy, and all five release jobs are still queued. No code changes, merge, or additional review trigger from me; I did not independently run the Rust tests.

@ErikBjare

Copy link
Copy Markdown
Member Author

@TimeToBuildBob review

Comment thread src-tauri/src/dirs.rs Outdated
@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review
@TimeToBuildBob review

Comment thread src-tauri/src/dirs.rs Outdated
@ErikBjare

Copy link
Copy Markdown
Member Author

@TimeToBuildBob review

Comment thread src-tauri/src/dirs.rs Outdated
@ErikBjare

Copy link
Copy Markdown
Member Author

@TimeToBuildBob review

Comment thread src-tauri/src/dirs.rs

@TimeToBuildBob TimeToBuildBob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. The fix is correct and the scope is right.

Key invariants verified:

  • get_discovery_paths() no longer persists install-relative paths (deb/rpm lib dir, AppImage $APPDIR), so config.toml stays valid after move/reinstall
  • UserConfig::Default expands the search to include install paths at first-run time (the search vec in lib.rs) — bundled awatcher is still discovered, just not locked in
  • Test uses AppDirGuard RAII to fake an AppImage mount, confirms APPDIR-rooted paths don't appear in get_discovery_paths()

The lib.rs change is Linux-only which is appropriate since the stale-mount bug is AppImage-specific. cargo clippy --all-targets -D warnings clean + 49 passing tests is sufficient CI for a focused dirs change.

@TimeToBuildBob TimeToBuildBob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct fix. The core invariant — install-relative paths are runtime-only, never persisted — is well-stated in the docstring and enforced by the test.

The lib.rs change is the right complement: default_linux_modules still searches both user and install paths to detect aw-awatcher (needed to set the right default), but only the user-level paths flow into the persisted config. The AppDirGuard test is thorough — it isolates the fake APPDIR scope and explicitly filters the exe's own dir from the assertion to avoid false positives when run from a user directory.

@TimeToBuildBob TimeToBuildBob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct fix. The core invariant — install-relative paths are runtime-only, never persisted — is well-stated in the docstring and enforced by the test.

The lib.rs change is the right complement: default_linux_modules still searches both user and install paths to detect aw-awatcher (needed to set the right default), but only the user-level paths flow into the persisted config. The AppDirGuard test is thorough — it isolates the fake APPDIR scope and explicitly filters the exe's own dir from the assertion to avoid false positives when run from a user directory.

… defaults

UserConfig::default() wrote get_discovery_paths() into config.toml on first
run, and that included the install-relative paths: the deb/rpm lib dir and
$APPDIR (a per-run AppImage mount point). Saved config paths outrank
runtime ones, so a later install elsewhere kept searching (and preferring)
the first install's paths. The module manager already adds
get_install_discovery_paths() at runtime, so drop them from the defaults;
the first-run awatcher check still searches them.
It looped over get_install_discovery_paths(), which is empty on
macOS/Windows and on Linux without an install layout, so it checked
nothing. Fake an AppImage mount via APPDIR, assert the install paths are
non-empty first, then assert none of them are in the persisted defaults.
Linux-only, since that's the platform with install-relative paths.
@ErikBjare
ErikBjare force-pushed the fix/appimage-in-place-modules branch from 42992ce to 5abecf3 Compare October 10, 2026 12:40
@ErikBjare
ErikBjare merged commit d1796e4 into master Oct 10, 2026
7 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