Skip to content

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

refactor(attachments): simplify string push and base64 size math

Steven Enamakel188d7505c2d3
diff --git a/crates/openhuman-core/src/attachments/provider_fallback.rs b/crates/openhuman-core/src/attachments/provider_fallback.rs
index 2d28554734..9ee19a9a9b 100644
--- a/crates/openhuman-core/src/attachments/provider_fallback.rs
+++ b/crates/openhuman-core/src/attachments/provider_fallback.rs
@@ -36,9 +36,9 @@ impl AttachmentModel {
"[attachments] document extraction skipped: component 'documents' disabled"
);
cacheable = false;
- text.push_str(&format!(
- "Document extraction is disabled ([components] documents = false); original remains available."
- ));
+ text.push_str(
+ "Document extraction is disabled ([components] documents = false); original remains available.",
+ );
} else if let Some(format) = format {
let (_, _, limit) = self.config.multimodal_files.effective_limits();
let mut spec = tinydocs_bus::ExtractDocumentSpec::new(format);
diff --git a/crates/openhuman-core/src/attachments/provider_routing_tests.rs b/crates/openhuman-core/src/attachments/provider_routing_tests.rs
index 9f03ba8e0f..3bf744c9cb 100644
--- a/crates/openhuman-core/src/attachments/provider_routing_tests.rs
+++ b/crates/openhuman-core/src/attachments/provider_routing_tests.rs
@@ -643,7 +643,7 @@ async fn unsupported_media_urls_and_oversized_inline_sources_fail_before_inferen
// A valid base64 body just over the decoded byte limit must also fail
// before legacy materialization or inference.
- let decoded_oversize_len = ((1024 * 1024 + 1 + 2) / 3) * 4;
+ let decoded_oversize_len = (1024_usize * 1024 + 1).div_ceil(3) * 4;
let decoded_oversized = user_request(vec![ContentBlock::Document(MediaRef::Base64 {
data: "A".repeat(decoded_oversize_len),
media_type: "text/plain".into(),