Skip to content

fix(issue): accept 1 positional + --into as valid merge (CLI-1AE)#920

Merged
BYK merged 1 commit intomainfrom
fix/cli-1ae-merge-into-single-positional
May 6, 2026
Merged

fix(issue): accept 1 positional + --into as valid merge (CLI-1AE)#920
BYK merged 1 commit intomainfrom
fix/cli-1ae-merge-into-single-positional

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented May 5, 2026

Summary

  • Fixes CLI-1AE: sentry issue merge A --into B raised a spurious ValidationError: needs at least 2 issue IDs (got 1) even though two distinct issues were provided
  • When exactly 1 positional arg is given alongside --into, the --into value is now treated as the second issue in the merge set
  • Improves the 1-positional-no---into error hint to show the --into form as an alternative

Root Cause

The arity check in func() counted only positional args (args.length < 2). When a user ran:

sentry issue merge THEARTHIQDAILY-PROD-D --into THEARTHIQDAILY-PROD-C

args = ["THEARTHIQDAILY-PROD-D"] and flags.into = "THEARTHIQDAILY-PROD-C", so args.length === 1 triggered the error despite two distinct issues being specified.

Fix

Before validation, build effectiveArgs: if args.length === 1 and --into is set, append the --into value. The rest of the pipeline is unchanged — resolveAllIssues resolves all entries in parallel, orderForMerge still places the --into target at the front, and the existing dedupe check handles merge A --into A.

Tests

7 new test cases added to test/commands/issue/merge.func.test.ts:

  1. 0 positionals, no --into → arity error (existing test split/clarified)
  2. 1 positional, no --into → arity error with --into hint
  3. 0 positionals + --into → still arity error (effectiveArgs.length = 1)
  4. 1 positional + --into → valid merge, --into target becomes preferred parent (the fix)
  5. 1 positional + --into same issue → dedupe guard ("at least 2 distinct issues")

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-920/

Built to branch gh-pages at 2026-05-06 08:27 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Codecov Results 📊

6686 passed | Total: 6686 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +4
Passed Tests 📈 +4
Failed Tests
Skipped Tests

All tests are passing successfully.

❌ Patch coverage is 64.29%. Project has 13518 uncovered lines.
✅ Project coverage is 76.68%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/commands/issue/merge.ts 64.29% ⚠️ 5 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    76.67%    76.68%    +0.01%
==========================================
  Files          303       303         —
  Lines        57977     57979        +2
  Branches         0         0         —
==========================================
+ Hits         44454     44461        +7
- Misses       13523     13518        -5
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK force-pushed the fix/cli-1ae-merge-into-single-positional branch from 01de1a9 to df2b0ab Compare May 5, 2026 16:27
Users running `sentry issue merge A --into B` got a spurious
ValidationError because the arity check only counted positional args.
The --into flag clearly designates a second issue to merge, so 1
positional + --into should be accepted as a valid 2-issue merge.

When args.length === 1 and --into is set, append the --into value to
effectiveArgs before validation. resolveAllIssues resolves both in
parallel, orderForMerge still handles sorting the --into target to
front, and the existing dedupe check guards against merge A --into A.

Also improves the 1-positional-no-into error hint to show the --into
form as an alternative example.
@BYK BYK force-pushed the fix/cli-1ae-merge-into-single-positional branch from df2b0ab to 92550f5 Compare May 5, 2026 16:28
Comment thread test/lib/complete.test.ts Outdated
Comment thread src/commands/issue/merge.ts
Comment thread test/commands/release/view.test.ts Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5092f1. Configure here.

Comment thread src/commands/issue/merge.ts Outdated
@BYK BYK force-pushed the fix/cli-1ae-merge-into-single-positional branch from 655f2ef to 92550f5 Compare May 6, 2026 08:26
@BYK BYK merged commit e11cc43 into main May 6, 2026
45 checks passed
@BYK BYK deleted the fix/cli-1ae-merge-into-single-positional branch May 6, 2026 08:45
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