crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Installed version in `lib` does not match version in `shard.lock` #581

Closed straight-shoota closed 1 year ago

straight-shoota commented 1 year ago

Originally posted by @jwoertink in https://github.com/crystal-lang/shards/issues/572#issuecomment-1468568825

I [@jwoertink] did a soft release of Lucky and Avram 1.0.0 over the weekend, and now my apps won't pull 1.0.0-rc1 anymore.

My shard.yml file has this:

dependencies:
  lucky:
    github: luckyframework/lucky
    version: 1.0.0-rc1
  avram:
    github: luckyframework/avram
    version: 1.0.0-rc1

I run rm -rf lib/ shard.lock ~/.cache/ then shards install. When it's installing, I see this:

image

My shard.lock file has the correct version:

❯ cat shard.lock 
version: 2.0
shards:
  CrystalEmail:
    git: https://github.com/jwoertink/crystalemail.git
    version: 0.2.6+git.commit.960e1b9ad02288ae56110d39fe9d7ca3bbcdcd1e

  ameba:
    git: https://github.com/crystal-ameba/ameba.git
    version: 1.3.1

  authentic:
    git: https://github.com/luckyframework/authentic.git
    version: 0.9.0

  authly:
    git: https://github.com/azutoolkit/authly.git
    version: 1.2

  avram:
    git: https://github.com/luckyframework/avram.git
    version: 1.0.0-rc1
...
  lucky:
    git: https://github.com/luckyframework/lucky.git
    version: 1.0.0-rc1

Running shards list --tree shows the correct list

❯ shards list --tree
Shards installed:
  * lucky (1.0.0-rc1)
    * lucky_task (0.1.1)
    * habitat (0.4.7)
    * wordsmith (0.4.0)
    * lucky_router (0.5.1)
    * shell-table (0.9.3)
    * cry (0.4.3)
    * exception_page (0.3.0)
      * backtracer (1.2.2)
    * dexter (0.3.4)
    * pulsar (0.2.3)
    * teeplate (0.8.5)
  * avram (1.0.0-rc1)
    * lucky_task (0.1.1)
    * pg (0.26.0)
      * db (0.11.0)
    * habitat (0.4.7)

but the actual versions that show up in lib are wrong...

❯ cat lib/lucky/shard.yml 
name: lucky
version: 1.0.0

crystal: ">=1.6.0"

❯ cat lib/avram/shard.yml 
name: avram
version: 1.0.0

crystal: ">= 1.6.0"

These are installing 1.0.0 and not 1.0.0-rc1 even though it's saying that it is.

Now one very strange thing is, after I run shards install, if I rm -rf lib/lucky/ then shards update lucky that will install the rc1 version. It only installs the wrong version on shards install and shards update.

Edit: using shards 0.17.2

straight-shoota commented 1 year ago

I cannot reproduce this behaviour.

I'm using a fresh docker image to exclude any outside influences.

$ docker run --rm -it crystallang/crystal:1.7.2 /bin/bash
root@2ff99339acfd:/# mkdir -p /app && cd app
root@2ff99339acfd:/app# cat > shard.yml
name: pre-release
version: 0.1.0

dependencies:
  lucky:
    github: luckyframework/lucky
    version: 1.0.0-rc1
  avram:
    github: luckyframework/avram
    version: 1.0.0-rc1
root@2ff99339acfd:/app# shards install
Resolving dependencies
Fetching https://github.com/luckyframework/lucky.git
Fetching https://github.com/luckyframework/avram.git
Fetching https://github.com/luckyframework/lucky_task.git
Fetching https://github.com/luckyframework/habitat.git
Fetching https://github.com/luckyframework/wordsmith.git
Fetching https://github.com/luckyframework/lucky_router.git
Fetching https://github.com/luckyframework/shell-table.cr.git
Fetching https://github.com/luckyframework/cry.git
Fetching https://github.com/crystal-loot/exception_page.git
Fetching https://github.com/luckyframework/dexter.git
Fetching https://github.com/luckyframework/pulsar.git
Fetching https://github.com/luckyframework/teeplate.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/luckyframework/lucky_cache.git
Fetching https://github.com/cadmiumcr/transliterator.git
Fetching https://github.com/sija/backtracer.cr.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/wyhaines/splay_tree_map.cr.git
Installing lucky_task (0.1.1)
Installing habitat (0.4.7)
Installing wordsmith (0.4.0)
Installing lucky_router (0.5.2)
Installing shell-table (0.9.3)
Installing cry (0.4.3)
Installing backtracer (1.2.2)
Installing exception_page (0.3.0)
Installing dexter (0.3.4)
Installing pulsar (0.2.3)
Installing teeplate (0.8.5)
Installing lucky (1.0.0-rc1)
Postinstall of lucky: BUILD_WITHOUT_DEVELOPMENT=true script/precompile_tasks
Installing db (0.11.0)
Installing pg (0.26.0)
Installing splay_tree_map (0.2.2)
Installing lucky_cache (0.1.1)
Installing cadmium_transliterator (0.1.0 at 46c4c14)
Installing avram (1.0.0-rc1)
Postinstall of avram: BUILD_WITHOUT_DEVELOPMENT=true script/precompile_tasks
Writing shard.lock
root@2ff99339acfd:/app# head -n2 lib/{avram,lucky}/shard.yml
==> lib/avram/shard.yml <==
name: avram
version: 1.0.0-rc1

==> lib/lucky/shard.yml <==
name: lucky
version: 1.0.0-rc1

It's likely that some things have changed in the lucky and avram repositories.

@jwoertink As I can see the v1.0.0 tag was only created on March 12, so I'm wondering what version of 1.0.0 was picked up when you originally tried this? What was this so called "soft release"? Can you recall the state of the repository, especially tags?

straight-shoota commented 1 year ago

P.S. Apparently the version in shard.yml was only updated on March 12 as well (https://github.com/luckyframework/lucky/commit/f9647095a164c9a8d0ea287b991814cdb0f262f5), so if you had some prior commit tagged as 1.0.0, is it possible that you had the correctly tagged version, but shard.yml just didn't match that?

jwoertink commented 1 year ago

Hmm that's strange. Yeah, I did the release on March 12th, but on March 14th was when I was having the issue. I was clearing cache, removing files, and all kinds of stuff, but could not get it to pull 1.0.0-rc1 for the life of me. Oddly enough, I also can't recreate it now.... so, I'll chalk it up to Monday morning goblins in my computer at that time :upside_down_face:

Thanks for the follow up, I think we can close this out.