Skip to content

fix(config): use [server] in isolated profile roots - #170

Open
TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:bob/isolated-root-config
Open

fix(config): use [server] in isolated profile roots#170
TimeToBuildBob wants to merge 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:bob/isolated-root-config

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Why

activitywatch#1434: Erik asked to check aw-server, which used [server-testing] in the same file as prod. That is the pre-profile model. Isolated roots (activitywatch-testing/, activitywatch-research/, …) already separate instances, so a second section in the same file is the same class of bug as aw-qt reading config-<profile>.toml while rust writes config.toml.

What

  • Isolated roots get a single [server] section with the profile's default port (5666 for testing, 5600 otherwise). The directory isolates; [server-testing] is not written there.
  • config_section() returns [server] except in the legacy shared-root testing layout, where [server-testing] is kept so existing installs are not orphaned.
  • settings.json is similarly bare in isolated roots; settings-testing.json remains legacy-only.

Companion: ActivityWatch/aw-qt (tray/manager port lookup now reads isolated-root config.toml / [server]).

Tests

pytest tests/test_profile_config.py tests/test_profile.py: 41 passed.

Refs: ActivityWatch/activitywatch#1434

[server-testing] in the same file as [server] is the pre-profile model.
Isolated roots (activitywatch-testing/, activitywatch-research/, ...)
already separate instances, so they get a single [server] section with
the profile's default port, and settings.json without a suffix.

Legacy shared-root testing still reads [server-testing] and
settings-testing.json so existing installs are not orphaned.

Refs: ActivityWatch/activitywatch#1434
@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes isolated profile roots to use conventional, unsuffixed configuration resources while preserving the legacy shared-root testing layout.

  • Isolated profiles select [server] and settings.json.
  • Legacy shared-root testing retains [server-testing] and settings-testing.json.
  • Profile-aware defaults and tests cover the intended section, filename, and port behavior.
  • The dependency range must be updated because its currently resolved aw-core version lacks the root-layout helpers required to activate the new behavior.

Confidence Score: 4/5

The PR is not yet safe to merge because isolated testing remains on the legacy configuration paths under the repository’s currently supported aw-core dependency.

The new behavior relies on two aw-core directory helpers, but the dependency remains resolved to aw-core 0.5.18; the fallbacks then classify every testing profile as legacy and preserve the old section and filename.

Files Needing Attention: aw_server/config.py, aw_server/settings.py, pyproject.toml, poetry.lock

Important Files Changed

Filename Overview
aw_server/config.py Adds profile-aware defaults and section selection, but its compatibility fallback misclassifies isolated testing roots with the currently supported aw-core version.
aw_server/settings.py Selects bare or legacy-suffixed settings filenames using an aw-core helper that is unavailable in the currently resolved dependency.
aw_server/main.py Passes the resolved profile into configuration loading and adjusts fallback warnings for isolated [server] sections.
tests/test_profile_config.py Covers isolated and legacy section selection, settings filenames, and named-profile port loading, but assumes newer aw-core helper availability.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Resolve and export profile] --> B{Legacy shared testing root?}
  B -- Yes --> C[Read server-testing section]
  B -- Yes --> D[Read settings-testing.json]
  B -- No --> E[Read server section]
  B -- No --> F[Read settings.json]
Loading

Reviews (1): Last reviewed commit: "fix(config): use [server] in isolated pr..." | Re-trigger Greptile

Comment thread aw_server/config.py
XDG_*_HOME only redirects platformdirs on Linux. The legacy-testing
marker was planted under the XDG data path, so Windows/macOS never
saw it and kept using [server] / settings.json.
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