Skip to content

fix(cli): reject --via-daemon with --db instead of silently mis-routing (KINTEG-012) - #134

Merged
joshuaboys merged 1 commit into
mainfrom
fix/kinteg-012-db-routing
Jul 12, 2026
Merged

joshuaboys merged 1 commit into
mainfrom
fix/kinteg-012-db-routing

Conversation

@joshuaboys

Copy link
Copy Markdown
Contributor

KINTEG-012 — Honor --db routing hint in daemon-backed commands

build_client was documented to honor --db as a socket-routing project hint but ignored it, always building a default client. So --via-daemon <cmd> --db <path> silently routed by process cwd — potentially reading/writing a different project DB than the invocation named.

Change

The daemon routes per project root (the x-kindling-project header the server hashes into a per-project DB), not per DB file — so pointing the daemon at an arbitrary --db file is architecturally impossible. Rather than silently mis-route, --via-daemon + an explicit --db is now rejected with a clear error for every daemon-backed verb (log, capsule open/close, search, pin, unpin, forget). Embedded mode still honors --db via resolve_db_path unchanged; export/import are in-process only and unaffected.

Validation

  • New via_daemon_with_db_is_rejected in tests/daemon.rs exercises each daemon-backed verb and asserts a non-zero exit naming --db/--via-daemon.
  • cargo fmt --all, cargo clippy -p eddacraft-kindling --all-targets -- -D warnings, cargo test -p eddacraft-kindling — green locally.

Closes KINTEG-012.

…ng (KINTEG-012)

build_client() was documented to honour --db as a socket-routing project
hint, but it ignored --db entirely and always routed by the current
working directory. The daemon routes per project ROOT (a string it hashes
into a per-project DB via project_db_path, carried in X-Kindling-Project),
not by an explicit DB FILE path, so --db cannot be honoured over the
daemon. The old behaviour silently read/wrote a DIFFERENT project's
database than the one --db named.

Thread the explicit --db value into build_client() and reject the
combination with a clear CliError telling the user to drop --db (use the
project default) or drop --via-daemon (embedded mode honours --db). When
no --db is given, behaviour is unchanged. The check lives at the single
point every daemon client is built, so it covers all daemon-backed verbs:
log, capsule open, capsule close, search, pin, unpin, forget.
(export/import are always in-process and are unaffected.)

Extend tests/daemon.rs with via_daemon_with_db_is_rejected, asserting a
non-zero exit and an error naming both flags for each daemon-backed verb.
@joshuaboys
joshuaboys merged commit 31474e1 into main Jul 12, 2026
26 checks passed
@joshuaboys
joshuaboys deleted the fix/kinteg-012-db-routing branch September 7, 2026 03:19
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