Skip to content

fix(download): try a leading v before the latest version - #322

Closed
soimkim wants to merge 1 commit into
mainfrom
fix/download-version-v-prefix
Closed

soimkim wants to merge 1 commit into
mainfrom
fix/download-version-v-prefix

Conversation

@soimkim

@soimkim soimkim commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Keep the v in Go module versions parsed from pkg.go.dev links.
  • When a package-manager version is missing, try the other leading-v form before falling back to the latest release.
  • Request the Go proxy zip with a v prefix so 0.20.2 resolves to v0.20.2.

Test plan

  • PYTHONPATH=src python3 -m pytest tests/test_download_package_version.py tests/test_download_maven.py tests/test_download_packagist.py -q -k "not live"
  • fosslight_download -s https://pkg.go.dev/github.com/go-openapi/jsonreference@v0.20.2 downloads @v/v0.20.2.zip.
  • The same module with @0.20.2 or -c 0.20.2 also resolves to v0.20.2.
  • A version that exists neither with nor without v uses the latest release.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Go package version matching when versions include or omit the v prefix, helping downloads resolve to the correct proxy URL.
    • Added fallback checks for alternate Go version formats and the latest available version when a matching version cannot be found.
    • Improved PyPI version lookup by retrying without a leading v when needed.

A pkg.go.dev link parsed 0.20.2 and requested a zip the proxy does not publish.
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change updates Go module version parsing, lookup, and download URL construction to handle versions with or without a leading v. Tests cover Go version matching and URL generation, plus PyPI version fallback.

Changes: Go version handling

Layer / File(s) Summary
Parse and match module versions
src/fosslight_util/constant.py, src/fosslight_util/_get_downloadable_url.py, tests/test_download_package_version.py
The Go URL pattern captures versions after @ and preserves an existing v prefix. Version lookup tries the alternate prefixed or unprefixed form when needed. Tests cover Go lookup and PyPI prefix fallback.
Build the Go download URL
src/fosslight_util/_get_downloadable_url.py, tests/test_download_package_version.py
Download URL construction adds v to a nonempty Go version that lacks it. A test checks the resulting proxy URL.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Suggested reviewers: dd-jy

Merge Risk: Minimal · up to 6a27e

No merge-blocking risk was established. Run the planned tests before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(download): try a leading v before the latest version" matches the main change. The PR adds a leading-v fallback for Go version lookups and Go proxy download URLs, and the fallback runs …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(download): try a leading v before the latest version" matches the main change. The PR adds a leading-v fallback for Go version lookups and Go proxy download URLs, and the fallback runs before the latest-version fallback. The title is specific and concise. It uses a conventional-commit prefix, which is acceptable. It does not mention Go explicitly, but it still describes the primary behavior change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant