feat(download): accept explicit version in download_or_build_binary (#687) - #688
Closed
gustav-fff wants to merge 1 commit into
Closed
gustav-fff wants to merge 1 commit into
gustav-fff wants to merge 1 commit into
Conversation
…687) `download_or_build_binary()` now takes an optional `{ version, proxy, extra_curl_args, timeout_ms }` table. Passing `version` pins the GitHub release tag downloaded from, so lazy.nvim users who set `version = "v0.10.0"` on the plugin spec can pass the same value to the build hook and guarantee the binary matches the pinned Lua code instead of falling through to a nightly/dev tag when the local tag lookup is ambiguous. Also exposes `timeout_ms` so slower boxes can raise the 2-minute cargo fallback ceiling. Refs #687
Collaborator
Author
|
[triage-bot] CI STATUS: initial Lua CI on commit `3b2ac9e` failed with a `need-check-nil` warning on `v:match` (lua-ls could not narrow `opts.version` locally). Fixed with a `---@cast v string` in commit `d302ce2` on branch `triage-bot/issue-687`; verified locally with `lua-language-server --configpath .luarc.ci.json --check=lua/fff/download.lua` → `no problems found`. The PR head is not tracking the latest branch tip on GitHub's side — branch ref points at `d302ce2` but the PR still shows `3b2ac9e`. Force-with-lease and empty commits did not nudge it. May need a manual close/reopen or new push from a maintainer session to re-sync. Honk-Honk 🪿 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #687
Root cause
lua/fff/download.lua:235download_or_build_binary()derives the download tag fromgit tag --points-at HEADviafff.utils.version.current_release_tag(lua/fff/utils/version.lua:33). A release commit can carry several tags (e.g.31be224hasv0.10.0,0.9.7-nightly.a9df55d, and0.10.1-nightly.31be224), and if lazy.nvim's shallow fetch does not bring thev*tag into the local repo the resolver falls through to a-nightlytag or toM.resolve(), which then constructs a nightly tag that may not have a matching release yet. Result: user pinsversion = "0.10.0"in lazy but the build hook downloads0.10.1-nightly.<sha>, which sometimes 404s.Fix
Expose an optional
optstable ondownload_or_build_binary({ version = ..., proxy = ..., extra_curl_args = ..., timeout_ms = ... }). Whenversionis set,ensure_downloadedreceives it verbatim (bypassing the tag/HEAD heuristic). Accepts"0.10.0"or"v0.10.0"— a leadingvis added only for^%d+%.%d+%.%d+$inputs sonightly/ per-sha tags pass through untouched.timeout_msis exposed too so users on slow hardware can raise the 2-minute cargo fallback ceiling reported in the issue (M1 Pro cold build ~6m40s). All params are optional — existingdownload_or_build_binary()callers are unaffected.Steps to reproduce
Setup on
origin/main(pre-fix):{ 'dmtrKovalenko/fff.nvim', version = 'v0.10.0', build = function() require('fff.download').download_or_build_binary() end, }Add
error('url: ' .. url)right after theurl = string.format(...)line atlua/fff/download.lua:89. Restart Neovim so lazy re-runs the build hook.Expected: the error prints
https://github.com/dmtrKovalenko/fff.nvim/releases/download/v0.10.0/....Actual (reporter): prints
https://github.com/dmtrKovalenko/fff.nvim/releases/download/0.10.1-nightly.<sha>/..., and the download then 404s because that per-sha release does not exist yet.Root-cause the divergence with
git -C <lazy-checkout> tag --points-at HEAD— if the output does not containv0.10.0,current_release_tagcannot return it and the code falls through toresolve().How verified
Parse check:
luac -p lua/fff/download.lua→ OK.Behavioral check with a mocked
vim.systemthat captures the outbound URL:Automated triage via Gustav. Honk-Honk 🪿