Skip to content

fix(cargo): honor package = "..." rename when resolving internal deps (#1858)#1861

Open
thejesh23 wants to merge 1 commit into
Graphify-Labs:v8from
thejesh23:fix/1858-cargo-package-rename
Open

fix(cargo): honor package = "..." rename when resolving internal deps (#1858)#1861
thejesh23 wants to merge 1 commit into
Graphify-Labs:v8from
thejesh23:fix/1858-cargo-package-rename

Conversation

@thejesh23

Copy link
Copy Markdown

Summary

  • Reads each [dependencies] table entry as (dep_key, spec) and, when spec is an inline table with a package = "..." field, uses the override as the lookup key into crates. Without this, every renamed workspace-internal dep silently dropped its crate_depends_on edge — the crate node still existed, but the edge to it did not.
  • Cargo's rename mechanism is common in monorepos that want short local names (db, mq, auth) without colliding with crates.io, and in workspaces that vendor two versions of the same crate under different local aliases. Docs: The Cargo Book → Specifying dependencies → Renaming dependencies in Cargo.toml.
  • Adds two regression tests in tests/test_cargo_introspect.py:
    • test_cargo_introspect_honors_package_rename_on_internal_depdb = { path = "../storage", package = "internal-storage" } now produces the crate:app → crate:internal-storage edge.
    • test_cargo_introspect_package_rename_falls_through_when_unresolved — a rename pointing at an external crate (tokio_rt = { version = "1", package = "tokio" }) still produces no edge, so the fix doesn't invent edges to registry crates.

Closes #1858.

Test plan

  • uv run --frozen pytest tests/test_cargo_introspect.py -v → 8 passed (up from 6).
  • uv run --frozen pytest tests/ -q → 3195 passed, 3 skipped.
  • uv run --frozen pre-commit run --files graphify/cargo_introspect.py tests/test_cargo_introspect.py → skillgen + ruff green.

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.

--cargo drops workspace-internal dep edges that use Cargo's package = "..." rename

1 participant