Move test-only deps to dev-dependencies in git_xet (#767)

## 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

<!-- CURSOR_SUMMARY -->
---

> [!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`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
cdc30a5a8f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This commit is contained in:
Assaf Vayner
2026-03-31 13:31:20 -07:00
committed by GitHub
parent 126f30b981
commit 86935b4117
10 changed files with 18 additions and 51 deletions

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ debug/
!.vscode/settings.json
venv
**/*.env
.worktrees/

View File

@@ -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"]

View File

@@ -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.

View File

@@ -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};

View File

@@ -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

21
hf_xet/Cargo.lock generated
View File

@@ -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",

View File

@@ -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",

View File

@@ -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 }

View File

@@ -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 }

View File

@@ -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 }