Skip to content

Implement APR repo-transfer-to-customer initiation via GitHub's transfer API #7638

Description

@JSONbored

Context

#7590 decided APR customers get an optional, explicit transfer-to-their-own-account flow using GitHub's standard repository transfer mechanism, rather than owning the repo from day one. No code exists yet for this.

Requirements

Add a function that initiates a GitHub repository transfer from the loopover-controlled org to a target GitHub account, using the GitHub REST API's "Transfer a repository" endpoint (POST /repos/{owner}/{repo}/transfer) with the target account's login as new_owner. GitHub's transfer flow requires the recipient to accept via a confirmation email within a time window and does not complete synchronously — this function's job is to initiate the transfer and return whatever status GitHub's API response provides; it must not assume or report the transfer as complete just because the API call succeeded.

⚠️ This issue does not cover: detecting when a pending transfer is accepted/expires (separate follow-on concern, not scoped here), any UI for the customer to request a transfer, or anything about when a transfer should be offered (a product/UX question, not this issue's job). Deliverable is exactly: given a repo and a target account login, call the transfer endpoint and return its response, tested.

Deliverables

  • A function that calls the transfer endpoint given a repo full name and a target account login, using the App's installation token (same token source as the repo-creation issue).
  • Unit tests covering: a successful transfer-initiation response, and at least one realistic error case (e.g. the target account doesn't exist, or the caller lacks admin access to the repo) handled without an unhandled exception.
  • A short doc comment on the function stating explicitly that a successful API response means "transfer initiated," not "transfer complete" — this distinction matters for anything that later builds on top of this function.

Test Coverage Requirements

Standard 99%+ Codecov patch target for src/**; mock the GitHub API in tests, no live transfer calls.

Expected Outcome

A tested, reusable way to initiate a repo transfer to a customer's account, correctly modeling that GitHub transfers are asynchronous and acceptance-gated rather than instantaneous.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions