build: inherit the workspace version in bugwarden-core - #57
Merged
Conversation
Every other shared field of this manifest already inherits — edition, rust-version, license, authors, repository, homepage — and the binary crate inherits its version too. `bugwarden-core` alone carried a literal, so the workspace version had two sources of truth and no rule keeping them equal. The two are the same today and a bump has always moved both by hand, so nothing is broken. What the literal costs is the failure mode when that hand-edit is missed: the release job publishes the crate at its old version, takes its own already-published branch, and the binary crate then resolves against the previous core. Local builds stay green and nothing says a word — unlike the dependency requirement in `crates/bugwarden/Cargo.toml`, whose own literal cannot drift silently, because cargo refuses to resolve a path dependency the requirement does not admit. No version changes here. `Cargo.lock` is untouched, and `cargo package` normalises the field to a literal in the published manifest, so a distro building from the `.crate` with no workspace root present reads exactly what it read before.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
crates/bugwarden-core/Cargo.tomlcarriedversion = "0.3.0"as a literal while every other shared field of that manifest —edition,rust-version,license,authors,repository,homepage— already inherits, and the binary crate inherits its version too. Now it inherits as well.Why
The workspace version had two sources of truth with nothing keeping them equal. They agree today and
chore: bump version to 0.3.0moved both by hand, so nothing is broken — the cost is the failure mode when that hand-edit is missed.The two literals fail differently, which is the point:
crates/bugwarden/Cargo.toml(bugwarden-core = { path = "…", version = "0.3.0" }) cannot drift silently — cargo refuses to resolve a path dependency whose version does not satisfy the requirement, so a missed bump breaks the first local build.bugwarden-core's own version can. Local builds stay green; the release job publishes the crate at its old version, takes its own "already published, skipping" branch, and the binary crate then resolves against the previous core. Nothing says a word, and only on the release path.This removes the silent one. The loud one is left alone deliberately: cargo has no way to express "the workspace version" in a dependency requirement, and a failure that stops the first build needs no guard.
Verification
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --all-targets --locked,cargo deny check,typos.cargo metadatareports both crates at0.3.0, unchanged, andCargo.lockis untouched.cargo package -p bugwarden-coresucceeds and normalises the field back to a literalversion = "0.3.0"in the published manifest — so a distro building from the.crate, with no workspace root present, reads exactly what it read before.