Skip to content

Commit 395554a

Browse files
bordumbclaude
andcommitted
refactor: move git test helpers to auths-test-utils, break dev-dep cycle
auths-id had a dev-dependency on auths-infra-git solely for init_test_repo(), creating a cycle: auths-id → auths-infra-git → auths-sdk → auths-id. Move git test helpers to auths-test-utils and fix crate publish order. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c1ff9b6 commit 395554a

16 files changed

Lines changed: 47 additions & 45 deletions

File tree

Cargo.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/auths-id/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ auths-infra-http = { workspace = true, optional = true }
5555

5656
[dev-dependencies]
5757
auths-core = { workspace = true, features = ["test-utils"] }
58-
auths-infra-git = { workspace = true, features = ["test-utils"] }
58+
auths-test-utils = { path = "../auths-test-utils" }
5959
criterion = { version = "0.8.2", features = ["html_reports"] }
6060
rand = "0.10.0"
6161
base58 = "0.2"

crates/auths-id/tests/cases/keri.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn make_test_attestation(issuer: &str, subject: &str) -> TestAttestation {
2929
/// Tests the full KERI lifecycle: inception -> rotation -> rotation -> resolution
3030
#[test]
3131
fn full_keri_lifecycle() {
32-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
32+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
3333

3434
// === Phase 1: Inception ===
3535
let init: InceptionResult = create_keri_identity(&repo, None).unwrap();
@@ -97,7 +97,7 @@ fn full_keri_lifecycle() {
9797
/// Tests device attestation anchoring via IXN events
9898
#[test]
9999
fn device_enrollment_with_anchoring() {
100-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
100+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
101101

102102
// Create identity
103103
let init = create_keri_identity(&repo, None).unwrap();
@@ -130,7 +130,7 @@ fn device_enrollment_with_anchoring() {
130130
/// Tests that multiple attestations can be anchored
131131
#[test]
132132
fn multiple_device_attestations() {
133-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
133+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
134134

135135
let init = create_keri_identity(&repo, None).unwrap();
136136
let identity_did = format!("did:keri:{}", init.prefix);
@@ -172,7 +172,7 @@ fn multiple_device_attestations() {
172172
/// Tests that rotation invalidates without proper commitment
173173
#[test]
174174
fn rotation_requires_commitment() {
175-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
175+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
176176

177177
let init = create_keri_identity(&repo, None).unwrap();
178178

@@ -186,7 +186,7 @@ fn rotation_requires_commitment() {
186186
/// Tests KEL validation detects sequence tampering
187187
#[test]
188188
fn kel_validation_rejects_sequence_tampering() {
189-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
189+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
190190

191191
let init = create_keri_identity(&repo, None).unwrap();
192192
let _rot = rotate_keys(&repo, &init.prefix, &init.next_keypair_pkcs8, None).unwrap();
@@ -208,7 +208,7 @@ fn kel_validation_rejects_sequence_tampering() {
208208
/// Tests that unanchored attestations are not found
209209
#[test]
210210
fn unanchored_attestation_not_found() {
211-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
211+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
212212

213213
let init = create_keri_identity(&repo, None).unwrap();
214214
let identity_did = format!("did:keri:{}", init.prefix);
@@ -224,7 +224,7 @@ fn unanchored_attestation_not_found() {
224224
/// Tests that key state is correct after operations
225225
#[test]
226226
fn key_state_reflects_operations() {
227-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
227+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
228228

229229
let init = create_keri_identity(&repo, None).unwrap();
230230

@@ -244,7 +244,7 @@ fn key_state_reflects_operations() {
244244
/// Tests that did:keri parsing works correctly
245245
#[test]
246246
fn did_keri_parsing() {
247-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
247+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
248248

249249
let init = create_keri_identity(&repo, None).unwrap();
250250
let did = format!("did:keri:{}", init.prefix);
@@ -261,7 +261,7 @@ fn did_keri_parsing() {
261261
/// Tests anchor verification by digest
262262
#[test]
263263
fn verify_anchor_by_digest_works() {
264-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
264+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
265265

266266
let init = create_keri_identity(&repo, None).unwrap();
267267
let identity_did = format!("did:keri:{}", init.prefix);

crates/auths-id/tests/cases/lifecycle.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn rotate_identity(
171171
#[tokio::test(flavor = "multi_thread")]
172172
async fn test_full_identity_lifecycle() {
173173
let kc = IsolatedKeychainHandle::new();
174-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
174+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
175175
let repo_path = _dir.path().to_path_buf();
176176
let passphrase = "Test-P@ss12345";
177177

@@ -249,7 +249,7 @@ async fn test_full_identity_lifecycle() {
249249
#[tokio::test(flavor = "multi_thread")]
250250
async fn test_attestation_chain_after_rotation() {
251251
let kc = IsolatedKeychainHandle::new();
252-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
252+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
253253
let repo_path = _dir.path().to_path_buf();
254254
let passphrase = "Test-P@ss12345";
255255

@@ -308,7 +308,7 @@ async fn test_attestation_chain_after_rotation() {
308308
#[tokio::test(flavor = "multi_thread")]
309309
async fn test_verify_device_authorization_lifecycle() {
310310
let kc = IsolatedKeychainHandle::new();
311-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
311+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
312312
let repo_path = _dir.path().to_path_buf();
313313
let passphrase = "Test-P@ss12345";
314314

@@ -364,7 +364,7 @@ async fn test_verify_device_authorization_lifecycle() {
364364
#[tokio::test(flavor = "multi_thread")]
365365
async fn test_multiple_rotations_maintain_verification() {
366366
let kc = IsolatedKeychainHandle::new();
367-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
367+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
368368
let repo_path = _dir.path().to_path_buf();
369369
let passphrase = "Test-P@ss12345";
370370

@@ -437,7 +437,7 @@ async fn test_multiple_rotations_maintain_verification() {
437437
#[test]
438438
fn test_init_creates_keri_kel() {
439439
let kc = IsolatedKeychainHandle::new();
440-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
440+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
441441
let repo_path = _dir.path().to_path_buf();
442442
let passphrase = "Test-P@ss12345";
443443

@@ -469,7 +469,7 @@ fn test_init_creates_keri_kel() {
469469
#[test]
470470
fn test_rotation_appends_to_kel() {
471471
let kc = IsolatedKeychainHandle::new();
472-
let (_dir, _repo) = auths_infra_git::testing::init_test_repo();
472+
let (_dir, _repo) = auths_test_utils::git::init_test_repo();
473473
let repo_path = _dir.path().to_path_buf();
474474
let passphrase = "Test-P@ss12345";
475475

crates/auths-id/tests/cases/rotation_edge_cases.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn double_rotation_does_not_corrupt_kel() {
9292

9393
#[test]
9494
fn rotation_after_interaction_events_preserves_kel_integrity() {
95-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
95+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
9696

9797
let init = create_keri_identity(&repo, None).unwrap();
9898
let identity_did = format!("did:keri:{}", init.prefix);
@@ -127,7 +127,7 @@ fn rotation_after_interaction_events_preserves_kel_integrity() {
127127

128128
#[test]
129129
fn anchoring_works_with_rotated_key_after_ixn() {
130-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
130+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
131131

132132
let init = create_keri_identity(&repo, None).unwrap();
133133
let identity_did = format!("did:keri:{}", init.prefix);
@@ -160,7 +160,7 @@ fn anchoring_works_with_rotated_key_after_ixn() {
160160

161161
#[test]
162162
fn multiple_rotations_interleaved_with_ixn() {
163-
let (_dir, repo) = auths_infra_git::testing::init_test_repo();
163+
let (_dir, repo) = auths_test_utils::git::init_test_repo();
164164

165165
let init = create_keri_identity(&repo, None).unwrap();
166166
let identity_did = format!("did:keri:{}", init.prefix);

crates/auths-infra-git/Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ thiserror.workspace = true
1919
chrono = "0.4"
2020
log = "0.4"
2121

22-
[features]
23-
test-utils = ["dep:tempfile"]
24-
25-
[dependencies.tempfile]
26-
version = "3"
27-
optional = true
28-
2922
[dev-dependencies]
3023
auths-sdk = { workspace = true, features = ["test-utils"] }
24+
auths-test-utils = { path = "../auths-test-utils" }
25+
tempfile = "3"

crates/auths-infra-git/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,3 @@ pub use blob_store::GitBlobStore;
2323
pub use event_log::GitEventLog;
2424
pub use ref_store::GitRefStore;
2525
pub use repo::GitRepo;
26-
27-
/// Test utilities for auths-infra-git consumers (behind `test-utils` feature).
28-
#[cfg(any(test, feature = "test-utils"))]
29-
pub mod testing;

crates/auths-infra-git/tests/cases/blob_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use auths_core::ports::storage::{BlobReader, BlobWriter, StorageError};
22
use auths_infra_git::{GitBlobStore, GitRepo};
33

44
fn setup() -> (tempfile::TempDir, GitRepo) {
5-
let (dir, _repo) = auths_infra_git::testing::init_test_repo();
5+
let (dir, _repo) = auths_test_utils::git::init_test_repo();
66
let git_repo = GitRepo::open(dir.path()).unwrap();
77
(dir, git_repo)
88
}

crates/auths-infra-git/tests/cases/event_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use auths_infra_git::{GitEventLog, GitRepo};
33
use auths_verifier::keri::Prefix;
44

55
fn setup() -> (tempfile::TempDir, GitRepo) {
6-
let (dir, _repo) = auths_infra_git::testing::init_test_repo();
6+
let (dir, _repo) = auths_test_utils::git::init_test_repo();
77
let git_repo = GitRepo::open(dir.path()).unwrap();
88
(dir, git_repo)
99
}

crates/auths-infra-git/tests/cases/git_log_contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ auths_sdk::git_log_provider_contract_tests!(
4747
auths_sdk::git_log_provider_contract_tests!(
4848
git2_provider,
4949
{
50-
let (dir, repo) = auths_infra_git::testing::init_test_repo();
50+
let (dir, repo) = auths_test_utils::git::init_test_repo();
5151
create_commit(&repo, "first");
5252
create_commit(&repo, "second");
5353
create_commit(&repo, "third");

0 commit comments

Comments
 (0)