← Back to Pull requests

Let partners apply to a different group in a program they've already joined #4618

Closed
unknown closed this pull request without merging on Oct 06, 2026 18:08 UTC
View on GitHub
unknown unknown commented on Oct 05, 2026 11:12 UTC
Author

Changes

  • Approved partners can apply to a different group in the same program.

  • Applications are blocked when the partner is already in that group, has a pending or non-approved enrollment, or already has a pending application.

  • Approving a group application marks it approved and moves the partner into the requested group (or the group picked in the review UI).

  • Rejecting a group application only rejects the application. The partner's enrollment, group, rewards, and discount are unchanged.

  • Single approve accepts an optional applicationId. Without it, the latest pending or rejected application is used, or only a pending one if the partner is already approved.

  • Bulk approve takes application IDs (max 100). New and previously rejected enrollments are approved in place. Already-approved partners are moved together after their applications are marked approved.

  • Bulk reject still takes partner IDs and rejects each partner's pending application. Approved, banned, deactivated, and archived enrollments are left as they are.

  • Auto-approve and auto-reject now run as jobs keyed by application ID (auto-approve-program-application-job, auto-reject-program-application-job). The old partner-keyed jobs only forward messages already in the queue.

  • Removed the unused /api/cron/partners/auto-approve and /api/cron/partners/auto-reject routes.
  • Notes

  • The applications table, review sheet, and pending-applications summary email now open an application with ?applicationId=. Old ?partnerId= links still work.

  • The group move runs after the approval transaction commits. If it fails, the application stays approved but the partner remains in their old group, and a retry won't pick it up. Fixing it requires moving the partner manually.

  • Group rejections send the standard rejection email, so an approved partner is told their application to the program wasn't approved. Email copy is not changed in this PR.
  • Known issue (follow-up PR)

  • The reapplication timeframe (Immediate / 30 days / Never) is not enforced when an approved partner's group application is rejected. The choice isn't saved and the apply check doesn't look at it, so the partner can apply to another group straight away. The fix is to store the timeframe on ProgramApplication and check the latest group rejection when the partner applies. Addressing in this PR
  • How to test

  • As an approved partner, apply to another group. A pending application is created and the partner stays in their current group. Applying to their own group, or applying again while a request is pending, is blocked.

  • Approve that application from the review sheet. The partner moves to the requested group (or the group you pick) and gets its rewards and discount.

  • Reject it instead. The application is rejected and the enrollment, group, rewards, and discount stay the same.

  • New partners: approve, reject (Immediate / 30 days / Never), bulk approve, and bulk reject behave as before.

  • Auto-approve and auto-reject still work for new partners and for group applications.

  • ?applicationId= links from the pending-applications summary email open the right application.

  • Creating a webhook offers program_application.created, and the event fires on submit.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Review links in the dashboard, email, and Slack now open a specific application, with navigation between applications and pages.
    Automatic approval and rejection now evaluate individual applications.
    Pending-application summaries link directly to applications for review.

    Improvements
    Bulk review reports how many applications were approved or rejected and how many were skipped.
    Application reviews better handle reapplications and existing enrollments.
    Rejection messages consistently show the standard 30-day reapplication period.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 510 lines (+382 / -128) across 6 files Reviewer: Joker666 Review duration: 1855m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.53) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 510 lines diff across 6 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.373
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #4618"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.6% (MEDIUM) · Higher = larger blast radius
    52.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.8% · Safe to merge
    20.8%
    Repository