Skip to content

Fix crate loading from bare relative paths - #134

Merged
lorisleiva merged 1 commit into
mainfrom
08-19-fix_crate_loading_from_bare_relative_paths
Aug 19, 2026
Merged

Fix crate loading from bare relative paths#134
lorisleiva merged 1 commit into
mainfrom
08-19-fix_crate_loading_from_bare_relative_paths

Conversation

@lorisleiva

Copy link
Copy Markdown
Member

This PR fixes CrateStore::load (and therefore codama-rs generate-idl) failing on bare single-segment relative paths such as generate-idl interface. cargo_toml's complete_from_path expects the path to the Cargo.toml file and resolves the package directory from its parent, but it was given the raw user-supplied path: a bare segment has the empty path as parent (IO NotFound), and a ./-prefixed path made autodiscovery scan the current directory instead of the crate. It now receives the canonicalised manifest path that CrateStore::load already computes, making all path spellings behave identically.

@lorisleiva
lorisleiva marked this pull request as ready for review August 19, 2026 08:58

lorisleiva commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

lorisleiva commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Aug 19, 9:01 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 19, 9:03 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 19, 9:03 AM UTC: @lorisleiva merged this pull request with Graphite.

@lorisleiva
lorisleiva changed the base branch from 08-19-propagate_optional_account_strategy_from_instruction_enums_to_their_variants to graphite-base/134 August 19, 2026 09:01
@lorisleiva
lorisleiva changed the base branch from graphite-base/134 to main August 19, 2026 09:01
This PR fixes `CrateStore::load` (and therefore `codama-rs generate-idl`) failing on bare single-segment relative paths such as `generate-idl interface`. `cargo_toml`'s `complete_from_path` expects the path to the Cargo.toml file and resolves the package directory from its parent, but it was given the raw user-supplied path: a bare segment has the empty path as parent (IO `NotFound`), and a `./`-prefixed path made autodiscovery scan the current directory instead of the crate. It now receives the canonicalised manifest path that `CrateStore::load` already computes, making all path spellings behave identically.
@lorisleiva
lorisleiva force-pushed the 08-19-fix_crate_loading_from_bare_relative_paths branch from ad5d7fc to 2f7202a Compare August 19, 2026 09:02
@lorisleiva
lorisleiva merged commit 77787a7 into main Aug 19, 2026
4 checks passed
@lorisleiva
lorisleiva deleted the 08-19-fix_crate_loading_from_bare_relative_paths branch August 27, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant