Skip to content

Conversation

@liwilliam2021
Copy link
Contributor

@liwilliam2021 liwilliam2021 commented Jun 27, 2025

I've implemented a solution to convert git repository URLs to HTTPS format in telemetry. Here's a summary of the changes made:

Added a new convertGitUrlToHttps function in src/utils/git.ts that:

Leaves HTTPS URLs unchanged
Converts SSH URLs (like [email protected]:user/repo.git) to HTTPS format (https://github.com/user/repo.git)
Converts SSH URLs with ssh:// prefix to HTTPS format
Handles invalid URLs gracefully
Modified the getGitRepositoryInfo function to use this new function, converting repository URLs to HTTPS format before storing them in telemetry.

Added comprehensive tests for the new functionality.

These changes ensure that repository URLs in telemetry will work correctly regardless of whether they're in git or HTTPS format. The implementation maintains backward compatibility while adding the new conversion functionality.

If you'd like to test this implementation, you'll need to switch back to "Code" mode to run the tests. The tests should verify that:

HTTPS URLs remain unchanged
SSH URLs are properly converted to HTTPS format
The repository information extraction still works correctly
This solution addresses the issue you mentioned where git version URLs don't work in telemetry by automatically converting them to HTTPS format.


Important

Adds convertGitUrlToHttps() to convert SSH URLs to HTTPS in telemetry, with tests for URL conversion.

  • Behavior:
    • Adds convertGitUrlToHttps() in git.ts to convert SSH URLs to HTTPS, leaving HTTPS URLs unchanged.
    • Updates getGitRepositoryInfo() in git.ts to use convertGitUrlToHttps() for telemetry.
    • Handles invalid URLs gracefully, returning the original URL if conversion fails.
  • Tests:
    • Adds tests for convertGitUrlToHttps() in git.spec.ts to verify URL conversion.
    • Updates tests for getGitRepositoryInfo() in git.spec.ts to check URL conversion to HTTPS.
  • Misc:
    • Ensures backward compatibility by maintaining original URL format if conversion is not possible.

This description was created by Ellipsis for c4c8a82. You can customize this summary. It will automatically update as commits are pushed.

@liwilliam2021 liwilliam2021 requested review from cte, jr and mrubens as code owners June 27, 2025 22:44
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jun 27, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 27, 2025

No security or compliance issues detected. Reviewed everything up to c4c8a82.

Security Overview
  • 🔎 Scanned files: 2 changed file(s)
Detected Code Changes

The diff is too large to display a summary of code changes.

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 27, 2025
@liwilliam2021 liwilliam2021 changed the title Will/git telemetry link fix Git Repo URL telemetry link fix: only Https Jun 27, 2025
- Remove duplicate JSDoc comment from convertGitUrlToHttps function
- Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 28, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 28, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Jun 28, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 28, 2025
@mrubens mrubens merged commit dc44e7a into main Jun 28, 2025
20 checks passed
@mrubens mrubens deleted the will/git-telemetry-link-fix branch June 28, 2025 13:32
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 28, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 28, 2025
hannesrudolph pushed a commit that referenced this pull request Jul 3, 2025
* https parsing in URL sanatizing for git repo

* fix: remove duplicate JSDoc and add SSH to HTTPS conversion test

- Remove duplicate JSDoc comment from convertGitUrlToHttps function
- Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format

---------

Co-authored-by: Daniel Riccio <[email protected]>
utarn pushed a commit to modelharbor/ModelHarbor-Agent that referenced this pull request Jul 4, 2025
* https parsing in URL sanatizing for git repo

* fix: remove duplicate JSDoc and add SSH to HTTPS conversion test

- Remove duplicate JSDoc comment from convertGitUrlToHttps function
- Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format

---------

Co-authored-by: Daniel Riccio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants