Conversation
…sue IDs (CLI-14M, CLI-16M) Extend normalizeSlug() to convert spaces to dashes (with lowercasing and dash collapsing), matching how Sentry generates slugs from display names. Reorder parsing to normalize before validating so spaces become dashes before validateResourceId() rejects them. Add .trim() to parseIssueArg() and parseSlashSeparatedArg() to handle trailing newlines from AI agents. Fixes CLI-14M (space in project slug) and CLI-16M (newline in issue ID).
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
|
BYK
commented
Apr 15, 2026
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 97.47%. Project has 1627 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.33% 95.33% —%
==========================================
Files 234 234 —
Lines 34792 34839 +47
Branches 0 0 —
==========================================
+ Hits 33167 33212 +45
- Misses 1625 1627 +2
- Partials 0 0 —Generated by Codecov Action |
Use [_ ]+ to replace runs of underscores/spaces with a single dash in one pass instead of two separate replace calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
normalizeSlug()to convert spaces → dashes with lowercasing and consecutive dash collapsing, matching how Sentry generates slugs from display names (e.g.,"My Project"→"my-project")validateResourceId()— spaces become dashes before the forbidden-character check can reject them.trim()toparseIssueArg()andparseSlashSeparatedArg()to strip trailing whitespace/newlines from AI agent inputsMotivation
Two related
ValidationErrorissues from the input validation layer:Invalid project slug: contains a space.— User passed a display name like"My Project"instead of slug"my-project"Invalid issue identifier: contains a newline.— AI agent (Claude) passed an issue ID with a trailing\nThe validation itself is correct (agent hallucination hardening), but the parsing layer should normalize recoverable inputs before validation — just like it already normalizes underscores → dashes.
Key Design Decisions
"my_project"stays"my-project"(preserves casing for backward compat), but"My Project"→"my-project"since spaces imply a display namevalidateResourceId()unchanged — Still rejects spaces as defense-in-depth for any code path that skipsnormalizeSlugparseIssueArgonly trims, since issue identifiers like"CLI-G5"should never have internal spaces silently converted"spaces"→ "use lowercase with dashes, not spaces";"both"→ "not spaces or underscores"