Skip to content

fix(orphan): prompt for confirmation when orphaning multiple branches (#733)#748

Open
mvanhorn wants to merge 1 commit into
aviator-co:masterfrom
mvanhorn:fix/733-av-orphan-from-trunk-confirm-prompt
Open

fix(orphan): prompt for confirmation when orphaning multiple branches (#733)#748
mvanhorn wants to merge 1 commit into
aviator-co:masterfrom
mvanhorn:fix/733-av-orphan-from-trunk-confirm-prompt

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

av orphan now prompts for confirmation when it would orphan more than one branch, mirroring the trunk-context prompt pattern from av sync. A --yes / -y flag skips the prompt for scripted use.

Why this matters

From #733:

Running av orphan from the trunk branch (e.g. master) drops every av-managed branch in the repo with no confirmation. First-time users have no way to predict this from the command name or current help text, and recovery means re-adopting each branch one-by-one.

av sync already has the right pattern at cmd/av/sync.go:169-183, where the trunk-from-trunk case prompts "You are on the trunk, do you want to sync all stacks?" This patch mirrors that for multi-branch / trunk-context orphan operations.

Changes

  • cmd/av/orphan.go: predicate + prompt + --yes flag, listing branches that will be orphaned
  • cmd/av/orphan_test.go: new unit tests for prompt-denied / prompt-accepted / single-branch / --yes paths
  • e2e_tests/orphan_test.go: updated to thread through the new prompt

Single-branch orphans from a feature branch are unchanged (no prompt). Pattern matches cmd/av/sync.go:169-183.

Fixes #733

@mvanhorn mvanhorn requested a review from a team as a code owner May 16, 2026 19:53
@aviator-app

aviator-app Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This pull request is currently open (not queued).

How to merge

To merge this PR, comment /aviator merge or add the mergequeue label.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@aviator-app

aviator-app Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

🔃 FlexReview Status

Common Owner: aviator-co/engineering (expert-load-balance assignment)
Owner and Assignment:

  • 🔒 aviator-co/engineering (expert-load-balance assignment)
    Owned Files
    • 🔒 e2e_tests/orphan_test.go
    • 🔒 cmd/av/orphan.go
    • 🔒 cmd/av/orphan_test.go

Review SLO: 7 business hours if PR size is <= 200 LOC for the first response.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an interactive confirmation prompt when orphaning multiple branches using the av orphan command, along with a --yes flag to bypass the prompt. The core logic has been refactored into collectBranchesToOrphan and orphanBranches functions, and a new test case verifies that denying the prompt prevents the orphaning process. A typo was identified in the success message where 'branched' should be 'branches'.

Comment thread cmd/av/orphan.go

fmt.Fprintf(
os.Stderr,
"These branched are orphaned: %s\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a typo in the output message: "branched" should be "branches".

Suggested change
"These branched are orphaned: %s\n",
"These branches are orphaned: %s\n",

@jainankit jainankit requested review from tulioz and removed request for jainankit May 29, 2026 20:26
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.

av orphan from trunk silently orphans every branch — should confirm

1 participant