Skip to content

Fix shards lock to update the lockfile when all dependencies are removed - #746

Open
renich wants to merge 1 commit into
crystal-lang:masterfrom
renich:fix/lock-removed-dependencies
Open

renich wants to merge 1 commit into
crystal-lang:masterfrom
renich:fix/lock-removed-dependencies

Conversation

@renich

@renich renich commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #743

shards lock returned early when the resolver produced no packages. A stale shard.lock kept listing dependencies already removed from shard.yml, and no lockfile was written for projects without dependencies. Dropping the early return matches what shards install and shards update have done since #453: they write shards: {}.

The new updates lockfile on completely removed dependencies spec fails on master and passes with this change. I replaced the existing doesn't generate lockfile when project has no dependencies example because it pinned the old behavior. The full integration suite passes locally (217 examples, 0 failures).

…moved

`shards lock` returned early when the resolver produced no packages, so a
stale `shard.lock` kept listing dependencies that had been removed from
`shard.yml`, and no lockfile was written for projects without dependencies.
`shards install` and `shards update` already write an empty lockfile in
this case since crystal-lang#453.

Assisted-by: Gemini <gemini@google.com>
Signed-off-by: Rénich Bon Ćirić <renich@woralelandia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shards lock keeps removed dependencies in shard.lock

2 participants