Repository navigation
fix(cli): reject --via-daemon with --db instead of silently mis-routing (KINTEG-012) - #134
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KINTEG-012 — Honor
--dbrouting hint in daemon-backed commandsbuild_clientwas documented to honor--dbas 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-projectheader the server hashes into a per-project DB), not per DB file — so pointing the daemon at an arbitrary--dbfile is architecturally impossible. Rather than silently mis-route,--via-daemon+ an explicit--dbis now rejected with a clear error for every daemon-backed verb (log, capsule open/close, search, pin, unpin, forget). Embedded mode still honors--dbviaresolve_db_pathunchanged;export/importare in-process only and unaffected.Validation
via_daemon_with_db_is_rejectedintests/daemon.rsexercises 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.