Skip to content

Conversation

runningcode
Copy link
Contributor

@runningcode runningcode commented Sep 18, 2025

Summary

Backend does not accept github.com, it only accepts github
Normalize VCS provider names.

Closes EME-303

Examples

Hostname Before After
github.com github.com github
gitlab.com gitlab.com gitlab
dev.azure.com dev.azure.com azure
git.mycompany.com git.mycompany.com mycompany

🤖 Generated with Claude Code

Extract meaningful provider names from hostnames by taking the part
immediately before the last dot. This provides cleaner names like
"github" instead of "github.com" and "azure" instead of "dev.azure.com".

Examples:
- github.com → github
- gitlab.com → gitlab
- dev.azure.com → azure
- git.mycompany.com → mycompany

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@runningcode runningcode requested review from szokeasaurusrex and a team as code owners September 18, 2025 12:45
Copy link

linear bot commented Sep 18, 2025

src/utils/vcs.rs Outdated
Comment on lines 204 to 205
provider: extract_provider_name(&host.to_lowercase()),
id: strip_git_suffix(path).to_lowercase(),

Choose a reason for hiding this comment

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

Potential bug: The new provider name normalization is not applied to special cases like Azure DevOps, causing inconsistent provider formats and breaking downstream logic that expects normalized names.
  • Description: The new extract_provider_name function is used to normalize provider names like github.com to github in the generic case. However, this normalization is not applied to special cases for providers like Azure DevOps (dev.azure.com) or Visual Studio (*.visualstudio.com), which continue to return the full hostname. Downstream, the find_reference_url function expects normalized provider IDs (e.g., visualstudio). This inconsistency will cause provider matching to fail for these special cases, preventing features like finding reference URLs from working correctly for them.

  • Suggested fix: Apply the extract_provider_name normalization logic consistently to all provider-handling branches within the VcsUrl::from_git_parts function. This includes the special cases for Azure DevOps, Visual Studio, Google Cloud Build, and Bitbucket Server, ensuring all paths produce a normalized provider name.
    severity: 0.6, confidence: 0.9

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

cursor[bot]

This comment was marked as outdated.

Update all test expectations in test_url_parsing to match the new
normalized provider names. Also ensure all special case paths use
the extract_provider_name function for consistency.
@runningcode runningcode changed the title feat: Normalize VCS provider names for cleaner display feat: Normalize VCS provider names to match backend Sep 18, 2025
Copy link
Contributor

@chromy chromy left a comment

Choose a reason for hiding this comment

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

Assuming that provider is a new thing we added just for us (which I think it is) lgtm

Copy link
Member

@rbro112 rbro112 left a comment

Choose a reason for hiding this comment

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

Looks good, would recommend double checking that no other commands leverage provider in its current state to make sure nothing unexpected breaks.

@runningcode
Copy link
Contributor Author

I had assumed that this was all added by us, but it seems some of it is used elsewhere which could break some things. I’ll take a look.

@szokeasaurusrex
Copy link
Member

I had assumed that this was all added by us, but it seems some of it is used elsewhere which could break some things. I’ll take a look.

@runningcode What is the result of this investigation? Is this PR ready for review?

- Revert all VcsUrl parsing logic to preserve internal consistency
- Only apply provider name normalization in get_provider_from_remote function
- This ensures VCS URL parsing and tests remain unchanged while still
  providing normalized names (github, gitlab, etc.) for CLI usage
- Add dedicated test for get_provider_from_remote normalization
@runningcode
Copy link
Contributor Author

It was affecting the release feature. I've simplified the PR to only affect the function that we use. Should be much easier to review now!

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

I think Cursor's point is valid

runningcode and others added 2 commits September 19, 2025 18:15
- Fix extract_provider_name to handle URLs with trailing dots
- Improve logic to correctly extract provider from domains like dev.azure.com
- Add comprehensive tests for edge cases including trailing dots
- Use simple string split approach instead of complex regex

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Use rsplit iterator instead of Vec collection for cleaner code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
);
// Test edge case with trailing dot in hostname
assert_eq!(
get_provider_from_remote("https://github.com./user/repo"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test case added

}

fn extract_provider_name(host: &str) -> String {
let trimmed = host.trim_end_matches('.');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had claude try to come up with the best solution that passes all the tests.
This code seems really simple but I’m not sure how it manages to pass all the tests. 😅

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Looks good, please address minor comments prior to merge

runningcode and others added 3 commits September 19, 2025 18:50
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
@runningcode runningcode enabled auto-merge (squash) September 19, 2025 16:58
`npm ci` will fail here, as the new versions of the optional
dependencies are not published yet.

Additionally, add a script to bump the optional dependencies in the
package-lock.json after a release is created. Otherwise, `npm ci` will
continue to fail after the release, until someone updates the
package-lock.json manually.
getsentry-bot and others added 8 commits September 19, 2025 19:01
This did not get done automatically on release. I will put a PR on top
of this to fix the automatic script, so we do not need to do this
manually again.
As we are doing `--package-lock-only` (which does not actually install
packages), we don't have the dependencies needed to run the `install.js`
script, which is auto-run when installing. By passing
`--ignore-scripts`, we skip running `install.js`, and only end up
bumping the `package-lock.json`, which is what we want to do.
)

Fixes commit resolution failures that caused "Unable to fetch commits"
errors in Sentry when using partial SHAs with `sentry-cli releases
set-commits`.
- Partial SHAs like `f915d32` are now passed to the API without padding,
allowing single partial SHAs and ranges of partial SHAs to be
successfully associated with a release.
- Ensures SHAs are >=64 chars long, same as the backend (no validation
for minimum length or hexademical).
- Drop support for specifying commits via branch names (an undocumented
feature that relied on the repo being checked out locally).

Fixes #2064 
Fixes CLI-55
Fixes REPLAY-413

Before (commit associations with partial SHAs fail, as denoted by the
lack of profile pic for the top 2 releases where I used partial SHAs):
<img width="1220" height="425" alt="Screenshot 2025-09-15 at 5 00 46 PM"
src="https://github.com/user-attachments/assets/341864a0-a738-40e8-823c-67cc22498588"
/>

After (commit associations with partial SHAs now work; note the profile
pics for the top 2 releases are now present):
<img width="1220" height="425" alt="Screenshot 2025-09-15 at 5 11 59 PM"
src="https://github.com/user-attachments/assets/eded5a15-5dc0-4579-a122-1c9ddea734b4"
/>

---------

Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
While we still have this in two codebases we need to copy over the
emerge change from: EmergeTools/emerge#11525
## Summary
- Improves error handling for invalid `--vcs-provider` parameter values
- When backend returns “400 Unsupported provider" error, shows
user-friendly message instead of generic API error

Before this PR:
```
WARN    2025-09-18 07:49:04.315821 +02:00 EXPERIMENTAL: The build subcommand is experimental. The command is subject to breaking changes and may be removed without notice in any release.
> Preparing for upload completed in 0.114s
  WARN    2025-09-18 07:49:05.135782 +02:00 Failed to upload 1 file:
  WARN    2025-09-18 07:49:05.135865 +02:00   - /Users/nelsonosacky/workspace/hackernews/android/app/build/outputs/apk/debug/app-debug.apk (API request failed)
error: Failed to upload any files
```

After this PR:
```
  WARN    2025-09-18 09:40:30.389061 +02:00 EXPERIMENTAL: The build subcommand is experimental. The command is subject to breaking changes and may be removed without notice in any release.
> Preparing for upload completed in 1.233s
  WARN    2025-09-18 09:40:32.341187 +02:00 Failed to upload 1 file:
  WARN    2025-09-18 09:40:32.342033 +02:00   - /Users/nelsonosacky/workspace/hackernews/android/app/build/outputs/apk/debug/app-debug.apk
  WARN    2025-09-18 09:40:32.342108 +02:00     Error: API request failed
  WARN    2025-09-18 09:40:32.342144 +02:00     Cause: sentry reported an error: Unsupported provider (http status: 400)
error: Failed to upload any files
```



Closes EME-301

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
@runningcode runningcode merged commit 4c70555 into master Sep 19, 2025
25 checks passed
@runningcode runningcode deleted the no/normalize-vcs-provider-names branch September 19, 2025 17:07
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.

7 participants