-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
I believe I’m experiencing a related issue.
My project’s shard.yml includes:
dependencies:
marten:
github: miry/marten
branch: master
pg:
github: will/crystal-pg
commit: cafe112f2847f366262460ee999e74f9c7e8b31c # unreleased 0.29.0Meanwhile, the marten project declares pg as a development dependency:
development_dependencies:
pg:
github: will/crystal-pgNOTE: There’s a difference in the commit — my project pins pg to a specific commit, while marten does not.
When I run:
$ shard update marten
...
Using pg (0.29.0 at cafe112)It seems like lib/pg is replaced with the released version from GitHub (0.29.0),
but the shard.lock file still references the specific commit (cafe112...).
Additionally, .shards.info shows a mismatch — it points to the latest release commit instead of the frozen one.
Here’s the diff:
pg:
git: https://github.com/will/crystal-pg.git
- version: 0.29.0+git.commit.cafe112f2847f366262460ee999e74f9c7e8b31c
+ version: 0.29.0Workaround
In case someone else runs into the same issue — the fix for lib/pg is simply to run:
$ shards update pgPS: To help debug this, I started adding more context to log messages: https://github.com/crystal-lang/shards/pull/674/files
Reproducing steps
- Setup a new project with marten
$ mkdir shards_pg
$ cd shards_pg
$ shards init- Update shards.yml:
name: shards_pg
version: 0.1.0
dependencies:
marten:
github: miry/marten
commit: 1a40270aec0cdaa83e0c376a428ed45f49234364 # previous commit
pg:
github: will/crystal-pg
commit: cafe112f2847f366262460ee999e74f9c7e8b31c # unreleased 0.29.0
- Install packages:
$ shards install
$ shards prune
- Verify the installed versions
$ cat shard.lock | grep pg -A 2
pg:
git: https://github.com/will/crystal-pg.git
version: 0.29.0+git.commit.cafe112f2847f366262460ee999e74f9c7e8b31c
$ head -n 5 lib/pg/CHANGELOG
v? upcoming
=====================
* Add support for `BigDecimal` via `PG::Numeric#to_big_d` (thanks @jgaskins)
* ~2x to ~10x+ speedup when sending large query parameters (thanks @compumike)
* Add support for COPY (thanks @17dec)
marten:
$ cat shard.lock | grep marten -A 2
marten:
git: https://github.com/miry/marten.git
version: 0.5.6+git.commit.1a40270aec0cdaa83e0c376a428ed45f49234364
- Update shards.yml: Remove the marten pin commit to trigger update
name: shards_pg
version: 0.1.0
dependencies:
marten:
github: miry/marten
pg:
github: will/crystal-pg
commit: cafe112f2847f366262460ee999e74f9c7e8b31c # unreleased 0.29.0
and run update command:
$ shards update marten
Resolving dependencies
Fetching https://github.com/miry/marten.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/crystal-i18n/i18n.git
Fetching https://github.com/crystal-community/msgpack-crystal.git
Using db (0.13.1)
Using i18n (0.2.2)
Using msgpack (1.3.4)
Installing marten (0.5.6 at 469058f)
Using pg (0.29.0 at cafe112)
Postinstall of marten: scripts/precompile_marten_cli
Writing shard.lock
- Verify the package pg version and state:
$ head -n 5 lib/pg/CHANGELOG
v? upcoming
=====================
v0.29.0 2024-11-05
=====================
$ cat shard.lock | grep pg -A 2
pg:
git: https://github.com/will/crystal-pg.git
version: 0.29.0+git.commit.cafe112f2847f366262460ee999e74f9c7e8b31c
As you see the lib/pg/CHANGELOG was changed, but version in the lock file still the same.