feat(daemon): kb CLI switchover to daemon-aware store selection (phase 5)#27
Conversation
…e 5) TDD red→green. The operator kb CLI now routes through the daemon when its socket is present (contract §2.4: when the daemon runs, the operator CLI MUST use RpcKnowledgeStore, else two writers race ~/.mykb), and keeps the LocalMykbStore direct-disk path when it is not. - withStore() and the checkpoint path now use selectKnowledgeStore() instead of MykbStore.open(); the §2.4 policy is encoded once in the selector and reused by both the extension (P4) and the CLI (P5). - DIP: cli.ts retyped from concrete MykbStore to the KnowledgeStore interface. Audit: every store.* call in cli.ts is an interface method; the only non-interface call was close() (a lifecycle concern) — moved onto SelectedStore.close() so callers stay interface-pure. - store-selection.ts: SelectedStore gains close() owning the underlying resource (local DB handle / RPC worker). - +1 scenario test (cli-over-daemon): the real kb CLI binary, with a daemon socket present, writes a fact that lands in the JSONL the SEPARATE daemon process owns — the CLI never touches the file, only the socket. Read-path verb round-trips too. Full suite 646/646 across 2 runs; every existing CLI subcommand test green through the selector (LSP audit evidence). tsc + lint clean.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Phase 5 of the v2 privileged-write-channel (issue #1). The operator
kbCLI now routes through the daemon when its socket is present, and keeps
the direct-disk local path otherwise. Builds on merged Phases 1–4.
What landed (TDD red→green)
withStore()+ the checkpoint path useselectKnowledgeStore()inplace of
MykbStore.open(). Contract §2.4 — "when the daemon isrunning the operator CLI MUST use RpcKnowledgeStore" (else two writers
race
~/.mykb) — is encoded once in the selector, reused by boththe extension (P4) and the CLI (P5). No daemon ⇒ LocalMykbStore
direct-disk operator path preserved.
cli.tsretyped from concreteMykbStoreto theKnowledgeStoreinterface. Audit: everystore.*call incli.tsis an interface method; the sole non-interface call wasclose()(lifecycle) — moved ontoSelectedStore.close()so callersstay interface-pure.
kbCLI binary, with a daemon socketpresent, writes a fact that lands in the JSONL the separate daemon
process owns (CLI never touches the file — only the socket); read
verb round-trips too.
Evidence
Full suite 646/646 across 2 runs; every existing CLI subcommand test
green through the selector (LSP audit). tsc + lint clean. 229/229
daemon+cli post-rebase.
Remaining: P6 container topology (RO brain mount, socket bind-mount,
systemd unit, SO_PEERCRED resolver), P7 regression closure (flip
bash-bypass-known-gap🐛→✅ — the acceptance criterion for #1).