Skip to content

fix(branch): reject extra args with --rename/-m and add cycle detection#718

Merged
aviator-app[bot] merged 2 commits intomasterfrom
fix-branch-self-ref-717
Apr 16, 2026
Merged

fix(branch): reject extra args with --rename/-m and add cycle detection#718
aviator-app[bot] merged 2 commits intomasterfrom
fix-branch-self-ref-717

Conversation

@jainankit
Copy link
Copy Markdown
Contributor

Summary

Fixes #717

  • Reject unexpected extra positional arguments when --rename/-m flag is used with av branch, preventing silent misuse where -m 'message' triggers a rename instead of branch creation
  • Add visited-set cycle detection to SubsequentBranches and SubsequentBranchesFiltered so a corrupted branch graph (e.g., self-referencing parent) logs a warning instead of crashing with a stack overflow

Test plan

  • av branch foo -m 'bar' now returns a clear error instead of silently renaming
  • av branch --rename new-name still works correctly
  • av branch old:new -m still works (colon syntax for rename)
  • Existing tests pass (go test ./...)

…on (#717)

When users run `av branch <name> -m '<message>'`, the -m flag (which is
--rename, not a message flag) silently triggers a branch rename instead
of creation, which can produce self-referencing parent metadata in fresh
clones. Reject unexpected extra arguments with --rename/-m with a clear
error guiding the user.

Also add visited-set cycle detection to SubsequentBranches and
SubsequentBranchesFiltered so that a corrupted branch graph logs a
warning instead of crashing with a stack overflow.
@jainankit jainankit requested a review from a team as a code owner April 15, 2026 02:56
@aviator-app
Copy link
Copy Markdown
Contributor

aviator-app Bot commented Apr 15, 2026

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 PR was merged using Aviator.


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
Copy link
Copy Markdown
Contributor

aviator-app Bot commented Apr 15, 2026

✅ FlexReview Status

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

  • aviator-co/engineering (expert-load-balance assignment)
    Owned Files
    • 🔒 cmd/av/branch.go
    • 🔒 internal/meta/branch.go

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

@aviator-app aviator-app Bot requested a review from tulioz April 15, 2026 02:56
Copy link
Copy Markdown

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

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 argument validation for the branch rename command and implements cycle detection in branch graph traversal functions to prevent infinite recursion. A logic error was found in the rename validation where extra arguments were still permitted under certain conditions; it is recommended to reject all additional arguments regardless of the branch naming syntax.

Comment thread cmd/av/branch.go Outdated
@jainankit jainankit marked this pull request as draft April 15, 2026 17:29
@jainankit jainankit marked this pull request as ready for review April 15, 2026 17:29
@aviator-app aviator-app Bot merged commit 0bf7c8f into master Apr 16, 2026
5 checks passed
@aviator-app aviator-app Bot deleted the fix-branch-self-ref-717 branch April 16, 2026 21:36
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 branch writes self-referencing parent in fresh clones (causes stack overflow)

2 participants