Skip to content

fix: the data directory is part of the contract - #139

Merged
fylorn merged 1 commit into
mainfrom
fix/data-dir-in-contract
Sep 23, 2026
Merged

fylorn merged 1 commit into
mainfrom
fix/data-dir-in-contract

Conversation

@fylorn

@fylorn fylorn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

The desktop app resolves the data directory itself (data_dir() in lite's lib.rs), reading only HOME. On Windows HOME is normally unset, so it falls back to a relative .thinkwatch in the current directory, while core uses %APPDATA%\ThinkWatch. The control port file and token live in that directory, so on Windows the app would look for a running gateway in the wrong place and never connect.

This moves the resolver (Convention, pick, and its tests unchanged) from tw-config into tw-api as tw_api::data::dir(), next to control::Endpoint, which moved there for the same reason. lite will call it after the next core release instead of keeping its own copy.

  • tw_config::default_dir is removed; default_path, twcore, tw-adopt and tw-control call tw_api::data::dir().
  • tw-config and tw-adopt now depend on tw-api (a leaf crate: serde + tw-types only), no cycle.
  • CONTROL_API_VERSION is unchanged: nothing on the wire changes.

Verification

cargo fmt --check, cargo clippy --all-targets -D warnings and cargo test --workspace pass on macOS. The moved tests cover both conventions on any host.

🤖 Generated with Claude Code

The desktop app resolved the data directory on its own, from HOME only.
On Windows HOME is normally unset, so it fell back to `.thinkwatch` in
the current directory while core used %APPDATA%\ThinkWatch. The port
file and the token live in that directory: the app would look for a
running gateway in the wrong place and never find it.

The resolver moves from tw-config into tw-api as `tw_api::data::dir()`,
next to `control::Endpoint`, which moved there for the same reason. The
desktop app can then ask the same function instead of keeping a copy.
tw-config's `default_dir` is gone; its callers use the new one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the fix/data-dir-in-contract branch from cfdb5fd to 3ee751f Compare September 23, 2026 12:30
@fylorn
fylorn merged commit 8c6298e into main Sep 23, 2026
2 checks passed
@fylorn
fylorn deleted the fix/data-dir-in-contract branch September 23, 2026 12:44
@fylorn fylorn mentioned this pull request Sep 23, 2026
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