Skip to content

fix: prevent orphan transfers on key fetch and passphrase failures#9

Closed
Copilot wants to merge 2 commits intotransfer_with_recipientsfrom
copilot/sub-pr-7
Closed

fix: prevent orphan transfers on key fetch and passphrase failures#9
Copilot wants to merge 2 commits intotransfer_with_recipientsfrom
copilot/sub-pr-7

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

Two failure paths in transfer create could leave an incomplete, inaccessible transfer on the server with no cleanup.

Changes

  • Sequential key fetch before share creation: GetActiveKey is now called before CreateShare. The previous parallel goroutine pattern meant a share could be created on the server even if the key fetch subsequently failed, with no way to clean it up.

  • Disable share on passphrase failure: After share creation, if reading the passphrase from the terminal fails or an empty passphrase is submitted non-interactively, DisableTransfer is now called before returning the error.

// GetActiveKey called first — no share created if this fails
userKey, err := client.GetActiveKey(ctx)
...
share, err := client.CreateShare(ctx, expire, titlePtr, true, toEmails)
...
// Passphrase read failure → clean up the orphan
if err != nil {
    _ = client.DisableTransfer(ctx, share.ID)
    return fmt.Errorf("reading passphrase: %w", err)
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@HanXHX HanXHX marked this pull request as ready for review February 25, 2026 10:27
Co-authored-by: HanXHX <5664215+HanXHX@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for recipient email addresses in transfers fix: prevent orphan transfers on key fetch and passphrase failures Feb 25, 2026
Copilot AI requested a review from HanXHX February 25, 2026 10:30
@HanXHX HanXHX closed this Feb 25, 2026
@HanXHX HanXHX deleted the copilot/sub-pr-7 branch February 25, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants