Skip to content

Explicitly declare directly used dependency features#3594

Merged
itowlson merged 1 commit into
spinframework:mainfrom
ChihweiLHBird:zhiwei/features-tidy-up
Jul 1, 2026
Merged

Explicitly declare directly used dependency features#3594
itowlson merged 1 commit into
spinframework:mainfrom
ChihweiLHBird:zhiwei/features-tidy-up

Conversation

@ChihweiLHBird

Copy link
Copy Markdown
Contributor

Summary

This PR makes dependency feature declarations match the APIs Spin uses directly, instead of relying on those features being enabled by other crates in the dependency graph.

It also narrows a few existing Tokio declarations so production dependencies only carry the features used by production code, with test-only runtime features moved to dev-dependencies.

It may be helpful to prevent future confusion like this.

Fully resolve this kind of issue requires work on the Cargo side: rust-lang/cargo#14375

Direct feature usage

Notes

  • spin-dependency-wit, spin-key-value-spin, spin-llm-local, and spin-factor-outbound-mysql
    were narrowed where the previous declaration was broader than direct source usage required.
  • Test-only Tokio runtime support is declared as dev-dependencies where possible.

Test commands

cargo check -p spin-dependency-wit -p spin-environments -p spin-factor-outbound-http \
  -p spin-factor-outbound-mysql -p spin-factor-variables -p spin-key-value-spin \
  -p spin-llm-local -p spin-oci -p spin-runtime-config -p spin-trigger --tests
cargo check -p spin-cli --test integration

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
@ChihweiLHBird ChihweiLHBird force-pushed the zhiwei/features-tidy-up branch from 81d3cf0 to 05b25f2 Compare July 1, 2026 10:47
@itowlson

itowlson commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Does the test work? I tried running cargo check -p on a couple of these packages in main, and it didn't report any problems, so I am not sure that it will pick up missing features. If it does work, then we should add it to CI, because otherwise, these sorts of misalignments will just creep back.

@ChihweiLHBird

Copy link
Copy Markdown
Contributor Author

Hi @itowlson, that command is mostly for checking whether this PR broke dependencies. Currently, without Cargo work, there isn't a way to check whether the features used in spin code are explicitly declared in Cargo.toml in the current main branch.

@itowlson itowlson merged commit 3e5adda into spinframework:main Jul 1, 2026
17 checks passed
@ChihweiLHBird ChihweiLHBird deleted the zhiwei/features-tidy-up branch July 1, 2026 20:57
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.

2 participants