Skip to content

fix(cli): honor top-level --db when a subcommand follows (#313)#314

Merged
tcconnally merged 1 commit into
mainfrom
fix/cli-db-propagation-313
Jun 30, 2026
Merged

fix(cli): honor top-level --db when a subcommand follows (#313)#314
tcconnally merged 1 commit into
mainfrom
fix/cli-db-propagation-313

Conversation

@tcconnally

Copy link
Copy Markdown
Collaborator

Closes #313.

mimir --db PATH serve silently ignored --db and used the subcommand's default path — any MCP host config using args: ["--db", "/path", "serve"] connected to the wrong database with no warning (and the Perseus connector default used exactly this pattern, see perseus#528).

Fix

The top-level --db (documented for mimir --db PATH) is now propagated into a following subcommand when the user didn't pass a subcommand-level --db (it still equals the default). An explicit subcommand --db always wins; obsidian-sync's Option db is filled when None. Centralized in apply_top_level_db() (one call in main()) + a Commands::db_field_mut() accessor.

Tests

  • top_level_db_propagates_to_serve_subcommand, ..._to_obsidian_sync, explicit_subcommand_db_wins_over_top_level (new); existing parses_serve_with_db still green.
  • E2E: mimir --db P stats creates/opens the DB at P (was: default path).

`mimir --db PATH serve` silently ignored the flag and used the subcommand's
default db path — a serious footgun for MCP host configs (`args: ["--db", P,
"serve"]` connected to the wrong database with no warning). The top-level
`--db` is documented for `mimir --db PATH` but was never propagated once a
subcommand was present; each subcommand's own defaulted `--db` won.

Propagate the top-level `--db` into the subcommand when the user didn't pass a
subcommand-level one (i.e. it still equals the default). An explicit
subcommand-level `--db` always wins; ObsidianSync's Option<String> db is filled
when None. Added a `Commands::db_field_mut()` accessor + `apply_top_level_db()`
called once in main(), plus tests for the propagate / explicit-wins / obsidian
cases. Verified e2e: `mimir --db P stats` now creates/opens the DB at P.

Closes #313.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tcconnally tcconnally merged commit ef0ae42 into main Jun 30, 2026
8 checks passed
@tcconnally tcconnally deleted the fix/cli-db-propagation-313 branch June 30, 2026 16:51
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.

mimir --db <path> serve silently ignores --db flag; uses default path instead

1 participant