fix(branch): reject extra args with --rename/-m and add cycle detection#718
fix(branch): reject extra args with --rename/-m and add cycle detection#718aviator-app[bot] merged 2 commits intomasterfrom
Conversation
…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.
Current Aviator status
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.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
There was a problem hiding this comment.
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.
Summary
Fixes #717
--rename/-mflag is used withav branch, preventing silent misuse where-m 'message'triggers a rename instead of branch creationSubsequentBranchesandSubsequentBranchesFilteredso a corrupted branch graph (e.g., self-referencing parent) logs a warning instead of crashing with a stack overflowTest plan
av branch foo -m 'bar'now returns a clear error instead of silently renamingav branch --rename new-namestill works correctlyav branch old:new -mstill works (colon syntax for rename)go test ./...)