Skip to content

Fix: auto-detect Things DB container dir instead of hardcoding suffix#1

Merged
kaufmanhenry merged 1 commit into
mainfrom
fix/auto-detect-things-db-path
Jun 16, 2026
Merged

Fix: auto-detect Things DB container dir instead of hardcoding suffix#1
kaufmanhenry merged 1 commit into
mainfrom
fix/auto-detect-things-db-path

Conversation

@kaufmanhenry

Copy link
Copy Markdown
Owner

Problem

src/lib/constants.js hardcoded the Things database path with the container suffix ThingsData-C1ON7. That suffix is randomized per Things install, so the path resolves only on the machine the repo was developed on. On every other machine, all reads fail with:

Error: Cannot open database because the directory does not exist

(Confirmed on a fresh machine where the live dir is ThingsData-L7FPA.)

Fix

Resolve the DB path at runtime:

  1. THINGS_DB_PATH env var, if set (explicit override)
  2. Otherwise scan the group container for the live ThingsData-* dir containing Things Database.thingsdatabase/main.sqlite (skips Backups/)
  3. Otherwise fall back to the original hardcoded path, so error messages stay informative

Testing

npm test — all 71 tests pass (13 suites, unit + integration). Change is additive; the env-override path keeps the existing fixture-based integration tests working.

The ThingsData-XXXXX directory suffix under the group container is
randomized per Things install, so the hardcoded ThingsData-C1ON7 path
fails on every other machine with 'Cannot open database because the
directory does not exist'.

Resolve the DB path at runtime: honor a THINGS_DB_PATH override, else
scan the group container for the live ThingsData-* dir, else fall back
to the legacy hardcoded path so error messages stay informative.
@kaufmanhenry kaufmanhenry merged commit 7509652 into main Jun 16, 2026
3 checks passed
@kaufmanhenry kaufmanhenry deleted the fix/auto-detect-things-db-path branch June 16, 2026 13:42
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