with one click
improve-coverage
// Improve code coverage for a Bazel C++ test target or source file
// Improve code coverage for a Bazel C++ test target or source file
Use when adding or modifying a Redpanda admin v2 ConnectRPC endpoint — authoring the protobuf under proto/redpanda/core/admin/v2/, wiring it into the Bazel build, implementing the C++ service handler under src/v/redpanda/admin/services/, registering it on the admin server, and regenerating Python bindings for ducktape integration tests. Covers both new RPCs on an existing service and brand-new services.
"Create a new backport branch with prefix `ai-backport-` by cherry-picking all commits from a GitHub PR onto a target release branch or commit. Use when the user wants to backport a PR, create a backport branch, cherry-pick PR commits to a release branch, or mentions backporting changes from dev/main to a version branch (e.g. v25.1.x, v25.2.x). Requires two arguments: TARGET (the release branch or commit hash to backport onto) and PR_NUM (the GitHub PR number to backport)."
| name | improve-coverage |
| description | Improve code coverage for a Bazel C++ test target or source file |
| user-invocable | true |
Improve test coverage for a Bazel C++ test target or source file path.
Bazel test target (starts with //, e.g. //src/v/bytes/tests:iobuf_test):
use it directly.
Source file path (e.g. src/v/bytes/iobuf.cc): find the test target:
bazel query "kind('.*_test', rdeps(//src/v/..., //$(dirname $FILE):$(basename $FILE .cc), 1))" 2>/dev/null
If multiple targets match, pick the one in the closest tests/ directory.
If none match, tell the user and stop.
Run coverage and read the LLM report:
tools/run-cov <target> -r llm
Note the total line coverage percentage — this is the baseline to beat.
Read the report and identify:
Read the source files named in the report. Focus on:
Key codebase patterns:
redpanda_cc_gtest targets use GTest (TEST(), TEST_F()).
redpanda_cc_btest targets use Seastar Boost test
(SEASTAR_THREAD_TEST_CASE). Match whichever the test file uses.ss::future<> coroutines — test with
SEASTAR_THREAD_TEST_CASE or the Seastar GTest runner.ss namespace prefix for Seastar types.EXPECT_* for most checks, ASSERT_* only when continuing would crash.Prioritize by impact:
Rules:
bazel build <target>
Fix compilation errors before proceeding.
Re-run coverage:
tools/run-cov <target> -r llm
Compare to the baseline. Report:
Coverage: X.Y% → A.B% (+N.N%)
New lines covered: <count>
If coverage did not improve, investigate:
Report: