feat(review): interactive generate-tests checkbox in ORB's PR comment, maintainer-only - #4600
Conversation
…, maintainer-only (#4589) Adds a real, clickable "Generate an AI Playwright test for this PR" checkbox alongside the existing "Re-run Gittensory review" one -- same issue_comment.edited detection shell, same payload.sender re-authorization (a GitHub task-list checkbox can be toggled by anyone who can comment, so the checkbox itself proves nothing), hardcoded to maintainer-only regardless of what a repo's own .gittensory.yml configures for the text-command version. Unauthorized clicks are a silent no-op, mirroring the pre-existing retrigger checkbox's own denial behavior exactly. Also adds a "Test coverage" collapsible (after Signal definitions) with the missing-coverage detail and a pointer to the checkbox -- the checkbox itself has to render outside the alert blockquote (GitHub disables interactive checkboxes inside one), so the collapsible carries the context and the checkbox carries the action. Fixes #4589
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4600 +/- ##
=======================================
Coverage 94.12% 94.13%
=======================================
Files 430 430
Lines 38181 38239 +58
Branches 13922 13947 +25
=======================================
+ Hits 35939 35997 +58
Misses 1585 1585
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 07:33:45 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
…it-delivery test (#4627) Main-red: PR #4600 added this test before #4359 (merged same day) started verifying the live PR head/ref/sha inside commitE2eTestToPrBranch before ever writing. #4600 merged on top of #4359 without picking up the stub every sibling commit-delivery test already got in #4359's own diff, so this one test 404s on the live-PR fetch and silently declines the commit -- zero git-write calls, gitWrites stays empty. Adds the same GET /pulls/{n} stub the passing sibling tests already use.
Summary
Follow-up to #4583 (text-only inline CTA), upgrading it to a real, clickable checkbox per direct
maintainer request — mirroring both CodeRabbit's own "Generate unit tests" walkthrough checkbox and
gittensory's own pre-existing "Re-run Gittensory review" checkbox.
The security question this had to answer first: a GitHub markdown task-list checkbox can be
toggled by anyone who can comment on the PR — that's GitHub's own permission model, not
gittensory's. So the checkbox itself proves nothing about who clicked it; a raw checkbox would
actually be less safe than the existing text command, not more, since a contributor (or a miner, on
their own PR) could just check it themselves. The fix mirrors the pre-existing "Re-run Gittensory
review" checkbox's own already-proven pattern exactly:
PR_PANEL_GENERATE_TESTS_MARKER(a sibling ofPR_PANEL_RETRIGGER_MARKER) identifies the checkboxin the bot's own comment body.
maybeProcessPrPanelGenerateTests(a sibling ofmaybeProcessPrPanelRetrigger) listens forissue_comment.edited, confirms the marker is checked in the bot's own comment (not a spoofedcomment from someone else), resolves
payload.sender— who actually clicked, not who authored thecomment — and re-authorizes through the exact same
authorizePrActionActorpipeline every other@gittensoryaction command uses.commandAuthorization: PR_PANEL_GENERATE_TESTS_COMMAND_AUTHORIZATION(
["maintainer"]only) regardless of what a repo's own.gittensory.ymlmight configure for thetext-command version of
generate-tests(which can be widened to collaborator/confirmed_miner) — aone-click checkbox gets a hard floor that can't be misconfigured wider.
— audit-logged only (
github_app.e2e_tests_generation_denied), exactly matching the retriggercheckbox's own denial behavior (verified via its own test: zero GitHub writes beyond the permission
check).
runE2eTestGenerationAndDelivercore the@gittensory generate-testscommand (feat(commands): wire @gittensory generate-tests PR-comment command #4195) and themanifest_missing_testsauto-trigger (feat(review): auto-trigger E2E test generation on the manifest_missing_tests signal #4196)already use, with a new
trigger: "checkbox"value — behaves like"command"for delivery-modepurposes (NOT forced comment-only, since a checkbox click carries a real re-verified maintainer
invoker), kept as its own literal purely so audit metadata can distinguish "typed the command" from
"clicked the checkbox."
Where the checkbox lives: a new "Test coverage" collapsible (
buildPublicSafeCollapsiblesinsrc/signals/engine.ts), appended right after "Signal definitions," carrying the missing-coveragedetail and a pointer to the checkbox — reusing the already-computed
manifest_missing_testsfindingrather than a second detection pass, and only rendering (non-empty) when there's an actual gap and
e2eTestsis enabled for the repo, matching #4583's own "never mention a command that would bounce"principle. The checkbox itself renders as a top-level line outside the alert blockquote, alongside
the re-run checkbox — GitHub disables interactive task-list checkboxes inside a blockquote (the same
constraint the pre-existing re-run checkbox's own code comment documents), so it can't live inside the
collapsible with the context text; the collapsible points at it instead.
A real bug caught while writing the end-to-end test:
unified-comment-bridge.ts'sbuildUnifiedCommentBodyexplicitly allowlists which fields get forwarded into the renderer'scontext (
reRunLabelwas already there) — my newgenerateTestsLabelfield was silently droppeduntil I added it there too. Every pure-function unit test I wrote first (testing
renderUnifiedReviewComment/buildPublicSafeCollapsiblesdirectly) passed despite this, because noneof them went through the bridge layer — only the full webhook-integration test caught it. Now pinned
with a dedicated bridge-layer regression test.
Fixes #4589
Test plan
describe("PR-panel generate-tests checkbox (#4589)", ...)intest/unit/queue.test.ts(14tests): authorized happy path, unauthorized silent no-op (zero comment writes), bot-sender
guard, non-bot-comment guard, feature-disabled skip, wrong/unchecked-marker no-op, malformed/
sparse-payload skip, cached-PR-missing skip, agentPaused/agentDryRun skips, commit-delivery-mode
respected via the checkbox (unlike the auto-trigger), a
[bot]-suffixed non-Bot-typed sender(spoofing guard), and a full end-to-end render proving the checkbox + collapsible actually appear
in a real webhook-triggered comment (the test that caught the bridge-layer bug above)
test/unit/unified-comment-parity.test.ts: 3 new cases fortestCoverageBody's gating (gap +available → CTA; gap without availability → empty; availability without a gap → empty), plus the
pre-existing collapsible-title-array assertion updated for the new 4th entry
test/unit/unified-comment.test.ts: 3 new cases for the dual-checkbox composition (both present,generate-tests alone, generate-tests omitted) plus the outside-the-blockquote placement check
test/unit/unified-comment-bridge.test.ts: new case pinning the field-forwarding fixprocessors.ts,engine.ts,unified-comment.ts,unified-comment-bridge.ts): zero uncovered lines or branches in thisdiff
npx tsc --noEmitclean on this diff (the one remaining error is a pre-existing, unrelatedfailure in
test/unit/miner-attempt-log.test.ts, confirmed viagit diff origin/mainshowingzero changes to that file — another in-flight fix, not part of this PR)
queue.test.ts+unified-comment{,-bridge,-parity}.test.ts+public-safe-manifest-finding.test.tsorigin/mainat push time;git diff --checkclean