← Back to Pull requests

Add scopes for partner program resources #4652

Closed
unknown closed this pull request without merging on Oct 13, 2026 18:10 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 15:59 UTC
Author

Partner program endpoints now require API scopes, so access can be limited to partners, applications, customers, discount codes, commissions, bounties, and payouts.

Key Changes

  • Adds read and write scopes for those resources. Read is every workspace role. Write is owner and member and includes read. Payouts are read-only. apis.read and apis.all include them.

  • groups.read and groups.write are now OAuth scopes and show in the API key picker.

  • List and fetch routes require the matching read scope. Create, update, and other writes require the matching write scope.

  • GET /api/partners/links requires links.read, so viewer and billing can list partner links. POST requires links.write.

  • Before 2026-10-09, or with no date, a key or installation keeps the new permissions, except groups, within the workspace role. OAuth uses the installation date. Cached restricted tokens missing that date are reloaded.
  • How to Test

  • On a Business workspace, partners.read can GET /api/partners. Create, ban, and deactivate return 403. Same for customers, discount codes, commissions (including GET /api/commissions/:id), bounty submissions, and payout lists.

  • A key from before 2026-10-09 can list partners without the new scopes. A key created on or after that date gets 403. As a viewer, GET /api/partners/links succeeds and POST returns 403.
  • Deploy

  • Set the legacy scope cutoff (2026-10-09) to the merge date before merging.
  • Notes

  • GET /api/partners/:partnerId, bounty create and update, and exports still have no scope check.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added separate read and write permissions for partners, partner links, program applications, customers, discount codes, commissions, and bounties, plus read access for payouts.
    Updated access checks across these features to use permissions while retaining existing plan requirements. Read permissions are available to additional workspace roles; write permissions remain limited to authorized roles.
    Eligible older tokens retain applicable access under the updated permission system.
    Improvements
    Made the token-permissions list easier to navigate with a scrollable layout and more compact rows.
    * Permission guidance is now shown when refreshing bounty statistics is unavailable.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 310 lines (+232 / -78) across 3 files Reviewer: Joker666 Review duration: 5890m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 310 lines diff across 3 files
    0.40
    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.343
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4652"
    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: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    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: 15.9% · Safe to merge
    15.9%
    Repository