pulsar-edit / ppm

Pulsar Package Manager
MIT License
35 stars 13 forks source link

ppm installs the wrong package #125

Closed toddy15 closed 6 months ago

toddy15 commented 7 months ago

Thanks in advance for your bug report!

What happened?

I've just updated my atom package autocomplete-tailwindcss for pulsar. During this, I've renamed it to autocomplete-tailwindcss. As you might guess, it's an autocompletion provider for Tailwind CSS class names.

The code is several years old and was initially written by Vincent Klaiber. They published the package under the name autocomplete-tailwind. Note the missing 'css' and the end. That repository is no longer accessible at GitHub and results in a 404 error.

After I've published the package with ppm publish, it got registered at https://web.pulsar-edit.dev/packages/autocomplete-tailwindcss.

However, I cannot install the package -- instead, the abandoned package from Vincent Klaiber gets installed. This is rather surprising. Especially, because the package does not even exist at https://web.pulsar-edit.dev/.

Pulsar version

1.113.0

Which OS does this happen on?

🐧 Debian based (Linux Mint, Ubuntu, etc.)

OS details

Debian GNU/Linux trixie/sid

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

$ ppm install autocomplete-tailwindcss
Installing autocomplete-tailwindcss to /home/toddy/.pulsar/packages ✓
$ ls ~/.pulsar/packages 
autocomplete-tailwind

Additional Information:

No response

confused-Techie commented 7 months ago

Thanks a ton for reporting this issue!

So I've seen this issue before. Essentially your package is still being installed, but the wrong version of it is.

Basically in some cases when you publish a package, the Pulsar Package Registry (PPR) will try to discover previous versions of your package, it does this through the previous tags that are available on the GitHub Repo.

In this case you have the tag v0.11.0, but because you forked this package there's all the tags that were published under autocomplete-tailwind, such as tag v0.0.1.

But in some cases there's a bug where the PPR will then incorrectly assign the download URL for your latest version as some other much earlier version.

IN your case it looks like the PPR thinks that your version v0.11.0 is downloadable at https://api.github.com/repos/toddy15/autocomplete-tailwindcss/tarball/refs/tags/v0.0.1, notice the most important bit here, the version at the end.

The PPR incorrectly is using the wrong version as the download link for your package. What this means is that when the package is installed, it downloads the package.json of this package prior to you forking it, which then causes the installed package to have the incorrect repository listed, and thus unable to update to your newer versions, since it thinks it's a totally different package.


So thanks a ton for reporting this one, this is actually an issue I had seen once before without fully understanding the issue, but I do now have a fix for it, that just isn't in production yet.

But of course me fixing the code that causes this, won't retroactively fix your package.

There's really two choices to fix your package:

toddy15 commented 7 months ago

Great, thanks a lot for your analysis and solution. I've now pushed v0.12.0 and can confirm that this fixes the issue. Thanks!

Regards, Tobias

confused-Techie commented 6 months ago

Alright, as the fix listed for this for future package's is published and in production, and @toddy15 was able to resolve the issue within their own package, I'll go ahead and close this issue. Thanks for contributing!