Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style(profiles): reformat proptest strategies

Steven Enamakel03d5eb1dbc4a
diff --git a/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs b/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
index cb61e34690..1d178bc42c 100644
--- a/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
+++ b/crates/openhuman-core/src/profiles/gateway_proptest_tests.rs
@@ -72,13 +72,23 @@ fn user_header() -> impl Strategy<Value = String> {
enum Sig {
Missing,
/// Signed for `signed_for` at `NOW + skew`.
- Signed { signed_for: SignedFor, skew: i64 },
+ Signed {
+ signed_for: SignedFor,
+ skew: i64,
+ },
/// A valid header with the tag cut to `keep` hex characters.
- Truncated { keep: usize },
+ Truncated {
+ keep: usize,
+ },
/// A valid header with extra parts, duplicates or whitespace around it.
- Decorated { before: String, after: String },
+ Decorated {
+ before: String,
+ after: String,
+ },
/// A valid tag paired with a different timestamp.
- WrongT { delta: u64 },
+ WrongT {
+ delta: u64,
+ },
Garbage(String),
}
diff --git a/crates/openhuman-core/src/profiles/surface_proptest_tests.rs b/crates/openhuman-core/src/profiles/surface_proptest_tests.rs
index c32e98762d..c3f09d133d 100644
--- a/crates/openhuman-core/src/profiles/surface_proptest_tests.rs
+++ b/crates/openhuman-core/src/profiles/surface_proptest_tests.rs
@@ -78,7 +78,10 @@ fn apply(method: &str, mutation: &Mutation) -> String {
Mutation::Suffix(s) => format!("{method}{s}"),
Mutation::DotToUnderscore => method.replace('.', "_"),
Mutation::UnderscoreToDot => method.replacen('_', ".", 1),
- Mutation::Trim(n) => method.chars().take(method.chars().count().saturating_sub(*n)).collect(),
+ Mutation::Trim(n) => method
+ .chars()
+ .take(method.chars().count().saturating_sub(*n))
+ .collect(),
Mutation::Pad => format!(" {method} "),
}
}
@@ -148,7 +151,13 @@ fn lookalike() -> impl Strategy<Value = char> {
/// A reserved prefix with case changes and lookalike substitutions.
fn reserved_variant() -> impl Strategy<Value = String> {
(
- prop::sample::select(vec!["channel:", "proactive:", "subagent:", "cron:", "system:"]),
+ prop::sample::select(vec![
+ "channel:",
+ "proactive:",
+ "subagent:",
+ "cron:",
+ "system:",
+ ]),
prop::collection::vec(any::<bool>(), 12),
prop::collection::vec(prop::option::of(lookalike()), 12),
"[A-Za-z0-9_-]{0,16}",
diff --git a/crates/openhuman-core/src/profiles/types_proptest_tests.rs b/crates/openhuman-core/src/profiles/types_proptest_tests.rs
index 194f9a1d31..b0fda71217 100644
--- a/crates/openhuman-core/src/profiles/types_proptest_tests.rs
+++ b/crates/openhuman-core/src/profiles/types_proptest_tests.rs
@@ -39,12 +39,17 @@ fn user_id() -> impl Strategy<Value = String> {
"[a-z0-9_-]{0,80}",
prop::collection::vec(fragment(), 0..12).prop_map(|parts| parts.concat()),
(
- prop::sample::select(vec!["local", "operator", "h-", "Local", "LOCAL", "OPERATOR", "H-"]),
+ prop::sample::select(vec![
+ "local", "operator", "h-", "Local", "LOCAL", "OPERATOR", "H-"
+ ]),
"[a-fA-F0-9]{0,40}",
)
.prop_map(|(head, tail)| format!("{head}{tail}")),
prop::collection::vec(any::<char>(), 0..=512).prop_map(String::from_iter),
- (0usize..=512, prop::sample::select(vec!['a', '0', '-', 'Z', '/', 'é']))
+ (
+ 0usize..=512,
+ prop::sample::select(vec!['a', '0', '-', 'Z', '/', 'é'])
+ )
.prop_map(|(n, c)| std::iter::repeat_n(c, n).collect()),
]
}