Skip to content

feat(dirs): testing-root fallback with legacy artifacts - #152

Open
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:feat/testing-root-fallback
Open

feat(dirs): testing-root fallback with legacy artifacts#152
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:feat/testing-root-fallback

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Amends the merged #149 dirs contract with the testing-root resolution rule from ActivityWatch/activitywatch#1399.

Rule (identical contract for python and rust):

  1. If activitywatch-testing/ already exists → use it.
  2. Else if legacy testing artifacts exist in the bare activitywatch/ root (peewee-sqlite-testing.v2.db, sqlite-testing.db, config-testing.toml, settings-testing.json, …) → stay in legacy mode (old paths, old -testing filenames).
  3. Else (fresh setup) → create and use activitywatch-testing/.

Inside isolated profile roots (including new-style testing), datastore and log filenames are bare. Suffixed names remain only in legacy mode so existing peewee-sqlite-testing.v2.db files are not orphaned.

This is the first item in the merge order: aw-core fix + release → aw-server-rust#652 → aw-server#167 → aw-client#118 → aw-tauri#241.

Not in this PR: cutting a PyPI release (needs a maintainer). Downstream PRs cannot pick this up until that lands.

AW_PROFILE=testing now follows the #1399 resolution rule: use
activitywatch-testing/ when it exists or the setup is fresh; stay on
the shared activitywatch root (and -testing filenames) only when
legacy testing artifacts are present and the new root is not.

Bare filenames inside isolated profile roots; suffixed names remain
legacy-only so existing peewee-sqlite-testing.v2.db files are not
orphaned.
@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a compatibility-aware testing-profile root resolver that preserves legacy shared-root artifacts while using isolated roots for fresh installations.

  • Detects existing isolated testing roots and legacy testing artifacts across data, configuration, and cache directories.
  • Uses bare datastore and log filenames inside isolated profiles while retaining testing suffixes in legacy shared-root mode.
  • Aligns Peewee migration discovery with the selected layout.
  • Adds directory-resolution tests covering fresh, legacy, and mixed-artifact setups.

Confidence Score: 5/5

The PR appears safe to merge, with the directory, datastore, migration, and logging changes consistently implementing the documented compatibility rule.

No concrete changed-code failure remains after checking legacy filename coverage, root precedence, migration naming, and reachable log-discovery behavior.

Important Files Changed

Filename Overview
aw_core/dirs.py Adds the testing-root precedence and legacy-artifact detection used consistently by all directory categories.
aw_core/log.py Moves testing-log filename differentiation to legacy shared-root mode while isolated profiles rely on directory separation.
aw_datastore/migration.py Aligns legacy Peewee database discovery with the testing layout’s filename policy.
aw_datastore/storages/peewee.py Uses bare database filenames in isolated profiles and preserves testing suffixes in legacy mode.
aw_datastore/storages/sqlite.py Applies the same layout-aware filename policy to the current SQLite datastore.
tests/test_dirs.py Adds isolated filesystem tests for fresh installations, legacy fallback, precedence, suffixing, and profile separation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[AW_PROFILE=testing] --> B{Any activitywatch-testing root exists?}
    B -- Yes --> C[Use isolated activitywatch-testing roots]
    B -- No --> D{Legacy testing artifacts exist?}
    D -- Yes --> E[Use shared activitywatch roots]
    D -- No --> C
    C --> F[Bare datastore and log filenames]
    E --> G[Legacy -testing filenames]
    F --> H[Open datastore and write logs]
    G --> H
Loading

Reviews (1): Last reviewed commit: "feat(dirs): testing-root fallback with l..." | Re-trigger Greptile

@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.

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