* wy-1rrwt8: add 'bd kv list --prefix' — SQL-side key-prefix filter for scoped kv reads
Downstream mail transports read the whole kv store (3.4MB, ~1988 mail.*
envelopes on the wyvern fleet) for every inbox render. This adds a --prefix
flag to 'bd kv list' that pushes the filter into SQL on stores that support
it, via an optional domain.ConfigPrefixReader interface discovered by type
assertion — no existing storage interface or test double changes shape, and
every path falls back to GetAllConfig plus in-process filtering.
- issueops: ConfigPrefixLikeQuery + ConfigPrefixPattern (LIKE with explicit
ESCAPE '!' — the engine does not honor backslash as a default escape) and
GetConfigByPrefixInTx.
- domain: ConfigPrefixReader optional interface; use-case impl delegates to
the repo fast path or filters GetAllConfig.
- domain/db, dolt, embeddeddolt: SQL-side GetConfigByPrefix.
- telemetry: instrumented passthrough preserving the capability.
- cmd/bd: --prefix on kv list, both classic and proxied-server paths;
kvPairsWithPrefix re-checks on every path so output is identical whichever
path served the read.
* build(bazel): list the PR's new test files in go_test srcs (make bazel-sync)
kv_prefix_test.go (cmd/bd) and config_prefix_test.go
(internal/storage/issueops) are new, untagged test files. Both packages'
BUILD.bazel files were generated on main after the PR's commit was written,
and the rebase onto main did not re-run gazelle, so neither go_test listed
them: bd_test and issueops_test reported PASSED with "no tests to run" for
TestKVPairsWithPrefix and TestConfigPrefixPattern, and bazel.yml's "BUILD
files in sync" step fails on that drift in the required bazel-test lane.
Generated by `make bazel-sync`, which rewrote only these two rows. Both files
import only the standard library, so no deps change.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(kv): engage the --prefix SQL fast path through the decorator chain
Maintainer review fixup for PR #6380.
The SQL push-down this PR exists to deliver was unreachable on bd's default
direct/embedded path. `bd kv list --prefix` asserted `store.(configPrefixReader)`
on the outermost decorator, but wireStorageDecorators unconditionally interposes
externaldeps.Store and (hooks on, the default) HookFiringStore, both of which
embed the storage.DoltStorage *interface* — and GetConfigByPrefix is
deliberately not declared there. The assertion could never succeed, so every
direct-mode prefix read silently took the GetAllConfig full-table fallback.
Output was identical, so nothing errored, logged, or failed a test, while the
flag help and command Long text asserted the opposite.
This carries the prior review lineage's fixup 9ca3caeb9, stranded when the PR
was relaunched, plus what this review iteration found missing from it:
- cmd/bd: discover the capability through storage.UnwrapStore, the repo's
documented idiom for optional-interface assertions (~50 existing call
sites), in configPrefixReaderFor. The direct-mode read itself is extracted
as readKVListConfig so the regression test drives the command's own read:
with only the helper under test, reverting the call site to the bare
`store.(configPrefixReader)` assertion still left the whole suite green.
- cmd/bd: chain-level regression test over wireStorageDecorators covering all
four telemetry/hooks configurations, plus the negative case proving a store
without the capability is still reported incapable. The stub counts full
reads, so a fallback fails the test even though it returns the same rows.
Verified non-vacuous: a bare assertion in the helper or in
readKVListConfig, a disabled fast path, a dropped kv. prefix, or a method
added only to the mirror interface each fail all four configurations; a
peel that stops at InstrumentedStorage fails the telemetry-on negative case.
- dolt, embeddeddolt, telemetry: compile-time pins against
domain.ConfigPrefixReader, so method-set drift on any implementation is a
build error instead of a silent reversion to full scans. The cmd/bd
mirror's own pin checks one direction only (a method added just to the
mirror still compiles); its comment now says so and names the test that
covers the other direction.
- domain/db: delegate GetConfigByPrefix to issueops.GetConfigByPrefixInTx like
the sibling stores, instead of a second scan loop over the shared query
constant.
- telemetry: record the deliberate trade — peel-to-raw keeps the standard
idiom and leaves the instrumented forwarder off the cmd/bd path.
- bazel: add //internal/storage/domain to the telemetry_test deps (make
bazel-sync); without it the telemetry pin's import fails strict deps.
Co-authored-by: dog <dog@ghosttrack.com>
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: dog <dog@ghosttrack.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>