feat: reopen PR + notify contributor on request decision - #74
Conversation
When Tripwire auto-closes a PR/issue, the appeal link now carries the content ref (&ref=&ct=). On an unblock request decision, decide() reopens the exact PR/issue on approval and posts a GitHub comment notifying the contributor of the outcome (approve and deny), alongside the existing in-app request_decided event. - schema: contributor_requests gains githubRef + contentType - pr-comment: buildAppealUrl carries ref; renderDecisionComment for notices - github: reopenPullRequest / reopenIssue helpers - decide: best-effort reopen+notify outside the txn, errors isolated
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds support for reopening previously closed GitHub pull requests or issues when an "unblock" contributor request is approved. It introduces new database columns (githubRef, contentType) on contributorRequests, new GitHub API helpers (reopenPullRequest, reopenIssue), extended comment-rendering functions (buildAppealUrl, renderDecisionComment) with corresponding tests, TRPC router changes to persist appeal metadata and trigger a best-effort GitHub notification/reopen after a decision, and frontend route changes to carry ref/contentType query parameters through the submission flow. A standalone diagnostic E2E test file was also added. ChangesCohort: Unblock appeal reopen feature
Sequence Diagram(s)Included within the hidden review stack artifact. Compact metadata
Poem 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
React Doctor query-destructure-result: read only { data } from the
whoami/vouch useQuery calls instead of holding the whole result.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/web/src/_hookdiag.e2e.test.ts (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFile naming doesn't follow kebab-case convention.
_hookdiag.e2e.test.tsuses a leading underscore and lacks a dash between words. As per coding guidelines, "Files: kebab-case (rule-card-grid.tsx)". Rename to something likehook-diag.e2e.test.ts.🤖 Prompt for 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. In `@apps/web/src/_hookdiag.e2e.test.ts` at line 1, Rename the test file to follow the project’s kebab-case file naming convention; the current `_hookdiag.e2e.test.ts` name uses a leading underscore and missing word separators. Update the filename to a kebab-case variant such as the one used by the hook diagnostics e2e test, and make sure any references to the file name in the test setup or imports are updated accordingly.Source: Coding guidelines
🤖 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 `@apps/web/src/_hookdiag.e2e.test.ts`:
- Around line 3-15: The hook config test currently only logs results, so it can
never fail and provides no regression coverage. Update the
`_hookdiag.e2e.test.ts` test body to include real assertions on the `fetch`
responses and parsed app data (using the existing `createAppJwt`, `fetch`, and
`test.runIf` flow), or move this diagnostic logic out of the test suite into a
non-test script if it is meant only for manual debugging.
In `@apps/web/src/integrations/trpc/routers/requests.ts`:
- Around line 361-389: The reopen audit event in notifyDecisionOnGithub is only
emitted after addComment succeeds, so a failed comment can drop the
github_pr_reopened/github_issue_reopened log even when the reopen itself worked.
Move the logEvent call to run immediately after the successful reopen path,
before the best-effort GitHub comment send, and keep addComment separate so
comment failures do not block the audit trail.
In `@packages/db/src/schema/requests.ts`:
- Around line 38-41: The schema in requests.ts adds githubRef and contentType,
but there is no corresponding tracked Drizzle migration. Add a new migration
that updates the underlying requests table to include github_ref and
content_type, and make sure the migration is recorded in the same migration flow
used for other schema changes so the DB matches the requests schema definition.
---
Nitpick comments:
In `@apps/web/src/_hookdiag.e2e.test.ts`:
- Line 1: Rename the test file to follow the project’s kebab-case file naming
convention; the current `_hookdiag.e2e.test.ts` name uses a leading underscore
and missing word separators. Update the filename to a kebab-case variant such as
the one used by the hook diagnostics e2e test, and make sure any references to
the file name in the test setup or imports are updated accordingly.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 302c1464-7e54-4084-aa45-0e9e013cefd2
📒 Files selected for processing (9)
apps/web/src/_hookdiag.e2e.test.tsapps/web/src/integrations/trpc/routers/requests.tsapps/web/src/routes/request.$owner.$repo.tsxpackages/core/src/filter-pipeline.tspackages/core/src/index.tspackages/core/src/pr-comment.test.tspackages/core/src/pr-comment.tspackages/db/src/schema/requests.tspackages/github/src/app.ts
- remove apps/web/src/_hookdiag.e2e.test.ts (throwaway diagnostic that hit live GitHub with hardcoded IDs; swept in by git add -A, not real coverage) - notifyDecisionOnGithub: emit the github_pr_reopened/github_issue_reopened audit event immediately after a successful reopen, before the best-effort comment, so a comment failure can't drop the audit trail - react-doctor.yml: fetch-depth: 0 so it diffs against the merge base and only reports issues this PR introduces
What
When Tripwire auto-closes a PR (or issue) and the contributor appeals via Request a review, an approving maintainer now:
request_decidedevent.Previously
decide()only mutated the blacklist/whitelist and told the contributor nothing.How
&ref=<n>&ct=<pull_request|issue>; the request form captures it;submitstores it oncontributor_requests(githubRef+contentType). Backward compatible — legacy links without a ref just skip auto-reopen.packages/github: newreopenPullRequest/reopenIssuehelpers.packages/core/pr-comment:buildAppealUrlref params +renderDecisionComment(bot-branded, respects prefs; handles the reopen-failed edge, e.g. deleted head branch).decide(): best-effort reopen + notify runs outside the DB transaction with errors isolated — a GitHub hiccup never fails the committed decision. Logsgithub_pr_reopened/github_issue_reopenedon reopen.Covers both PRs and issues.
Testing
pr-commenttests (appeal-link ref,renderDecisionCommentapprove/deny/reopen-failed/bot-name). Full suite green (core, web 110, research 37, tools 4).renderBlockedComment→closePullRequest→ realrequests.decidetRPC procedure againstg-r-i-m/playground. Verified approve → PR reopened + approval comment + blacklist lifted + events logged; deny → PR stayed closed + denial comment. All seeded state cleaned up.Migration
Adds two nullable columns to
contributor_requests(github_ref,content_type). Applied viapnpm db:push.Summary by CodeRabbit
New Features
Bug Fixes