testbot: bigger PRs, Slack PR card, trimmed coverage report - #1290
Conversation
The review request posted no preview card. Two reasons: Slack unfurls links from a message's `text`, not from inside Block Kit blocks, and messages posted by a bot do not unfurl unless unfurl_links is set. The blocks array duplicated `text` verbatim, so dropping it costs nothing. With unfurling enabled the official GitHub Slack app -- already installed and unfurling PR links in #osmo-code-reviews -- renders the card under the message. No link_shared handler needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every recent testbot PR covered exactly one source file (#1273, #1278, #1280, #1283, #1288 — the second changed file is just the BUILD entry). Raise max_targets 1 -> 3. max_turns goes 200 -> 400 to match: the generator runs the full read/write/verify/coverage loop per target, and a single target has already hit the limit once (runs/26536045087, 101/100). max_uncovered stays at 500. It is a per-target cap, and recent targets carried 35-231 uncovered lines, so it is not the binding constraint -- max_targets is. Schedule and timeout are unchanged. Also refresh the README table, which still documented max_turns=100 and timeout_minutes=30 against the workflow's 200 and 60. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The coverage report listed every range the generator targeted, one bullet each with a ✅/❌ and a hit count. On #1253 that was 35 bullets, all ✅, under a summary line that already said 61/61. It pushed the useful content off-screen and nobody reads it. Keep the per-target summary line and name only the ranges still missing coverage, capped at MAX_REPORTED_RANGES with an "and N more" tail. The JSON sidecar still carries the full per-range detail for the generator's self-iteration loop, which is what actually consumes it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR increases testbot execution defaults, condenses Markdown coverage reports to uncovered ranges, and changes Slack review messages from Block Kit sections to plain text with link and media unfurling. ChangesTestbot updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1290 +/- ##
==========================================
+ Coverage 70.82% 70.95% +0.12%
==========================================
Files 239 239
Lines 28501 28501
Branches 4298 4298
==========================================
+ Hits 20186 20222 +36
+ Misses 7491 7456 -35
+ Partials 824 823 -1
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: 2
🤖 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 @.github/workflows/testbot.yaml:
- Line 214: Replace direct interpolation of inputs.max_targets and
inputs.max_uncovered in the workflow command with validated environment
variables; validate both values as permitted numeric inputs before use, then
reference the environment variables in the shell command to prevent command
injection while preserving their defaults.
In `@src/scripts/testbot/tests/test_verify_coverage.py`:
- Around line 359-372: Update test_still_uncovered_ranges_are_capped to assert
that “line 8” is present and “line 9” is absent in the rendered markdown,
verifying exactly MAX_REPORTED_RANGES entries are included while retaining the
existing overflow and boundary assertions.
🪄 Autofix
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: 55373ed9-efa8-4d2f-a05f-f7c4b0890985
📒 Files selected for processing (6)
.github/workflows/testbot.yamlsrc/scripts/testbot/README.mdsrc/scripts/testbot/create_pr.pysrc/scripts/testbot/tests/test_create_pr.pysrc/scripts/testbot/tests/test_verify_coverage.pysrc/scripts/testbot/verify_coverage.py
* testbot: trim the coverage section create_pr.py actually renders #1290 trimmed verify_coverage.render_markdown(), but that is not what builds the PR body. The workflow writes coverage_report.md and only cats it into the run log; the PR body comes from create_pr.py's _build_coverage_section(), a second renderer of the same section that reads the JSON sidecar. So #1291 still shipped ~300 lines of per-range bullets. Apply the same trim there: keep the per-target summary line, name only the ranges still missing coverage, cap at MAX_REPORTED_RANGES with an "and N more" tail. The constant is imported from verify_coverage rather than redeclared, matching the existing guardrails import. On a #1291-shaped report the section goes from 308 lines to 9. * testbot: render the coverage section in one place _build_coverage_section re-implemented what verify_coverage already renders, so trimming one left the other unchanged. Replace it with a call: parse the JSON back into TargetReports, then render_markdown. create_pr.py loses 59 lines and there is one renderer to change. * testbot: narrow the JSON coercion helper for mypy int() has no overload for a bare object, so the fail-soft helper failed CI's mypy aspect. Narrow to (int, float, str) before converting. Caught by `bazel test -- //src/scripts/testbot/...`; the package-scoped `:all` pattern used earlier does not run mypy on the library target.
Description
Three testbot improvements.
1. Target 3 files per run instead of 1
max_targets1 → 3, on both the dispatch input default and the schedule-path fallback. Nothing hardcodes the count:SELECT_TARGETS_PROMPT.mdrenderspick at most {max_targets}and the generator prompt already loops per target.max_turns200 → 400. The generator runs the full read/write/verify/coverage loop per target, and a single target has already exhausted the limit once (runs/26536045087, 101/100, after context auto-compaction).max_uncoveredstays 500. It is a per-target cap (_cap_rangesruns inside the per-file loop,remainingreset per file), and recent targets carried only 35–231 uncovered lines — so it is not the binding constraint. The per-PR ceiling still rises 500 → 1500 as a consequence of targeting 3 files.max_turns=100/timeout_minutes=30against the workflow's actual 200 / 60.Schedule and
timeout_minutesdeliberately unchanged. Note the workflow is hourly withconcurrency.cancel-in-progress: true, so a run is cancelled when the next hourly trigger fires — the effective ceiling is ~60 min regardless oftimeout_minutes. If 3-target runs start getting cancelled mid-generation, the fix is slowing the cron rather than raising the timeout.2. Let Slack unfurl the PR link into a GitHub card
The review request posted as plain text with no preview card.
Two things in the payload prevented it: Slack unfurls links from a message's
text, not from links inside Block Kitblocks; and bot-posted messages do not unfurl unlessunfurl_linksis set. Theblocksarray duplicatedtextverbatim, so dropping it changes nothing about how the message reads.3. Drop the per-range checklist from the PR body
The coverage report listed every targeted range as its own bullet with a ✅/❌ and hit count — 35 bullets on #1253, all ✅, under a summary line that already said 61/61.
Now: the per-target summary line, plus only the ranges still missing coverage, capped at
MAX_REPORTED_RANGESwith an "and N more" tail. The JSON sidecar keeps full per-range detail for the generator's self-iteration loop, which is what actually consumes it.Verification
bazel test //src/scripts/testbot:all //src/scripts/testbot/tests:all— 19 targets pass, including every-pylintsibling. Workflow YAML parses with the expected defaults. Added tests covering the Slack payload's unfurl flags and the three report-rendering cases (fully covered, partially covered, capped overflow).The Slack card itself can only be confirmed once this runs with the testbot bot token, since posting as a user unfurls regardless and would not exercise the bot path.
Issue - None
Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation