Skip to content

Commit 047735e

Browse files
committed
chore: M5 CI/Workflow Sweep - final synchronisation
1 parent 677edfa commit 047735e

61 files changed

Lines changed: 1098 additions & 1187 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Thumbs.db
2727

2828
# Rust
2929
**/*.rs.bk
30-
# Cargo.lock # Keep for binaries
3130

3231
# Elixir
3332
/cover/

rust-core/verisim-api/src/auth.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ fn validate_jwt(token: &str, config: &AuthConfig) -> Result<ClientIdentity, Stri
421421
if let Some(exp) = claims.get("exp").and_then(|v| v.as_i64()) {
422422
let now = std::time::SystemTime::now()
423423
.duration_since(std::time::UNIX_EPOCH)
424-
.unwrap()
424+
.expect("TODO: handle error")
425425
.as_secs() as i64;
426426
if now > exp {
427427
return Err("JWT token expired".to_string());
@@ -572,7 +572,7 @@ mod tests {
572572

573573
let entry = registry.validate("my-secret-key");
574574
assert!(entry.is_some());
575-
let entry = entry.unwrap();
575+
let entry = entry.expect("TODO: handle error");
576576
assert_eq!(entry.label, "Test Key");
577577
assert_eq!(entry.role, ClientRole::Writer);
578578
assert!(entry.active);
@@ -660,7 +660,7 @@ mod tests {
660660
#[test]
661661
fn test_base64url_decode() {
662662
// "hello" in base64url is "aGVsbG8"
663-
let decoded = base64url_decode("aGVsbG8").unwrap();
663+
let decoded = base64url_decode("aGVsbG8").expect("TODO: handle error");
664664
assert_eq!(decoded, b"hello");
665665
}
666666

@@ -694,7 +694,7 @@ mod tests {
694694

695695
let result = validate_jwt(&token, &config);
696696
assert!(result.is_ok());
697-
let identity = result.unwrap();
697+
let identity = result.expect("TODO: handle error");
698698
assert_eq!(identity.id, "test-user");
699699
assert_eq!(identity.role, ClientRole::Admin);
700700
}

rust-core/verisim-api/src/federation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,10 @@ mod tests {
660660
state
661661
.peers
662662
.write()
663-
.unwrap()
663+
.expect("TODO: handle error")
664664
.insert("peer-1".to_string(), peer);
665665

666-
let peers = state.peers.read().unwrap();
666+
let peers = state.peers.read().expect("TODO: handle error");
667667
assert_eq!(peers.len(), 1);
668668
assert_eq!(peers["peer-1"].trust_level, 0.95);
669669
}

rust-core/verisim-api/src/lib.rs

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,7 @@ mod tests {
25042504
config.persistence_dir = Some(tmp.to_string_lossy().into_owned());
25052505
}
25062506

2507-
AppState::new_async(config).await.unwrap()
2507+
AppState::new_async(config).await.expect("TODO: handle error")
25082508
}
25092509

25102510
#[tokio::test]
@@ -2517,10 +2517,10 @@ mod tests {
25172517
Request::builder()
25182518
.uri("/health")
25192519
.body(Body::empty())
2520-
.unwrap(),
2520+
.expect("TODO: handle error"),
25212521
)
25222522
.await
2523-
.unwrap();
2523+
.expect("TODO: handle error");
25242524

25252525
assert_eq!(response.status(), StatusCode::OK);
25262526
}
@@ -2535,10 +2535,10 @@ mod tests {
25352535
Request::builder()
25362536
.uri("/ready")
25372537
.body(Body::empty())
2538-
.unwrap(),
2538+
.expect("TODO: handle error"),
25392539
)
25402540
.await
2541-
.unwrap();
2541+
.expect("TODO: handle error");
25422542

25432543
assert_eq!(response.status(), StatusCode::OK);
25442544
}
@@ -2568,30 +2568,30 @@ mod tests {
25682568
.method("POST")
25692569
.uri("/octads")
25702570
.header("content-type", "application/json")
2571-
.body(Body::from(serde_json::to_string(&create_request).unwrap()))
2572-
.unwrap(),
2571+
.body(Body::from(serde_json::to_string(&create_request).expect("TODO: handle error")))
2572+
.expect("TODO: handle error"),
25732573
)
25742574
.await
2575-
.unwrap();
2575+
.expect("TODO: handle error");
25762576

25772577
assert_eq!(response.status(), StatusCode::CREATED);
25782578

25792579
// Parse response to get ID
25802580
let body = axum::body::to_bytes(response.into_body(), 1024 * 1024)
25812581
.await
2582-
.unwrap();
2583-
let created: OctadResponse = serde_json::from_slice(&body).unwrap();
2582+
.expect("TODO: handle error");
2583+
let created: OctadResponse = serde_json::from_slice(&body).expect("TODO: handle error");
25842584

25852585
// Get the octad
25862586
let response = app
25872587
.oneshot(
25882588
Request::builder()
25892589
.uri(format!("/octads/{}", created.id))
25902590
.body(Body::empty())
2591-
.unwrap(),
2591+
.expect("TODO: handle error"),
25922592
)
25932593
.await
2594-
.unwrap();
2594+
.expect("TODO: handle error");
25952595

25962596
assert_eq!(response.status(), StatusCode::OK);
25972597
}
@@ -2621,22 +2621,22 @@ mod tests {
26212621
.method("POST")
26222622
.uri("/octads")
26232623
.header("content-type", "application/json")
2624-
.body(Body::from(serde_json::to_string(&create_request).unwrap()))
2625-
.unwrap(),
2624+
.body(Body::from(serde_json::to_string(&create_request).expect("TODO: handle error")))
2625+
.expect("TODO: handle error"),
26262626
)
26272627
.await
2628-
.unwrap();
2628+
.expect("TODO: handle error");
26292629

26302630
// Search for it
26312631
let response = app
26322632
.oneshot(
26332633
Request::builder()
26342634
.uri("/search/text?q=Rust&limit=10")
26352635
.body(Body::empty())
2636-
.unwrap(),
2636+
.expect("TODO: handle error"),
26372637
)
26382638
.await
2639-
.unwrap();
2639+
.expect("TODO: handle error");
26402640

26412641
assert_eq!(response.status(), StatusCode::OK);
26422642
}
@@ -2651,10 +2651,10 @@ mod tests {
26512651
Request::builder()
26522652
.uri("/drift/status")
26532653
.body(Body::empty())
2654-
.unwrap(),
2654+
.expect("TODO: handle error"),
26552655
)
26562656
.await
2657-
.unwrap();
2657+
.expect("TODO: handle error");
26582658

26592659
assert_eq!(response.status(), StatusCode::OK);
26602660
}
@@ -2807,7 +2807,7 @@ mod tests {
28072807
};
28082808
let input = req.to_octad_input();
28092809
assert!(input.document.is_some());
2810-
let doc = input.document.unwrap();
2810+
let doc = input.document.expect("TODO: handle error");
28112811
assert_eq!(doc.title, "Test");
28122812
assert_eq!(doc.body, "Body");
28132813
assert!(input.vector.is_none());
@@ -2871,7 +2871,7 @@ mod tests {
28712871
metadata: None,
28722872
};
28732873
let input = req.to_octad_input();
2874-
let doc = input.document.unwrap();
2874+
let doc = input.document.expect("TODO: handle error");
28752875
assert_eq!(doc.title, "Title Only");
28762876
assert_eq!(doc.body, ""); // Body defaults to empty string
28772877
}
@@ -2886,10 +2886,10 @@ mod tests {
28862886
Request::builder()
28872887
.uri("/octads/nonexistent-id-12345")
28882888
.body(Body::empty())
2889-
.unwrap(),
2889+
.expect("TODO: handle error"),
28902890
)
28912891
.await
2892-
.unwrap();
2892+
.expect("TODO: handle error");
28932893

28942894
assert_eq!(response.status(), StatusCode::NOT_FOUND);
28952895
}
@@ -2919,17 +2919,17 @@ mod tests {
29192919
.method("POST")
29202920
.uri("/octads")
29212921
.header("content-type", "application/json")
2922-
.body(Body::from(serde_json::to_string(&create_request).unwrap()))
2923-
.unwrap(),
2922+
.body(Body::from(serde_json::to_string(&create_request).expect("TODO: handle error")))
2923+
.expect("TODO: handle error"),
29242924
)
29252925
.await
2926-
.unwrap();
2926+
.expect("TODO: handle error");
29272927
assert_eq!(response.status(), StatusCode::CREATED);
29282928

29292929
let body = axum::body::to_bytes(response.into_body(), 1024 * 1024)
29302930
.await
2931-
.unwrap();
2932-
let created: OctadResponse = serde_json::from_slice(&body).unwrap();
2931+
.expect("TODO: handle error");
2932+
let created: OctadResponse = serde_json::from_slice(&body).expect("TODO: handle error");
29332933

29342934
// Delete it
29352935
let response = app
@@ -2939,10 +2939,10 @@ mod tests {
29392939
.method("DELETE")
29402940
.uri(format!("/octads/{}", created.id))
29412941
.body(Body::empty())
2942-
.unwrap(),
2942+
.expect("TODO: handle error"),
29432943
)
29442944
.await
2945-
.unwrap();
2945+
.expect("TODO: handle error");
29462946
assert_eq!(response.status(), StatusCode::NO_CONTENT);
29472947

29482948
// Verify it is gone
@@ -2951,10 +2951,10 @@ mod tests {
29512951
Request::builder()
29522952
.uri(format!("/octads/{}", created.id))
29532953
.body(Body::empty())
2954-
.unwrap(),
2954+
.expect("TODO: handle error"),
29552955
)
29562956
.await
2957-
.unwrap();
2957+
.expect("TODO: handle error");
29582958
assert_eq!(response.status(), StatusCode::NOT_FOUND);
29592959
}
29602960

@@ -2983,11 +2983,11 @@ mod tests {
29832983
.method("POST")
29842984
.uri("/octads")
29852985
.header("content-type", "application/json")
2986-
.body(Body::from(serde_json::to_string(&req).unwrap()))
2987-
.unwrap(),
2986+
.body(Body::from(serde_json::to_string(&req).expect("TODO: handle error")))
2987+
.expect("TODO: handle error"),
29882988
)
29892989
.await
2990-
.unwrap();
2990+
.expect("TODO: handle error");
29912991
}
29922992

29932993
// List
@@ -2996,16 +2996,16 @@ mod tests {
29962996
Request::builder()
29972997
.uri("/octads?limit=10&offset=0")
29982998
.body(Body::empty())
2999-
.unwrap(),
2999+
.expect("TODO: handle error"),
30003000
)
30013001
.await
3002-
.unwrap();
3002+
.expect("TODO: handle error");
30033003
assert_eq!(response.status(), StatusCode::OK);
30043004

30053005
let body = axum::body::to_bytes(response.into_body(), 1024 * 1024)
30063006
.await
3007-
.unwrap();
3008-
let list: Vec<OctadResponse> = serde_json::from_slice(&body).unwrap();
3007+
.expect("TODO: handle error");
3008+
let list: Vec<OctadResponse> = serde_json::from_slice(&body).expect("TODO: handle error");
30093009
assert!(
30103010
list.len() >= 2,
30113011
"Should list at least 2 octads, got {}",
@@ -3037,11 +3037,11 @@ mod tests {
30373037
.method("POST")
30383038
.uri("/octads")
30393039
.header("content-type", "application/json")
3040-
.body(Body::from(serde_json::to_string(&req).unwrap()))
3041-
.unwrap(),
3040+
.body(Body::from(serde_json::to_string(&req).expect("TODO: handle error")))
3041+
.expect("TODO: handle error"),
30423042
)
30433043
.await
3044-
.unwrap();
3044+
.expect("TODO: handle error");
30453045

30463046
// Vector search
30473047
let search_req = VectorSearchRequest {
@@ -3054,11 +3054,11 @@ mod tests {
30543054
.method("POST")
30553055
.uri("/search/vector")
30563056
.header("content-type", "application/json")
3057-
.body(Body::from(serde_json::to_string(&search_req).unwrap()))
3058-
.unwrap(),
3057+
.body(Body::from(serde_json::to_string(&search_req).expect("TODO: handle error")))
3058+
.expect("TODO: handle error"),
30593059
)
30603060
.await
3061-
.unwrap();
3061+
.expect("TODO: handle error");
30623062
assert_eq!(response.status(), StatusCode::OK);
30633063
}
30643064

@@ -3072,10 +3072,10 @@ mod tests {
30723072
Request::builder()
30733073
.uri("/normalizer/status")
30743074
.body(Body::empty())
3075-
.unwrap(),
3075+
.expect("TODO: handle error"),
30763076
)
30773077
.await
3078-
.unwrap();
3078+
.expect("TODO: handle error");
30793079

30803080
assert_eq!(response.status(), StatusCode::OK);
30813081
}
@@ -3090,10 +3090,10 @@ mod tests {
30903090
Request::builder()
30913091
.uri("/metrics")
30923092
.body(Body::empty())
3093-
.unwrap(),
3093+
.expect("TODO: handle error"),
30943094
)
30953095
.await
3096-
.unwrap();
3096+
.expect("TODO: handle error");
30973097

30983098
assert_eq!(response.status(), StatusCode::OK);
30993099
}
@@ -3108,16 +3108,16 @@ mod tests {
31083108
Request::builder()
31093109
.uri("/.well-known/groove")
31103110
.body(Body::empty())
3111-
.unwrap(),
3111+
.expect("TODO: handle error"),
31123112
)
31133113
.await
3114-
.unwrap();
3114+
.expect("TODO: handle error");
31153115

31163116
assert_eq!(response.status(), StatusCode::OK);
31173117
let body = axum::body::to_bytes(response.into_body(), 1024 * 1024)
31183118
.await
3119-
.unwrap();
3120-
let manifest: GrooveManifest = serde_json::from_slice(&body).unwrap();
3119+
.expect("TODO: handle error");
3120+
let manifest: GrooveManifest = serde_json::from_slice(&body).expect("TODO: handle error");
31213121
assert_eq!(manifest.service_id, "verisim");
31223122
assert!(!manifest.capabilities.is_empty());
31233123
}
@@ -3134,11 +3134,11 @@ mod tests {
31343134
.method("POST")
31353135
.uri("/vcl/execute")
31363136
.header("content-type", "application/json")
3137-
.body(Body::from(serde_json::to_string(&req_body).unwrap()))
3138-
.unwrap(),
3137+
.body(Body::from(serde_json::to_string(&req_body).expect("TODO: handle error")))
3138+
.expect("TODO: handle error"),
31393139
)
31403140
.await
3141-
.unwrap();
3141+
.expect("TODO: handle error");
31423142

31433143
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
31443144
}
@@ -3156,7 +3156,7 @@ mod tests {
31563156
uptime_seconds: 42,
31573157
degraded_reason: None,
31583158
};
3159-
let json = serde_json::to_string(&resp).unwrap();
3159+
let json = serde_json::to_string(&resp).expect("TODO: handle error");
31603160
assert!(json.contains("ok"));
31613161
assert!(
31623162
!json.contains("degraded_reason"),
@@ -3170,8 +3170,8 @@ mod tests {
31703170
error: "not found".to_string(),
31713171
code: 404,
31723172
};
3173-
let json = serde_json::to_string(&resp).unwrap();
3174-
let parsed: ErrorResponse = serde_json::from_str(&json).unwrap();
3173+
let json = serde_json::to_string(&resp).expect("TODO: handle error");
3174+
let parsed: ErrorResponse = serde_json::from_str(&json).expect("TODO: handle error");
31753175
assert_eq!(parsed.code, 404);
31763176
assert_eq!(parsed.error, "not found");
31773177
}

0 commit comments

Comments
 (0)