Skip to content

Fix shards outdated for path dependencies - #747

Open
Epikest wants to merge 1 commit into
crystal-lang:masterfrom
Epikest:fix/outdated-path-dependencies
Open

Epikest wants to merge 1 commit into
crystal-lang:masterfrom
Epikest:fix/outdated-path-dependencies

Conversation

@Epikest

@Epikest Epikest commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes #625.

shards outdated calls latest_version_for_ref on every dependency's resolver (src/commands/outdated.cr:70). PathResolver inherited the base implementation, which raises Unsupported ref type for this resolver even for the default (nil) ref, so any project with a path dependency crashed on the command. Shards 0.20.0 still does, as does master.

A path has exactly one version, the one in its shard.yml, so PathResolver#latest_version_for_ref now returns that for the nil ref and still raises through super for any other ref, which a path source cannot have.

Two integration specs: a path dependency that is up to date, and one whose shard.yml version was bumped after shards install, which reports installed: 0.1.0 at <path>, available: 0.2.0 at <path>. Both raise the exception above without the fix. spec/integration/outdated_spec.cr (27 examples) and spec/unit/ (92, without the fossil and hg tags) pass on Windows 11 with Crystal 1.22.2.

🤖 Generated with Claude Code

`shards outdated` calls `latest_version_for_ref` on every dependency's
resolver, and `PathResolver` inherited the base implementation, which
raises "Unsupported ref type for this resolver" even for the default
(nil) ref. Any project with a path dependency crashed on the command.

A path has exactly one version, the one in its shard.yml, so the
resolver now returns that for the nil ref and keeps raising for others.

Fixes crystal-lang#625

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Comment thread src/resolvers/path.cr
Comment on lines +27 to +28
# A path has exactly one version, the one in its shard.yml, so that is the
# latest for the default (nil) ref. Path sources have no other refs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This comment seems imprecise. The fact that there is only one version is irrelevant here (because the question of outdated is whether the installed version is the latest).
The significant detail is in the last sentence: Path resolvers have no branches, so the Ref parameter cannot be anything other than the default (which is encoded as nil).

Suggested change
# A path has exactly one version, the one in its shard.yml, so that is the
# latest for the default (nil) ref. Path sources have no other refs.
# A path resolver has no branches, so we can only serve the latest version for the default ref (i.e. `nil`).

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 outdated - Unsupported ref type for this resolver

2 participants