build(rust): Manage crate dependency versions centrally through the Cargo workspace; Upgrade Rust dependencies to their latest compatible versions. - #2471
Conversation
WalkthroughThe workspace now centralizes package metadata and dependency declarations. Component manifests inherit these settings while retaining required features. Partition tests now assert task input state before and after flushing. ChangesWorkspace dependency centralization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
LinZhihao-723
left a comment
There was a problem hiding this comment.
This PR should fix the failing linting by upgrading async-trait to the latest release: https://github.com/dtolnay/async-trait/releases/tag/0.1.92
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Cargo.toml`:
- Around line 16-64: Update the dependency declarations in Cargo.toml to use
exact =version requirements for all registry dependencies currently expressed
with compatible ranges, and replace the Spider Git dependencies’ branch = "main"
selectors with explicit rev values for the intended commits. Keep the existing
dependency set and feature configuration unchanged while ensuring cargo update
cannot select newer compatible releases or branch commits.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 96e0e258-1d66-4d5a-b7a5-74577b1efa56
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
Cargo.tomlcomponents/api-server/Cargo.tomlcomponents/clp-rust-utils/Cargo.tomlcomponents/clp-tdl-package/Cargo.tomlcomponents/compression-coordinator/Cargo.tomlcomponents/compression-coordinator/src/partition.rscomponents/log-ingestor/Cargo.toml
There was a problem hiding this comment.
Nit: "No Rust source file is modified by this PR" — but partition.rs is modified. Suggested:
One Rust source file is modified:
partition.rs, where three assertions are rewritten byclippy::assert_is_empty's autofix, whichmainneeds regardless of this PR. Everything else is confined to manifests andCargo.lock.
Description
This PR introduces workspace-level dependency and package inheritance so that every external crate is declared exactly once, in the root
Cargo.toml, instead of being pinned independently in each of the five member manifests. Before this change a version bump was an N-file edit, and several crates had already drifted apart across members:tokiowas simultaneously1.49.0and1.52.3,clapwas4.5.56and4.6.4,tracingwas0.1and0.1.44, andtracing-subscriberwas0.3.22and0.3.23. All drift is resolved, and every dependency is aligned to the newest semver-compatible release.No Rust source file is modified by this PR — it is confined to manifests and
Cargo.lock. This holds even for the two dependency majors taken below.All five members additionally move from a repeated
version = "0.13.1-dev"/edition = "2024"to workspace inheritance. The value is unchanged, sotools/deployment/package-helm/Chart.yaml,taskfile.yaml, and the Python components stay in sync without an edit.Workspace inheritance (root
Cargo.toml)[workspace.package]holding the two fields every member repeated identically:version = "0.13.1-dev"andedition = "2024".[workspace.dependencies]with 45 external crates, the three Spider git dependencies, and theclp-rust-utilspath dependency.clp-rust-utilsis now referenced by name rather than by{ path = "../clp-rust-utils" }in each of the four members that depend on it.resolverandmembersare unchanged.Member manifests (5 crates)
[package]now usesversion = { workspace = true }andedition = { workspace = true }.[dependencies]and[dev-dependencies]becomes{ workspace = true }. Members retain only the features they need in addition to what the workspace entry already provides, so the common case collapses to a single bare inheritance.{ workspace = true }inline-table form is used throughout rather than the dotteddep.workspace = trueform.Features that remain member-local, because hoisting them would enable a feature in a member that did not declare it:
sqlxchronoapi-serversqlx/chrono, so hoisting would pull thechronocrate into the four members that don't use it.utoipaaxum_extrasapi-server,log-ingestoraxum_extrasactivatesdep:axum;clp-rust-utilshas no axum dependency and would grow one on a standalone build.strumderiveclp-rust-utilslog-ingestordepends onstrum_macrosdirectly and doesn't needstrum/derive.opentelemetry-otlpreqwest-blocking-clientclp-rust-utilstokiofull/fs/net/macros/signal["rt-multi-thread", "time"]; hoistingfullwould give three membersprocess/io-util/net/fson standalone builds.default-features = falsemoves up to the workspaceopentelemetry-otlpis the only crate declared withdefault-features = falsein a member, and bothapi-serverandclp-rust-utilsdid so. Cargo silently ignores a member'sdefault-features = falsewhen the workspace entry leaves defaults enabled, so this key now lives on the workspace entry instead; leaving it in the members would have quietly re-enabled default features. No member declaresdefault-featuresany more.Dependency version alignment
Aligned to the newest compatible release
Where a crate had drifted, the drifted requirements are listed together in "Before".
anyhow1.0.1001.0.104async-trait0.1.890.1.920.1.90aws-config1.8.121.10.1aws-sdk-s31.121.01.141.0aws-sdk-sqs1.92.01.105.0axum0.8.80.8.9brotli8.0.28.0.4chrono0.40.4.45clap4.5.56,4.6.44.6.6const_format0.2.350.2.36futures0.3.310.3.33http-body-util0.10.1.4mongodb3.5.03.8.0num_enum0.7.50.7.6pin-project-lite0.2.160.2.17regex1.12.31.13.1serde1.0.2281.0.229serde_json1.0.1491.0.151serial_test3.3.14.0.1thiserror2.0.182.0.20tokio1.49.0,1.52.31.53.1tokio-util0.7.180.7.19tower0.50.5.3tower-http0.6.80.7.0tracing0.1,0.1.440.1.44tracing-appender0.2.40.2.5tracing-subscriber0.3.22,0.3.230.3.23utoipa5.4.05.5.0uuid1.20.01.24.0Already newest and unchanged:
async-stream0.3.6,hex0.4.3,non-empty-string0.2.6,opentelemetryandopentelemetry-otlp0.32.0,opentelemetry_sdk0.32.1,rmp-serde1.3.1,secrecy0.10.3,strsim0.11.1,strumandstrum_macros0.28.0,tonic0.14.6,url2.5.8,utoipa-axum0.2.0,yaml_serde0.10.4.Every entry in
[workspace.dependencies]is now patch-exact, per the repository convention.chrono,tracing,tower, andhttp-body-utilpreviously named no patch version, and those four pre-existing deviations are corrected here.Breaking majors taken
Both require zero source changes, verified by
cargo check --workspace --all-targetsandcargo clippy --workspace --all-targets -- -D warnings.tower-http0.6.8→0.7.0. CLP's entire use of the crate isuse tower_http::cors::{Any, CorsLayer}plusCorsLayer::new().allow_origin(Any)inapi-server/src/routes.rsandlog-ingestor/src/routes.rs. Every item on 0.7.0's breaking list lands incompression(RFC 9110*/identity;q=0handling,SizeAbovewidenedu16→u64),follow-redirect(requestExtensionsnow forwarded across hops),trace/classify(GrpcCodeandGrpcFailureClassbecome#[non_exhaustive]),fs/services(trailing-slash paths now 404), or the removed no-optokio/async-compressionfeatures — none of which CLP references. Thecorspublic API is unchanged, and 0.7.0 does not bump itshttpmajor (its manifest still declareshttp = "1.0",tower-layer = "0.3.3", andtower-service = "0.3"), so it stays compatible withaxum0.8.9 andtonic0.14.6, both of which resolve tohttp1.4.0.One client-observable change is worth calling out: 0.7.0 relaxes the CORS
Varydefault ([tower-rs/tower-http#674]), so a wildcard configuration like ours stops emittingVary: origin, access-control-request-method, access-control-request-headers. This is spec-correct and cache-safe — a wildcard response genuinely doesn't vary per request — but it is a real change to the API server's response headers.Note that
reqwest0.13.4, reached viaopentelemetry-otlp→opentelemetry-http, pinstower-http ^0.6.8for itsfollow-redirectfeature, sotower-http0.6.10 remains in the lock as a second compiled copy. The repository has no duplicate-crate lint, so this is cosmetic.serial_test3.3.1→4.0.1, a dev-dependency oflog-ingestoronly. The!-marked change in 4.0.0 isrefactor(derive)!: bump syn to v3, which is internal to the proc-macro crate: the fullv3.5.0...v4.0.1compare touches onlyci.yml,Cargo.lock, fourCargo.tomlfiles,README.md, and two lines insidemod testsinserial_test_derive/src/lib.rs.serial_test/src/has zero changes, so the#[serial]attribute surface CLP uses is untouched. 4.0.1 (rather than 4.0.0, which was yanked) raises the MSRV to 1.93.1; the repository pins no toolchain and CI uses the runner's stable. As a bonus, this dropssccandsddfrom the lock.Breaking major available, deliberately not taken
sqlx0.8.60.9.0sqlxis a hard block rather than a soft deferral.spider-corepinssqlx0.8.6 and implementssqlx::Type,Encode, andDecodefor itsId<T>against 0.8'sMySql, andcompression-coordinator'scoordination.rsdecodes aSpiderJobIdthrough#[derive(sqlx::FromRow)]. Because 0.9 is a semver-major for a0.xcrate, taking it would put two incompatiblesqlxcopies in the graph and turn that derive into a compile error, not merely a duplicate crate. Independently, 0.9 narrowsquery*()toimpl SqlSafeStr, which would requireAssertSqlSafe(..)at the sites that build SQL withformat!, and it removes the lifetime parameter fromArgumentBuffer. This can only move after [y-scope/spider] does.Notes
cargo metadata --filter-platform x86_64-unknown-linux-gnubetween a pristine checkout and this branch, the centralization itself produces zero resolved-feature changes, both workspace-wide and per member. Eight packages differ at the same version, and all eight trace to version bumps rather than to the migration:crypto-bigint,generic-array,getrandom,ipnet,num-traits, andsyngain features transitively;tower-http0.6.10 losescorsbecause that moved to the new 0.7.0 copy; andmd-50.10.6 losesdefault/stdpurely becausemongodb3.8 moved tomd-50.11, leavingsqlx-mysqlandsqlx-postgres— which both ask fordefault-features = false— as its only consumers. No package loses a capability it requested.secrecy/serdeinapi-server,compression-coordinator, andlog-ingestor;non-empty-string/serdeincompression-coordinator; andtracing-subscriber/fmt,stdinclp-tdl-package. All five are no-ops in the resolved graph, because every member depends onclp-rust-utils, which already enabled each of them. This is inherent to Cargo's feature unioning; avoiding it would mean removing the feature from the workspace entry and repeating it in the majority of members.Cargo.lockgrows from 514 to 529 entries, but onx86_64-unknown-linux-gnuthe compiled set moves from 431 to 434, a net of +3. Nine crates are added (arc-swap,aws-smithy-schema,chacha20,hickory-net,prefix-trie,primeorder,rand0.10,rand_core0.10, andtower-http0.7) and six stop compiling (enum-as-inner, plus the stale duplicatescrypto-bigint0.4.9,der0.6.1,pkcs80.9.0,signature1.6.4, andspki0.6.0, all collapsed onto copies already present). The remaining new lock entries —jniand friends,walkdir,system-configuration,winapi-util— arrive undermongodb3.8's newhickory-*DNS stack and are Android-, Apple-, or Windows-gated, so none of them builds on the platform CLP ships.aws-config1.10.1 changes the identity-cacheload_timeoutfrom a hardcoded 5s to a value derived fromRetryConfig(roughly 22s). CLP configures noIdentityCacheorTimeoutConfig, so credential resolution against a slow or unreachable STS/IMDS endpoint can now block longer before failing. This is behavior-only; an explicitload_timeoutcan be set in a follow-up if the longer wait is undesirable.regex1.13.1 fixes a reverse-suffix offset bug present in 1.12.3, so that bump is a correctness improvement rather than only a version alignment.utoipa5.4.0 → 5.5.0 produces byte-identical output: re-runningtask codegen:openapileavesdocs/src/_static/generated/api-server-openapi.jsonanddocs/src/_static/generated/log-ingestor-openapi.jsonunchanged.Checklist
breaking change.
Validation performed
Summary by CodeRabbit