Skip to content

fix: lowercase project slug in issue arg parsing (CLI-C8)#496

Merged
BYK merged 2 commits intomainfrom
fix/cli-c8-case-insensitive-project
Mar 20, 2026
Merged

fix: lowercase project slug in issue arg parsing (CLI-C8)#496
BYK merged 2 commits intomainfrom
fix/cli-c8-case-insensitive-project

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 20, 2026

Problem

When users type issue short IDs in uppercase (e.g., sentry issue view EASI-API-3Y4), the parser extracts EASI-API as the project slug. Since Sentry slugs are always lowercase, the API lookup fails with Project 'EASI-API' not found. Affects 12 users (CLI-C8).

Fix

Lowercase the project slug extracted from issue short IDs in two locations:

  1. parseWithDash — bare short IDs like EASI-API-3Y4 → project=easi-api, suffix=3Y4
  2. parseAfterSlash — org-prefixed short IDs like org/CLI-G → project=cli, suffix=G

The suffix remains uppercase (correct for short ID lookup), only the project slug is lowercased.

Test Changes

Updated one test expectation: o1081365/CLI-G now correctly produces project: "cli" instead of project: "CLI".

When users type issue short IDs in uppercase (e.g., 'EASI-API-3Y4'),
the parser extracts the project slug as 'EASI-API' (uppercase). Since
Sentry slugs are always lowercase, the API lookup fails with 'Project
not found'. This affects 12 users (CLI-C8).

Lowercase the project slug in both parseWithDash (bare short IDs) and
parseAfterSlash (org-prefixed short IDs) since Sentry project slugs
are always lowercase.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (telemetry) Track TTY vs non-TTY invocations via metric by betegon in #482
  • Dynamic cache-backed shell completions with fuzzy matching by BYK in #465

Bug Fixes 🐛

  • (project) Fallback to org listing when bare slug matches an organization by betegon in #475
  • Lowercase project slug in issue arg parsing (CLI-C8) by BYK in #496
  • Enrich short ID 404 with org context and suggestions (CLI-A1) by BYK in #494
  • Suggest similar projects when project not found in org (CLI-C0) by BYK in #493
  • Event 404 hint should suggest different project, not repeat failing command by BYK in #492
  • Enrich event 404 errors with retention and format suggestions (CLI-6F) by BYK in #491
  • Add actionable suggestions for 400 Bad Request on issue list (CLI-BM, CLI-7B) by BYK in #489
  • Detect issue short IDs passed to issue list (CLI-C3) by BYK in #488
  • Add Glob.match() polyfill + improve auto-detect diagnostics (CLI-7T) by BYK in #487
  • Add org-slug pre-check to dispatchOrgScopedList (CLI-9A) by BYK in #485

Internal Changes 🔧

  • (issue) Skip getProject round-trip in project-search resolution by betegon in #473
  • (resolve) Carry project data through resolution to eliminate redundant getProject calls by BYK in #486
  • HTTP latency optimizations — diagnostics, cache warming, concurrency limits by BYK in #490
  • Switch from @sentry/bun to @sentry/node-core/light (~170ms startup savings) by BYK in #474
  • Regenerate skill files by github-actions[bot] in b7b240ec

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Codecov Results 📊

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

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1058 uncovered lines.
❌ Project coverage is 95.71%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
arg-parsing.ts 94.57% ⚠️ 19 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.74%    95.71%    -0.03%
==========================================
  Files          180       180         —
  Lines        24669     24679       +10
  Branches         0         0         —
==========================================
+ Hits         23617     23621        +4
- Misses        1052      1058        +6
- Partials         0         0         —

Generated by Codecov Action

Address Bugbot review: parseMultiSlashIssueArg was missing the same
lowercase normalization applied to the other two parsing functions.
Copy link

@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.

);
}

// Lowercase project slug — Sentry slugs are always lowercase.
Copy link

Choose a reason for hiding this comment

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

Missing project lowercase in URL parsing path

High Severity

The issueArgFromUrl function at line 403 returns project without calling .toLowerCase(), while the same normalization was added to parseWithDash, parseAfterSlash, and parseMultiSlashIssueArg. This means parsing https://sentry.io/organizations/my-org/issues/CLI-G/ still produces project: "CLI" (uppercase), causing the same API lookup failure this PR intends to fix. The existing tests at lines 354 and 367 confirm the uppercase behavior persists for URLs.

Fix in Cursor Fix in Web

@BYK BYK merged commit 7d9c6b9 into main Mar 20, 2026
22 checks passed
@BYK BYK deleted the fix/cli-c8-case-insensitive-project branch March 20, 2026 09:18
BYK added a commit that referenced this pull request Mar 20, 2026
…low-up)

Address unresolved Bugbot review from PR #496: issueArgFromUrl returned
the project slug without .toLowerCase() when parsing Sentry issue URLs
like https://sentry.io/organizations/org/issues/CLI-G/. This meant the
URL parsing path still produced uppercase project slugs ('CLI') that
would fail API lookups, while the other three parsing paths (parseWithDash,
parseAfterSlash, parseMultiSlashIssueArg) were already fixed.
BYK added a commit that referenced this pull request Mar 20, 2026
…low-up) (#506)

## Follow-up to PR #496

Addresses unresolved [Bugbot review
comment](#496 (comment))
(High severity) that was missed before merging #496.

## Problem

`issueArgFromUrl` returned the project slug without `.toLowerCase()`
when parsing Sentry issue URLs like:
```
https://sentry.io/organizations/my-org/issues/CLI-G/
```

This produced `project: "CLI"` (uppercase) which fails API lookups since
Sentry slugs are always lowercase. The other three parsing paths
(`parseWithDash`, `parseAfterSlash`, `parseMultiSlashIssueArg`) were
already fixed in PR #496.

## Fix

Added `.toLowerCase()` to the project slug in `issueArgFromUrl` and
updated two test expectations to match.
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.

1 participant