豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

fix(go_modules): normalize Azure DevOps module paths to include /_git/#14302

Merged
thavaahariharangit merged 15 commits intomainfrom
harry/go-modules-dev-azure-url-resolution
Mar 2, 2026
Merged

fix(go_modules): normalize Azure DevOps module paths to include /_git/#14302
thavaahariharangit merged 15 commits intomainfrom
harry/go-modules-dev-azure-url-resolution

Conversation

@thavaahariharangit
Copy link
Copy Markdown
Contributor

@thavaahariharangit thavaahariharangit commented Feb 27, 2026

What are you trying to accomplish?

Ensure Dependabot can resolve private Go modules hosted on Azure DevOps when the module path omits /_git/ (for example dev.azure.com/org/project/repo.git ), by normalizing those paths before running go list so fetches target the correct repo URL and avoid false 404/auth failures.

Anything you want to highlight for special attention from reviewers?

Please note that this change adds Azure DevOps-specific normalization for Go module paths by inserting /_git/ when it is missing. This aligns with documented Azure Repos URL requirements and prevents resolution failures caused by non-canonical paths. The behavior is limited to dev.azure.com dependencies, leaves already-correct Azure paths unchanged, and does not affect non-Azure dependencies.

Another supportive evidence: https://www.sheldonhull.com/using-azure-devops-for-private-go-modules/

How will you know you've accomplished your goal?

  • Dependabot’s Go updater runs go list/resolution for Azure DevOps modules without 404 on the incorrect non-/_git/ URL.
  • The resolved fetch target is normalized to https://dev.azure.com/<org>/<project>/_git/<repo> when needed.
  • Existing behavior for non-Azure module paths is unchanged.
  • The new regression spec for Azure normalization passes, along with RuboCop and Sorbet for the touched files.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@thavaahariharangit thavaahariharangit requested a review from a team as a code owner February 27, 2026 14:39
Copilot AI review requested due to automatic review settings February 27, 2026 14:39
@github-actions github-actions bot added the L: go:modules Golang modules label Feb 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Dependabot’s Go Modules ecosystem support for Azure DevOps-hosted modules by normalizing module/repo paths so go list (and the Go import resolver helper) target the correct Azure DevOps repository URL format.

Changes:

  • Normalize dev.azure.com/... module paths to include /_git/ before running go list in Ruby.
  • Normalize Azure DevOps remotes in the Go importresolver helper to include /_git/.
  • Add regression tests covering Azure DevOps normalization behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go_modules/spec/dependabot/go_modules/package/package_details_fetcher_spec.rb Adds a spec asserting go list is called with an Azure-normalized module path.
go_modules/lib/dependabot/go_modules/update_checker/latest_version_finder.rb Normalizes Azure module paths before go list during cooldown date checks.
go_modules/lib/dependabot/go_modules/package/package_details_fetcher.rb Normalizes Azure module paths before go list -m -versions.
go_modules/helpers/importresolver/main.go Normalizes Azure DevOps remotes to include /_git/ before VCS resolution.
go_modules/helpers/importresolver/main_test.go Adds unit tests for Azure DevOps remote normalization.

Comment thread go_modules/lib/dependabot/go_modules/package/package_details_fetcher.rb Outdated
Comment thread go_modules/lib/dependabot/go_modules/update_checker/latest_version_finder.rb Outdated
Comment thread go_modules/helpers/importresolver/main.go Outdated
Comment thread go_modules/lib/dependabot/go_modules/package/package_details_fetcher.rb Outdated
Comment thread go_modules/helpers/importresolver/main_test.go Outdated
},
{
name: "removes .git suffix when _git already exists",
input: "https://dev.azure.com/VaronisIO/da-cloud/_git/be-protobuf.git",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When the path contains /_git/ then it's already assumed to be correct, so it should only be trimmed if and only if /_git/ isn't present. I manually checked this with an internal repo. When the form /org/project/_git/repo.git is used it resolves to a 404.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated as per the comment

Copy link
Copy Markdown
Contributor Author

thavaahariharangit commented Mar 2, 2026

Correction to previous comment (formatting issue):

Addressed the /_git/ + .git edge case from review.

Behavior now:

  • If the Azure DevOps module path already contains /_git/, it is treated as authoritative and left unchanged (including a .git suffix).
  • .git trimming is applied only when normalizing the non-/_git/ form, e.g.:
    dev.azure.com/org/project/repo.git -> dev.azure.com/org/project/_git/repo

Also refactored the Ruby normalizer for readability with:

  • an early return for existing /_git/ paths
  • direct segment insertion for missing /_git/

Validation run in container:

  • bin/test go_modules spec/dependabot/go_modules/azure_devops_path_normalizer_spec.rb
  • bin/test go_modules spec/dependabot/go_modules/package/package_details_fetcher_spec.rb
  • bin/test go_modules rubocop lib/dependabot/go_modules/azure_devops_path_normalizer.rb spec/dependabot/go_modules/azure_devops_path_normalizer_spec.rb

},
{
name: "removes .git suffix when _git already exists",
input: "https://dev.azure.com/VaronisIO/da-cloud/_git/be-protobuf.git",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot This test case is incorrect. When the URL contains the sequence /_git/ then it is assumed to be correct and the .git suffix on the repo name is assumed to be correct and should be retained.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

@brettfo I've opened a new pull request, #14338, to work on those changes. Once the pull request is ready, I'll request review from you.

@thavaahariharangit thavaahariharangit merged commit 829a0a4 into main Mar 2, 2026
98 checks passed
@thavaahariharangit thavaahariharangit deleted the harry/go-modules-dev-azure-url-resolution branch March 2, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: go:modules Golang modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants