Skip to content

Tests create managed databases in the real home: DatabaseManager::create(None) ignores its registry's directory #3780

Closed

Description

@malibio

Problem

DatabaseManager::create(name, None) places the new file under the ambient nodespace_dir()/database/<id>.db, which follows NODESPACE_HOME and otherwise the real home, even when the manager was loaded from a registry elsewhere. An in-process manager in a test (spawn_routing_daemon, registry in a temp dir) therefore writes into ~/.nodespace/database/.

Observed: every run of packages/cli/tests/it/mcp_integration.rs leaves three ULID-named ~1 MB databases there (its create_database helper passes path: None three times). 243 accumulated on one machine.

Fix

Derive the managed database directory from the manager's own registry location (<registry dir>/database). In production the registry is nodespace_dir()/databases.toml, so the path is unchanged; a manager loaded from a temp registry stays inside it by construction, and no test needs to remember to isolate.

Acceptance Criteria

  • create with no path places the file under the registry's directory, with a test
  • Running mcp_integration leaves ~/.nodespace/database/ unchanged
  • bun run test:changed passes; bun run quality:fix clean

Activity

  1. self-assigned this
    on Oct 13, 2026
  2. added a commit that references this issue on Oct 13, 2026
    140a689
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions