Skip to content

ADR-053: stop injecting NODESPACED_DB_PATH from the daemon service definitions - #1594

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:ns/adr053-remove-active-db-path
Jul 9, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:ns/adr053-remove-active-db-path

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Part of the ADR-053 epic (#1532) — the first half of the final acceptance criterion ("remove active_database_path + plist NODESPACED_DB_PATH injection").

What changed

The macOS launchd plist and the Linux systemd unit (daemon_setup.rs) injected NODESPACED_DB_PATH = $HOME/.nodespace/database/nodespace.db — the exact path the daemon already derives in resolve_db_path() when the variable is unset. Under ADR-053 the database registry is the source of truth for which database the daemon opens, so hard-coding the path in the service definition is redundant. This removes the injection from both service definitions.

Safety

Verified the daemon's default (resolve_db_path() → $HOME/.nodespace/database/nodespace.db) is identical to the removed injected value, so the database location does not change. NODESPACED_DB_PATH remains honored when set (integration tests / alternate deployments still redirect storage via test-support), it is simply no longer injected by the packaged service definition.

Scope note

The other half of the criterion — removing the vestigial active_database_path setting (the daemon never reads it for DB selection; its select/reset-database commands are effectively no-ops) and re-sourcing the Settings DB-path display from DatabaseService.List — is a separate focused change tracked on #1532, since it touches the settings proto + the tauri command layer + the frontend.

… (ADR-053)

The launchd plist and systemd unit injected NODESPACED_DB_PATH pointing at
$HOME/.nodespace/database/nodespace.db — the exact path the daemon already
derives in resolve_db_path when the variable is unset. Under ADR-053 the
database registry is the source of truth for which database the daemon opens, so
hard-coding the path in the service definition is redundant. Remove the
injection from both the macOS plist and the Linux systemd unit; the daemon falls
back to the same default, so the database location is unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE — the data-safety claim is independently verified; this is a safe, well-scoped removal.

The one thing that mattered: does removing the injection move the DB? No — verified.

The risk in dropping NODESPACED_DB_PATH injection is that the daemon's fallback path might differ from the injected one, silently relocating every community user's database (their notes would "vanish" into a fresh empty DB). I checked both sides at head bf6bc858:

  • Removed injected value (daemon_setup.rs): $HOME/{DAEMON_DB_DIR}/nodespace.db, and DAEMON_DB_DIR = ".nodespace/database" (:28) → $HOME/.nodespace/database/nodespace.db.
  • Fallback (packages/daemon/src/lib.rs:23 resolve_db_path()): when NODESPACED_DB_PATH is unset it returns home/.nodespace/database/nodespace.db (:32-34; the doc-comment at :22 states this verbatim).

Byte-identical. The daemon falls through to exactly the path that was being injected, so the database location does not change. ✅

Other checks

  • NODESPACED_DB_PATH still honored when set (lib.rs:24 env check retained) — integration tests / test-support / alternate deployments keep working; only the packaged launchd/systemd service definition stops hard-coding it. Correct per ADR-053 (the registry, not the service def, is the source of truth).
  • Dir creation retained — daemon_setup.rs:219 let db_dir = home.join(DAEMON_DB_DIR); is untouched, so the storage directory is still created; the diff is purely the two env-injection blocks (+0/-7).
  • Community behavior unchanged (this only removes a redundant env export that resolved to the default anyway).

Scope / follow-up

This is only the first half of the final #1532 criterion (stop the plist/systemd injection). The second half — removing the vestigial active_database_path setting (daemon never reads it for DB selection; select/reset-database are no-ops) and re-sourcing the Settings→Database/Diagnostics path display from DatabaseService.List — is still a separate pending PR (touches settings proto + tauri commands + frontend). So #1532 does not close on this merge alone; expect one more Stage-7 PR.

Merge gate

test:e2e COMPLETED/SUCCESS; test:all IN_PROGRESS at bf6bc858 — let it finish green before merge. (Core: re-review on each new head SHA.)

Approve.

@mstomar125
mstomar125 merged commit df4d0d9 into NodeSpaceAI:main Jul 9, 2026
2 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.

1 participant