-
-
Notifications
You must be signed in to change notification settings - Fork 16
Fix 'latest' version resolution and zls error handling for asdf-vm/actions v4 #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'latest' version resolution and zls error handling for asdf-vm/actions v4 #27
Conversation
Co-authored-by: jiacai2050 <[email protected]>
Co-authored-by: jiacai2050 <[email protected]>
…clean up .gitignore Co-authored-by: jiacai2050 <[email protected]>
b6f3493
into
dependabot/github_actions/asdf-vm/actions-4
There was a problem hiding this 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 addresses two issues exposed by the asdf-vm/actions v4 upgrade: handling of the 'latest' version string and preventing installation failures when the zls download service is unavailable.
Changes:
- Added logic to resolve 'latest' version string to an actual version number before lookup
- Added error handling to make zls download optional, preventing installation failures
- Added Python cache files to .gitignore
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/utils.py | Added 'latest' version resolution logic and wrapped zls download in try-except for graceful failure handling |
| .gitignore | Added Python bytecode cache exclusions (*.pyc and pycache/) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Resolve 'latest' to the actual latest version | ||
| if version == 'latest': | ||
| versions = list(k for k in index.keys() if k != 'master') | ||
| versions.sort(key=lambda v: tuple(map(int, v.split('.')))) |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version sorting logic will fail if any version string contains non-numeric components (e.g., "0.11.0-dev.1234+abc"). The map(int, v.split('.')) will raise a ValueError when trying to convert non-numeric strings to integers. This logic is duplicated from the all_versions() function at line 83, which has the same issue. Consider using a more robust version parsing approach or catching and handling malformed version strings appropriately.
| if version == 'latest': | ||
| versions = list(k for k in index.keys() if k != 'master') | ||
| versions.sort(key=lambda v: tuple(map(int, v.split('.')))) | ||
| version = versions[-1] |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version resolution logic duplicates the functionality already present in the all_versions() function (lines 80-84). Consider refactoring to call all_versions() directly and return the last element, which would reduce code duplication and ensure consistency.
| download_tarball(zls_outfile, tarball_info, use_mirror=False) | ||
| tarball_info = zls_links[link_key] | ||
| download_tarball(zls_outfile, tarball_info, use_mirror=False) | ||
| except Exception as e: |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The broad exception handler catches all exceptions, including programming errors like AttributeError, NameError, or KeyboardInterrupt. Consider catching more specific exceptions (e.g., HTTPAccessError, HTTPError, URLError) to avoid silently suppressing unexpected errors that should be addressed.
PR #21 upgrades asdf-vm/actions from v3 to v4, which exposed two issues in the plugin:
Changes
lib/utils.py: Resolve'latest'to actual version number before lookuplib/utils.py: Wrap optional zls download in try-except to prevent installation failures.gitignore: Exclude Python cache filesWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
ziglang.org/usr/bin/python3 python3 lib/utils.py latest-version(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.