williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.91k stars 278 forks source link

mason not recognizing updated tag #1458

Open errantepiphany opened 1 year ago

errantepiphany commented 1 year ago

I've searched open issues for similar requests

I've recently downloaded the latest plugin version of mason.nvim

Problem description

Hello, I don't know if this is a code bug, a misconfiguration, or perhaps should be a feature request.

If you look here on line 13: https://github.com/mason-org/mason-registry/blob/main/packages/drools-lsp/package.yaml#L13C11-L13C37 , you can see that it references the @latest tag. However, "latest" is a moving target. For example, "latest" was updated here just recently as the results of a CI build kicked off from a recent PR merge: https://github.com/kiegroup/drools-lsp/tags The problem is that when I ask Mason to check for (and install) updates, it doesn't recognize that "latest" was updated. I think it might be because Mason's just looking at the name of the tag, and thinks, "I've already downloaded the latest artifact - no need to do so again", but it's not taking into consideration that the timestamp on that tag has changed and it should re-download and replace it.

Now, I can understand the argument that tags shouldn't change, however "latest" is special, and I can envision other, similar moving targets. Is there anyway to configure mason to notice the updated timestamp?

Aside, yes, I recognize that there are no numbered releases in drools_lsp yet. Just the "latest" tag at this point. Whereas the Drools LSP server does function at a basic level, it is still in its early stages. Perhaps the only answer is for us to just start doing numbered releases? (Like 0.1.0, 0.1.1, etc.?) I still think being able to set it up somehow to recognize tag timestamp changes would be a useful capability.

Thank you so much! :)

Expected behavior

I would expect Mason to notice that the tagged release has been updated, and re-download the asset and overwrite it locally.

Affected packages

drools-lsp (or maybe All?)

Mason output

Installed
    ◍ ansible-language-server
    ◍ bash-language-server
    ◍ dockerfile-language-server
    ◍ drools-lsp
      An implementation of a language server for the Drools Rule Language.

      installed version latest                                 
      homepage          https://github.com/kiegroup/drools-lsp 
      languages         Drools                                 
      categories        LSP                                    

    ◍ jdtls
    ◍ json-lsp
    ◍ lua-language-server
    ◍ luacheck
    ◍ shellcheck
    ◍ shfmt
    ◍ stylua
    ◍ typescript-language-server
    ◍ vale-ls
    ◍ vim-language-server
    ◍ yaml-language-server

Installation log

[DEBUG jue 17 ago 2023 15:26:11] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://api.mason-registry.dev/api/github/mason-org/mason-registry/releases/latest"
[DEBUG jue 17 ago 2023 15:26:11] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim v1.6.2 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "--connect-timeout", 30, "https://api.mason-registry.dev/api/github/mason-org/mason-registry/releases/latest" }
}
[DEBUG jue 17 ago 2023 15:26:11] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 34439
[DEBUG jue 17 ago 2023 15:26:11] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=34439 exited with exit_code=0, signal=0
[DEBUG jue 17 ago 2023 15:26:11] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://github.com/mason-org/mason-registry/releases/download/2023-08-17-right-spider/registry.json.zip"
[DEBUG jue 17 ago 2023 15:26:11] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: mason.nvim v1.6.2 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "-o", "/home/dward/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json.zip", "--connect-timeout", 30, "https://github.com/mason-org/mason-registry/releases/download/2023-08-17-right-spider/registry.json.zip" }
}
[DEBUG jue 17 ago 2023 15:26:11] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 34441
[DEBUG jue 17 ago 2023 15:26:12] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=34441 exited with exit_code=0, signal=0
[DEBUG jue 17 ago 2023 15:26:12] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:59: fs: unlink /home/dward/.local/share/nvim/mason/registries/github/mason-org/mason-registry/registry.json.zip
[DEBUG jue 17 ago 2023 15:26:12] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://github.com/mason-org/mason-registry/releases/download/2023-08-17-right-spider/checksums.txt"
[DEBUG jue 17 ago 2023 15:26:12] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: mason.nvim v1.6.2 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "--connect-timeout", 30, "https://github.com/mason-org/mason-registry/releases/download/2023-08-17-right-spider/checksums.txt" }
}
[DEBUG jue 17 ago 2023 15:26:12] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 34444
[DEBUG jue 17 ago 2023 15:26:12] ...al/share/nvim/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=34444 exited with exit_code=0, signal=0
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec ansible-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec json-lsp {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec lua-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec luacheck {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec shellcheck {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec shfmt {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec stylua {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec typescript-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec vale-ls {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec vim-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec yaml-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec bash-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec dockerfile-language-server {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec drools-lsp {}
[DEBUG jue 17 ago 2023 15:26:12] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:109: Parsing spec jdtls {}

Neovim version (>= 0.7)

NVIM v0.9.1 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Operating system/version

Linux tpad 6.4.10-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 11 12:20:29 UTC 2023 x86_64 GNU/Linux

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.6.2
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2023-08-17-right-spider` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.3 hecho en linux-gnu.`
- OK curl: `curl 8.0.1 (x86_64-redhat-linux-gnu) libcurl/8.0.1 OpenSSL/3.0.9 zlib/1.2.13 libidn2/2.3.4 nghttp2/1.52.0`
- OK gzip: `gzip 1.12`
- OK tar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash, versión 5.2.15(1)-release (x86_64-redhat-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- OK node: `v18.17.1`
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- OK Ruby: `ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.4`
- OK python3_host_prog: `Python 3.11.4`
- WARNING pip: not available
  - ADVICE:
    - spawn: python3 failed with exit code 1 and signal 0. /usr/bin/python3: No module named pip

- OK java: `openjdk version "17.0.8" 2023-07-18`
- OK luarocks: `/usr/bin/luarocks 3.9.2`
- WARNING python3_host_prog pip: not available
  - ADVICE:
    - spawn: /usr/bin/python3 failed with exit code 1 and signal 0. /usr/bin/python3: No module named pip

- OK python venv: `Ok`
- OK RubyGem: `3.4.10`
- OK npm: `9.6.7`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: jue 17 ago 2023 16:20:03.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

No response

errantepiphany commented 1 year ago

I've created this issue here, replacing https://github.com/mason-org/mason-registry/issues/2450

williamboman commented 1 year ago

Hello! Ah yeah versions should not target mutable references, such as the latest tag in this case. https://github.com/mason-org/mason-registry/pull/2512 changes to use commit SHAs instead. Ideally they'd tag immutable releases

errantepiphany commented 1 year ago

Hi @williamboman, thank you. That makes sense, but I'm curious: is there any configuration option in mason I can use in drools-lsp that checks the timestamp on a release artifact, and re-downloads the artifact if a new one has been created? What if an artifact was referenced as part of a branch instead of a tag, and you wanted the latest on that branch? How would that work? I think this would be a nice feature for a kind of "developer mode", where you always want the latest from a CI build, but not necessarily bump a version. Thanks again. :)

williamboman commented 1 year ago

While it's possible to modify release assets after publishing them to GitHub, they are treated as immutable. Having additional logic and features that track changes to the digests of artifacts would provide little to no utility, imo.

~In the case of drools, the asset file is also not provided via releases but is instead a file within the git repo itself, which perfectly follows the immutability principle.~

edit: Actually nvm it does seem like it's providing built assets via releases 🙈

errantepiphany commented 1 year ago

@williamboman Okay, so the recommendation is whenever there is a new release of an lsp server, someone (like me) should create a PR in mason to bump the version tag/commit hash?

Addendum: This is a bit more work (which is fine, I guess) then nvim plugins themselves, which normally just pull from the main/master branch, and then whatever nvim package manager you use (whether it be vim-plug or lazy.nvim or whatever) can automatically update it. You also have the option to target a fixed label/branch/commit point, however most people just have their nvim plugin managers follow latest on main/master. But this is a different methodology than what I think you're suggesting for lsp-servers with mason, which in addition to a new lsp server version being released, a maintainer needs to also submit a PR in mason to point to the newly released version of the lsp server. Like I said, this is fine, but it's just an extra step. I still think it would be nice to have mason follow new releases of lsp servers dynamically, but it's not a deal-breaker. Many thanks again for a fantastic open source project. :)

williamboman commented 1 year ago

Version updates are entirely automated via Renovate, there's only a few select packages that need to be manually bumped.

errantepiphany commented 1 year ago

I'm so sorry to keep bugging you on this, and I sincerely appreciate all the time and patience you've spent on this.

So, the (hopefully last) question I have is, does that mean the git commit hash that you have here: https://github.com/mason-org/mason-registry/pull/2512/files#diff-9cd5400c4c3b88d1b384488d9f3aa38763fa4ed56e5868cc2139f2b2e270706fR14 will automatically be updated to the latest commit by a mason CI process that gets run periodically? (I'm not familiar with Renovate...)

williamboman commented 1 year ago

Yeah Renovate is responsible for scheduling and checking for new commits in the default branch of the repository. However in the case of drools-lsp I didn't realize it relies on release assets, so using commit SHAs won't work. For versioning to behave "correctly" we'll need drools-lsp to tag releases other than retagging "latest" all the time.

errantepiphany commented 1 year ago

Okay, that makes sense, thank you!