testbot: require go_test BUILD targets for new Go test files#959
testbot: require go_test BUILD targets for new Go test files#959
Conversation
PR #956 (testbot-generated) added src/runtime/pkg/common/common_test.go without adding a corresponding go_test rule to the package's BUILD file. The file ended up invisible to Bazel — `bazel test //src/runtime/pkg/common:all` returns "No test targets were found", and `bazel coverage //...` (the job that feeds Codecov) skips it entirely. Net effect: the testbot run that picked common.go because of "0% coverage" closes the issue with a PR that ships zero new coverage. Update both prompts so the next run gets it right: - TESTBOT_PROMPT.md step 6: generalized from "Python only — BUILD file" to cover Go too. Includes the canonical pattern (go_library + go_test with embed = [":<pkg>"]) verified against runtime/pkg/data/BUILD, and a check-it-worked instruction (re-run bazel test, look for the "No test targets were found" error). - TESTBOT_RULES.md verification step: explicitly call out the "No test targets were found" failure mode pointing at BUILD wiring, and add a "BUILD wiring (Python + Go)" subsection that explains why a go_library-only BUILD silently drops adjacent _test.go files. - TESTBOT_PROMPT.md guardrails: include go_test alongside py_test in the allowed BUILD edits. This is a documentation-only change to the prompt files; no code paths or tests change. The 14 testbot bazel tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR augments testbot documentation with cross-language Bazel BUILD wiring guidance for Python and Go tests, clarifies Bazel test failure handling, and tightens guardrails to permit edits only to test files and BUILD entries (no source/config changes). ChangesTestbot BUILD wiring & Guardrails
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #959 +/- ##
=======================================
Coverage 42.93% 42.93%
=======================================
Files 218 218
Lines 28458 28458
Branches 4255 4255
=======================================
Hits 12218 12218
Misses 15599 15599
Partials 641 641
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/scripts/testbot/TESTBOT_PROMPT.md`:
- Line 42: The fenced code block containing the Bazel snippet starting with
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") is missing a
language tag and triggers markdownlint MD040; update the opening fence from ```
to ```bzl so the block is fenced as ```bzl ... ``` to properly label the code as
Starlark/Bazel.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f9ac1f4d-2f3d-4e14-a719-e4e22efeb778
📒 Files selected for processing (2)
src/scripts/testbot/TESTBOT_PROMPT.mdsrc/scripts/testbot/TESTBOT_RULES.md
…D040 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
PR #956 (testbot-generated) added
src/runtime/pkg/common/common_test.gobut didn't add a correspondinggo_testrule to the package'sBUILDfile. The test file is invisible to Bazel:Net effect: a testbot run that picked
common.gobecause of "0% coverage" closed the gap with a PR that ships zero new measured coverage —bazel coverage //...won't run a test target it doesn't know about, and Codecov never sees the result.This PR teaches the testbot to wire up Go tests properly going forward:
TESTBOT_PROMPT.mdstep 6: generalized from "Python only" to cover Go. Includes the canonical pattern (go_library+go_testwithembed = [":<pkg>"]) verified againstsrc/runtime/pkg/data/BUILD, and a "check it worked" instruction — re-runbazel testand watch forNo test targets were found.TESTBOT_RULES.mdverification step: explicitly call out the "No test targets were found" failure mode and point at BUILD wiring. New "BUILD wiring (Python + Go)" subsection explains why ago_library-only BUILD silently drops adjacent_test.gofiles.TESTBOT_PROMPT.mdguardrails: includego_testalongsidepy_testin the allowed BUILD edits.Documentation-only change to the prompt files. No code paths or tests change.
Issue - None
Files tested
Checklist
Test plan
bazel test //src/scripts/testbot/tests/...(still green)_test.goAND ago_testBUILD entry, thenbazel coverage //...actually shows non-zero coverage on the targeted file.Follow-up
PR #956 itself still needs the
go_testrule appended tosrc/runtime/pkg/common/BUILDto take effect. I'd suggest either pushing the fix to that branch directly or asking testbot to follow up via/testbot add a go_test rule to BUILD for common_test.go.Summary by CodeRabbit