Skip to content

fix(resolution): correct hint for bare suffix in org/suffix issue ID#1296

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-resolution-hint
Open

fix(resolution): correct hint for bare suffix in org/suffix issue ID#1296
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-resolution-hint

Conversation

@sentry

@sentry sentry Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This PR addresses an issue where buildCommandHint provided an unhelpful error suggestion for issue IDs in the org/SUFFIX format (e.g., sentry/SERVER).

Problem: When a user provided an issue ID like org/SERVER (a bare suffix after a slash), buildCommandHint incorrectly returned the raw input as a suggestion. This led to an unhelpful ResolutionError message, as the Try: hint simply echoed the same failing command (sentry issue view sentry/SERVER) instead of guiding the user to the correct format (sentry issue view sentry/<project>-SERVER).

Root Cause: The buildCommandHint function had a short-circuiting logic that returned the raw issueId if it contained a /, without further checking if the part after the slash was a valid project-prefixed suffix or a bare suffix.

Solution: The logic within buildCommandHint has been updated. It now inspects the segment after the last /. If this segment is identified as a bare suffix (i.e., it contains no dash and is not composed purely of digits), the function constructs a more helpful hint: ${base} ${command} ${org}/<project>-${suffix}. This ensures that users receive actionable advice when they omit the project prefix in org/suffix issue ID formats, while preserving the correct behavior for other slash-containing inputs (e.g., org/numeric, org/project-suffix).

Fixes CLI-RD

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-07-25 10:41 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5496 uncovered lines.
✅ Project coverage is 81.75%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.75%    81.75%        —%
==========================================
  Files          428       428         —
  Lines        30106     30111        +5
  Branches     19593     19598        +5
==========================================
+ Hits         24611     24615        +4
- Misses        5495      5496        +1
- Partials      2054      2056        +2

Generated by Codecov Action

@sentry
sentry Bot marked this pull request as ready for review July 25, 2026 10:49
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 25, 2026
Comment on lines +102 to +105
const afterSlash = issueId.slice(slashIdx + 1);
if (afterSlash && !afterSlash.includes("-") && !isAllDigits(afterSlash)) {
// Bare suffix after org — guide user to supply a project
return `${base} ${command} ${prefix}/<project>-${afterSlash}`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bug: The buildCommandHint function generates an incorrect command hint for issue arguments combining an organization and a special selector (e.g., org/@latest), suggesting an invalid command format.
Severity: LOW

Suggested Fix

Modify the condition at line 103 in buildCommandHint to correctly handle special selectors like @latest. The check should be updated to ignore strings that start with @, preventing them from being treated as project suffixes. For example, add !afterSlash.startsWith('@') to the conditional. Additionally, add a test case for inputs like "sentry/@latest" to prevent future regressions.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/commands/issue/utils.ts#L102-L105

Potential issue: The new logic in the `buildCommandHint` function incorrectly handles
issue arguments that combine an organization with a special selector, such as
`"sentry/@latest"`. The condition at line 103 in `src/commands/issue/utils.ts` fails to
account for the `@` prefix in the part of the string after the slash. As a result, when
`buildCommandHint` is called with an input like `"sentry/@latest"`, it incorrectly
assumes `@latest` is a project suffix and generates a malformed command hint like
`"sentry issue view sentry/<project>-@latest"`. The correct behavior would be to return
`"sentry issue view sentry/@latest"`. This bug is triggered when selector resolution
fails and an error hint is generated for the user, leading to confusion.

Did we get this right? 👍 / 👎 to inform future reviews.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 39aa9ba. Configure here.

if (afterSlash && !afterSlash.includes("-") && !isAllDigits(afterSlash)) {
// Bare suffix after org — guide user to supply a project
return `${base} ${command} ${prefix}/<project>-${afterSlash}`;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bare-suffix hint matches multi-segment IDs

Medium Severity

The new bare-suffix rewrite uses lastIndexOf("/") and only inspects the final segment, so inputs that already include project context—such as org/project/suffix, org/project#suffix, or a leading /suffix—are rewritten with an extra /&lt;project&gt;- suggestion. That produces a misleading Try: hint for formats that are already fully specified or should not get an org/project template.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 39aa9ba. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants