From 86935b4117672f2edfeeb342388934382980b5eb Mon Sep 17 00:00:00 2001 From: Assaf Vayner Date: Tue, 31 Mar 2026 13:31:20 -0700 Subject: [PATCH] Move test-only deps to dev-dependencies in git_xet (#767) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Move `russh`, `rand_core`, and `tempfile` from regular dependencies to dev-dependencies in `git_xet`, since they are only used in test code - `russh` and `rand_core` are also declared as optional regular deps activated by the `git-xet-for-integration-test` feature flag, since the integration test SSH server is compiled into the library under that feature - Gate `test_utils/ssh_server` module and related exports behind `#[cfg(any(test, feature = "git-xet-for-integration-test"))]` - Gate `tests/test_ssh.rs` integration test file behind `#![cfg(feature = "git-xet-for-integration-test")]` ## Test plan - [x] `cargo check -p git_xet` passes (no features) - [x] `cargo test -p git_xet --no-run` passes (no features) - [x] `cargo test -p git_xet --features git-xet-for-integration-test --no-run` passes --- > [!NOTE] > **Low Risk** > Low risk: primarily Cargo dependency/feature and `cfg` gating changes, with no production logic changes; risk is limited to build/test configuration and feature-flagged integration test coverage. > > **Overview** > **Reduces default build dependencies for `git_xet`.** Moves `russh`, `rand_core`, and `tempfile` into `dev-dependencies`, and keeps `russh`/`rand_core` available as *optional* deps enabled only by the `git-xet-for-integration-test` feature. > > **Gates SSH test helpers and integration tests behind a feature flag.** Exposes `GitLFSAuthenticateResponse*` and the local SSH test server only under `#[cfg(test)]` or `feature = "git-xet-for-integration-test"`, and makes `tests/test_ssh.rs` compile only when that feature is enabled. > > Separately, cleans up workspace manifests/lockfiles by moving some crates (`half`, `regex`, `futures-util`) to dev-deps where they’re only needed for tests/benches, and adds `.worktrees/` to `.gitignore`. > > Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit cdc30a5a8f7d4a5f5bdaacf629b11dbbddc0167f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot). --- .gitignore | 1 + git_xet/Cargo.toml | 10 ++++++---- git_xet/src/auth.rs | 1 + git_xet/src/test_utils/mod.rs | 7 ++++++- git_xet/tests/test_ssh.rs | 1 + hf_xet/Cargo.lock | 21 --------------------- wasm/hf_xet_thin_wasm/Cargo.lock | 21 --------------------- xet_core_structures/Cargo.toml | 3 +-- xet_data/Cargo.toml | 2 +- xet_runtime/Cargo.toml | 2 +- 10 files changed, 18 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 2bac7f00..f9631f80 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ debug/ !.vscode/settings.json venv **/*.env +.worktrees/ diff --git a/git_xet/Cargo.toml b/git_xet/Cargo.toml index d24dddd9..92c9dfca 100644 --- a/git_xet/Cargo.toml +++ b/git_xet/Cargo.toml @@ -20,24 +20,26 @@ clap = { workspace = true } git-url-parse = { workspace = true } git2 = { workspace = true } http = { workspace = true } -rand_core = { workspace = true } +rand_core = { workspace = true, optional = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } -russh = { workspace = true } rust-netrc = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } shell-words = { workspace = true } -tempfile = { workspace = true } +russh = { workspace = true, optional = true } thiserror = { workspace = true } tokio = { workspace = true } [dev-dependencies] +rand_core = { workspace = true } +russh = { workspace = true } serial_test = { workspace = true } +tempfile = { workspace = true } [features] smoke-test = [] -git-xet-for-integration-test = [] +git-xet-for-integration-test = ["russh", "rand_core"] git2-vendored-openssl = ["git2/vendored-openssl"] simulation = ["xet-data/simulation", "xet-client/simulation", "xet-pkg/simulation"] diff --git a/git_xet/src/auth.rs b/git_xet/src/auth.rs index 92de1d2b..d7abc1f9 100644 --- a/git_xet/src/auth.rs +++ b/git_xet/src/auth.rs @@ -14,6 +14,7 @@ mod ssh; use git::GitCredentialHelper; use ssh::SSHCredentialHelper; +#[cfg(any(test, feature = "git-xet-for-integration-test"))] pub use ssh::{GitLFSAuthentationResponseHeader, GitLFSAuthenticateResponse}; // This mod derives credentials for the Xet CAS token API on HF Hub from the local repository's credentials. diff --git a/git_xet/src/test_utils/mod.rs b/git_xet/src/test_utils/mod.rs index d163cbeb..69787252 100644 --- a/git_xet/src/test_utils/mod.rs +++ b/git_xet/src/test_utils/mod.rs @@ -1,9 +1,14 @@ +#[cfg(any(test, feature = "git-xet-for-integration-test"))] mod ssh_server; mod temp_home; mod test_repo; -pub use ssh_server::{GitLFSAuthenticateResponse, start_local_ssh_server}; +#[cfg(any(test, feature = "git-xet-for-integration-test"))] +pub use ssh_server::start_local_ssh_server; #[cfg(test)] pub use temp_home::TempHome; #[cfg(test)] pub use test_repo::TestRepo; + +#[cfg(any(test, feature = "git-xet-for-integration-test"))] +pub use crate::auth::{GitLFSAuthentationResponseHeader, GitLFSAuthenticateResponse}; diff --git a/git_xet/tests/test_ssh.rs b/git_xet/tests/test_ssh.rs index 86d33005..61791cf4 100644 --- a/git_xet/tests/test_ssh.rs +++ b/git_xet/tests/test_ssh.rs @@ -1,3 +1,4 @@ +#![cfg(feature = "git-xet-for-integration-test")] //! Integration tests for verifying access to POSIX utility commands when running programs //! through `git-xet` (invoked via `git-lfs` and `git`). These tests focus on the behaviour on //! Windows where "Git for Windows" ships a MinGW/MSYS environment containing common POSIX diff --git a/hf_xet/Cargo.lock b/hf_xet/Cargo.lock index b0e371ab..f3a0666e 100644 --- a/hf_xet/Cargo.lock +++ b/hf_xet/Cargo.lock @@ -601,12 +601,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - [[package]] name = "crypto-common" version = "0.1.7" @@ -1067,17 +1061,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "cfg-if 1.0.4", - "crunchy", - "zerocopy", -] - [[package]] name = "hashbrown" version = "0.15.5" @@ -4419,7 +4402,6 @@ version = "1.4.0" dependencies = [ "async-trait", "base64 0.22.1", - "bincode", "blake3", "bytemuck", "bytes", @@ -4429,7 +4411,6 @@ dependencies = [ "futures", "futures-util", "getrandom 0.4.2", - "half", "heapify", "itertools 0.14.0", "lazy_static", @@ -4466,7 +4447,6 @@ dependencies = [ "more-asserts", "prometheus", "rand 0.9.2", - "regex", "serde", "serde_json", "sha2", @@ -4497,7 +4477,6 @@ dependencies = [ "ctor", "dirs", "futures", - "futures-util", "git-version", "humantime", "konst", diff --git a/wasm/hf_xet_thin_wasm/Cargo.lock b/wasm/hf_xet_thin_wasm/Cargo.lock index 20849880..2fd9cb56 100644 --- a/wasm/hf_xet_thin_wasm/Cargo.lock +++ b/wasm/hf_xet_thin_wasm/Cargo.lock @@ -445,12 +445,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - [[package]] name = "crypto-common" version = "0.1.7" @@ -820,17 +814,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "cfg-if 1.0.4", - "crunchy", - "zerocopy", -] - [[package]] name = "hashbrown" version = "0.15.5" @@ -3538,7 +3521,6 @@ version = "1.4.0" dependencies = [ "async-trait", "base64", - "bincode", "blake3", "bytemuck", "bytes", @@ -3548,7 +3530,6 @@ dependencies = [ "futures", "futures-util", "getrandom 0.4.2", - "half", "heapify", "itertools", "lazy_static", @@ -3585,7 +3566,6 @@ dependencies = [ "more-asserts", "prometheus", "rand 0.9.2", - "regex", "serde", "serde_json", "sha2", @@ -3615,7 +3595,6 @@ dependencies = [ "ctor", "dirs", "futures", - "futures-util", "git-version", "humantime", "konst", diff --git a/xet_core_structures/Cargo.toml b/xet_core_structures/Cargo.toml index c2df0986..eb0164c4 100644 --- a/xet_core_structures/Cargo.toml +++ b/xet_core_structures/Cargo.toml @@ -32,7 +32,6 @@ countio = { workspace = true } csv = { workspace = true } futures = { workspace = true } futures-util = { workspace = true } -half = { workspace = true } heapify = { workspace = true } itertools = { workspace = true } lazy_static = { workspace = true } @@ -48,7 +47,6 @@ thiserror = { workspace = true } tracing = { workspace = true } [target.'cfg(not(target_family = "wasm"))'.dependencies] -bincode = { workspace = true } bytemuck = { workspace = true } tokio = { workspace = true, features = ["time", "rt", "macros", "sync", "test-util", "io-util", "rt-multi-thread"] } tokio-util = { workspace = true, features = ["io"] } @@ -63,6 +61,7 @@ web-time = { workspace = true } [dev-dependencies] bincode = { workspace = true } futures-util = { workspace = true } +half = { workspace = true } rand = { workspace = true } serde_json = { workspace = true } serial_test = { workspace = true } diff --git a/xet_data/Cargo.toml b/xet_data/Cargo.toml index 02c86e86..d0f3f3ee 100644 --- a/xet_data/Cargo.toml +++ b/xet_data/Cargo.toml @@ -28,7 +28,6 @@ lazy_static = { workspace = true } more-asserts = { workspace = true } prometheus = { workspace = true } rand = { workspace = true } -regex = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } tempfile = { workspace = true } @@ -77,6 +76,7 @@ criterion = { version = "0.4", features = ["async_tokio"] } ctor = { workspace = true } dirs = { workspace = true } rand = { workspace = true } +regex = { workspace = true } serial_test = { workspace = true } tempfile = { workspace = true } tracing-test = { workspace = true } diff --git a/xet_runtime/Cargo.toml b/xet_runtime/Cargo.toml index 479ddaef..0186645a 100644 --- a/xet_runtime/Cargo.toml +++ b/xet_runtime/Cargo.toml @@ -32,7 +32,6 @@ sysinfo = { workspace = true } async-trait = { workspace = true } bytes = { workspace = true } futures = { workspace = true } -futures-util = { workspace = true } pin-project = { workspace = true } thiserror = { workspace = true } tracing = { workspace = true } @@ -74,6 +73,7 @@ path = "tests/bin/log_test_executable.rs" [dev-dependencies] xet-core-structures = { version = "1.4.0", path = "../xet_core_structures" } +futures-util = { workspace = true } rand = { workspace = true } serial_test = { workspace = true } tempfile = { workspace = true }