-
-
Notifications
You must be signed in to change notification settings - Fork 14
Bump Cargo workspace root dependency requirements #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jbolda
merged 11 commits into
jbolda:main
from
johncarmack1984:rust-workspace-root-deps
Jul 30, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c64ea1b
Bump workspace root dependency requirements
johncarmack1984 97d6ef2
Support pnpm catalog dependencies
johncarmack1984 883b92f
Skip comparator and wildcard ranges in workspace root bumps
johncarmack1984 d493fdc
Drop pnpm catalog table bumping
johncarmack1984 c4134fb
Assert the untouched pnpm workspace manifest against its checked-out …
johncarmack1984 bdeb3ae
Stop the workspace root walk at dirname's fixed point
johncarmack1984 9f616e6
Read the version off [workspace.package] when a manifest inherits it
johncarmack1984 4b43c3f
Cover exact pins and multiple workspace roots in the root bump tests
johncarmack1984 eddb5be
Skip target table dependencies declared without a version
johncarmack1984 2c03b06
Share the requirement rewrite between root and member dependency bumps
johncarmack1984 b59db83
Leave range and wildcard requirements alone when bumping dependencies
johncarmack1984 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@covector/apply": minor | ||
| --- | ||
|
|
||
| `catalog:` references in package.json are left untouched during dependency bumps: pnpm rewrites them at publish time from the catalog tables in pnpm-workspace.yaml, and previously they were corrupted to a bare major version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@covector/apply": patch | ||
| --- | ||
|
|
||
| Leave a dependency requirement that spans a range or floats alone instead of collapsing it onto the bumped version. A comparator range (`>=1.0 <2`), a wildcard (`1.x`), and `*` already cover the bumped version, and were previously narrowed to a single pin — `">=1.0 <2"` became `"=1.1"`. This covers requirements written behind the pnpm workspace protocol prefix (`workspace:1.x`) as well as plain ones. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@covector/apply": patch | ||
| --- | ||
|
|
||
| Skip dependencies declared without a version of their own in a cargo `[target]` table, such as `{ workspace = true }` or a path-only entry. Bumping a package that another crate depends on through a target table previously threw. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@covector/files": patch | ||
| --- | ||
|
|
||
| Read the version off `[workspace.package]` when a Cargo manifest inherits it, matching the existing write support. Applying a bump to a crate whose version is declared at the workspace root previously left the manifest unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@covector/apply": minor | ||
| "@covector/files": minor | ||
| --- | ||
|
|
||
| Bump version requirements for member crates declared in a cargo workspace root manifest's `[workspace.dependencies]` table. Requirements keep their form (partial pins stay partial, range prefixes are preserved), while path-only entries, `*` requirements, and comparator or wildcard ranges (`>=1.2, <2`, `1.*`) are left untouched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "private": true, | ||
| "name": "js-pnpm-catalog", | ||
| "description": "workspace with pnpm catalogs", | ||
| "version": "1.0.0" | ||
| } |
11 changes: 11 additions & 0 deletions
11
__fixtures__/pkg.js-pnpm-catalog/packages/pkg-a/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "js-catalog-pkg-a", | ||
| "version": "1.0.0", | ||
| "dependencies": { | ||
| "react": "catalog:", | ||
| "js-catalog-pkg-b": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "js-catalog-pkg-c": "catalog:tools" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "js-catalog-pkg-b", | ||
| "version": "1.0.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "js-catalog-pkg-c", | ||
| "version": "1.0.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| packages: | ||
| - "packages/*" | ||
|
|
||
| # internal packages pinned here | ||
| catalog: | ||
| react: ^18.2.0 | ||
| js-catalog-pkg-b: ^1.0.0 | ||
|
|
||
| catalogs: | ||
| tools: | ||
| js-catalog-pkg-c: "1.0" |
10 changes: 10 additions & 0 deletions
10
__fixtures__/pkg.js-pnpm-workspace/packages/pkg-d/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "name": "pnpm-workspace-pkg-d", | ||
| "version": "1.0.0", | ||
| "dependencies": { | ||
| "pnpm-workspace-pkg-b": "workspace:1.x" | ||
| }, | ||
| "devDependencies": { | ||
| "pnpm-workspace-pkg-c": "workspace:>=1.0 <2" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "private": true, | ||
| "name": "js-range-deps", | ||
| "description": "workspace", | ||
| "version": "1.0.0", | ||
| "workspaces": [ | ||
| "packages/*" | ||
| ] | ||
| } |
11 changes: 11 additions & 0 deletions
11
__fixtures__/pkg.js-range-deps/packages/pkg-a/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "range-deps-pkg-a", | ||
| "version": "1.0.0", | ||
| "dependencies": { | ||
| "range-deps-pkg-b": ">=1.0 <2", | ||
| "range-deps-pkg-c": "*" | ||
| }, | ||
| "devDependencies": { | ||
| "range-deps-pkg-d": "1.x" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "range-deps-pkg-b", | ||
| "version": "1.0.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "range-deps-pkg-c", | ||
| "version": "1.0.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "range-deps-pkg-d", | ||
| "version": "1.0.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_single_nested_fixture" | ||
| version = "0.5.0" |
9 changes: 9 additions & 0 deletions
9
__fixtures__/pkg.rust-workspace-root-deps-inherited/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [workspace] | ||
| members = ["pkg-a", "pkg-b"] | ||
|
|
||
| [workspace.package] | ||
| version = "1.2.3" | ||
|
|
||
| [workspace.dependencies] | ||
| rust_root_inherited_fixture = { version = "1.2", path = "pkg-a" } | ||
| rust_root_inherited_helper_fixture = { path = "pkg-b", default-features = false } |
6 changes: 6 additions & 0 deletions
6
__fixtures__/pkg.rust-workspace-root-deps-inherited/pkg-a/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "rust_root_inherited_fixture" | ||
| version.workspace = true | ||
|
|
||
| [dependencies] | ||
| rust_root_inherited_helper_fixture = { workspace = true } |
3 changes: 3 additions & 0 deletions
3
__fixtures__/pkg.rust-workspace-root-deps-inherited/pkg-b/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_inherited_helper_fixture" | ||
| version.workspace = true |
6 changes: 6 additions & 0 deletions
6
__fixtures__/pkg.rust-workspace-root-deps-multi/core/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["pkg-a", "pkg-b"] | ||
|
|
||
| [workspace.dependencies] | ||
| serde = "1.0" | ||
| rust_multi_root_pkg_a_fixture = { version = "0.5", path = "pkg-a" } |
3 changes: 3 additions & 0 deletions
3
__fixtures__/pkg.rust-workspace-root-deps-multi/core/pkg-a/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_multi_root_pkg_a_fixture" | ||
| version = "0.5.0" |
3 changes: 3 additions & 0 deletions
3
__fixtures__/pkg.rust-workspace-root-deps-multi/core/pkg-b/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_multi_root_pkg_b_fixture" | ||
| version = "0.2.0" |
6 changes: 6 additions & 0 deletions
6
__fixtures__/pkg.rust-workspace-root-deps-multi/tools/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["pkg-c"] | ||
|
|
||
| [workspace.dependencies] | ||
| rust_multi_root_pkg_a_fixture = { version = "^0.5", path = "../core/pkg-a" } | ||
| rust_multi_root_pkg_c_fixture = { version = "1.0", path = "pkg-c" } |
6 changes: 6 additions & 0 deletions
6
__fixtures__/pkg.rust-workspace-root-deps-multi/tools/pkg-c/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "rust_multi_root_pkg_c_fixture" | ||
| version = "1.0.0" | ||
|
|
||
| [dependencies] | ||
| rust_multi_root_pkg_a_fixture = { workspace = true } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [workspace] | ||
| members = ["pkg-a", "pkg-b", "pkg-c", "pkg-d", "pkg-e", "pkg-f", "pkg-g"] | ||
|
|
||
| [workspace.dependencies] | ||
| serde = "1.0" | ||
| rust_root_pkg_a_fixture = { version = "0.5", path = "pkg-a", default-features = false } | ||
| rust_root_pkg_b_fixture = "^0.8.0" | ||
| rust_root_pkg_c_fixture = { path = "pkg-c", version = "*" } | ||
| rust_root_pkg_d_fixture = { path = "pkg-d" } | ||
| rust_root_pkg_e_fixture = ">=0.2, <0.4" | ||
| rust_root_pkg_f_fixture = "0.*" | ||
| rust_root_pkg_g_fixture = "=0.5" |
14 changes: 14 additions & 0 deletions
14
__fixtures__/pkg.rust-workspace-root-deps/pkg-a/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [package] | ||
| name = "rust_root_pkg_a_fixture" | ||
| version = "0.5.0" | ||
|
|
||
| [dependencies] | ||
| serde = { workspace = true } | ||
| rust_root_pkg_b_fixture = { workspace = true } | ||
| rust_root_pkg_c_fixture = { workspace = true } | ||
|
|
||
| [dev-dependencies] | ||
| rust_root_pkg_d_fixture = { workspace = true } | ||
|
|
||
| [target."cfg(windows)".dependencies] | ||
| rust_root_pkg_g_fixture = { workspace = true } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_b_fixture" | ||
| version = "0.8.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_c_fixture" | ||
| version = "0.3.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_d_fixture" | ||
| version = "0.2.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_e_fixture" | ||
| version = "0.2.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_f_fixture" | ||
| version = "0.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [package] | ||
| name = "rust_root_pkg_g_fixture" | ||
| version = "0.5.0" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this meant the situation where you set the version at the root, would this be like
version.workspace = "true"? Have we tested for this versus the version specified here and just a path / features in the root? (Guess that is probably the normal case)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hadn't tested it, and writing the test caught a real bug, so good call. With
version.workspace = truethe covector package points at the root manifest and its version lives at[workspace.package]. The new requirement bump derived fine, but the version bump itself silently never landed:getPackageFileVersionwas missing the[workspace.package]fallback thatsetPackageFileVersionalready has, so the read came back empty and the manifest was written back with the old version while[workspace.dependencies]moved to the new requirement. Fixed the read to mirror the write, and added a fixture + apply test for the inherited arrangement: the root ends up with both the bumped[workspace.package]version and the bumped requirement, the path-and-features-only entry stays byte-identical, and the member manifests keep their checked-out bytes. (Your guess on the normal case is right: an entry with just a path and features has no version to bump and is left alone; that's pkg-d in the existing fixture and the helper entry in the new one.)