fix(project create): auto-correct dot-separated platform to hyphens#336
Merged
fix(project create): auto-correct dot-separated platform to hyphens#336
Conversation
Users commonly copy platform identifiers from Sentry's SDK guide URLs which use dots (e.g., javascript.nextjs) when the API expects hyphens (javascript-nextjs). Since dots are never valid in platform identifiers, this is safe to auto-correct. Following the established pattern from normalizeFields() in api.ts: auto-correct the invalid input and warn on stderr.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Trace
Other
Bug Fixes 🐛Api
Formatters
Setup
Other
Internal Changes 🔧Api
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 2631 passed | Total: 2631 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 3126 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 82.42% 82.43% +0.01%
==========================================
Files 126 126 —
Lines 17782 17792 +10
Branches 0 0 —
==========================================
+ Hits 14656 14666 +10
- Misses 3126 3126 —
- Partials 0 0 —Generated by Codecov Action |
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.
Problem
Users pass dot-separated platform identifiers like
javascript.nextjs(matching Sentry's SDK guide URLs likesentry.io/for/javascript.nextjs) but Sentry's API expects hyphen-separated format (javascript-nextjs). This results in a confusingCliError: Invalid platform 'javascript.nextjs'error.Sentry issue: https://sentry.sentry.io/issues/7308899722/
Solution
Following the established CLI pattern of auto-correcting common user mistakes with stderr warnings (same approach as
normalizeFields()inapi.ts), this PR adds anormalizePlatform()function that:This is safe to auto-correct because:
Changes
src/commands/project/create.ts: AddednormalizePlatform()function and applied it before the platform is sent to the APItest/commands/project/create.test.ts: Added 3 tests for platform normalizationBefore
After
Fixes CLI-AT