Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore(ci): improve testing (#355)
Sean Ayea5a9a0255267
diff --git a/.github/workflows/code-check-cloud-storage.yml b/.github/workflows/code-check-cloud-storage.ymlindex 70bbded624..c913e61125 100644--- a/.github/workflows/code-check-cloud-storage.yml+++ b/.github/workflows/code-check-cloud-storage.yml@@ -50,7 +50,7 @@ jobs:- name: clippyrun: |cd rust/cloud-storage- cargo clippy+ cargo clippy --all-featurestest:needs: path-check@@ -93,6 +93,7 @@ jobs:run: |cargo install just --forcecargo install sqlx-cli --force+ cargo install cargo-nextest --force- name: prepare testsrun: |just rust/cloud-storage/setup_test_envs@@ -100,7 +101,7 @@ jobs:- name: run testsrun: |cd rust/cloud-storage- cargo test+ cargo nextest run --all-featuresdiff-check:needs: path-checkdiff --git a/flake.nix b/flake.nixindex 9f0f1a3ec6..389d3633fc 100644--- a/flake.nix+++ b/flake.nix@@ -25,6 +25,7 @@cargo-udepscargo-lambdacargo-deny+ cargo-nextestpkg-configjustjust-lspdiff --git a/rust/cloud-storage/authentication_service/Cargo.toml b/rust/cloud-storage/authentication_service/Cargo.tomlindex e2ccca8c04..09a1428e53 100644--- a/rust/cloud-storage/authentication_service/Cargo.toml+++ b/rust/cloud-storage/authentication_service/Cargo.toml@@ -18,8 +18,9 @@ name = "backfill_null_macro_user_id"path = "src/bin/backfill_null_macro_user_id.rs"[features]-disable_rate_limit = []+default = ["rate_limit"]local = []+rate_limit = [][dependencies]anyhow = { workspace = true }diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/login_code.rs b/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/login_code.rsindex 19e3b5eb2c..8512657387 100644--- a/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/login_code.rs+++ b/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/login_code.rs@@ -20,8 +20,7 @@ pub(in crate::api) async fn handler(req: Request,next: Next,) -> Result<Response, Response> {- #[cfg(feature = "disable_rate_limit")]- {+ if cfg!(not(feature = "rate_limit")) {tracing::trace!("rate limit disabled");return Ok(next.run(req).await);}diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/passwordless.rs b/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/passwordless.rsindex ef03601451..dc93c728e2 100644--- a/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/passwordless.rs+++ b/rust/cloud-storage/authentication_service/src/api/middleware/rate_limit/passwordless.rs@@ -27,8 +27,7 @@ pub(in crate::api) async fn handler(req: Request,next: Next,) -> Result<Response, Response> {- #[cfg(feature = "disable_rate_limit")]- {+ if cfg!(not(feature = "rate_limit")) {tracing::trace!("rate limit disabled");return Ok(next.run(req).await);}diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex 027de703fa..b2e6f86b22 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -18,10 +18,11 @@ name = "backfill_useritemaccess"path = "src/bin/backfill_useritemaccess/mod.rs"[features]-disable_connection_gateway = []-disable_location_check = []+connection_gateway = []+default = ["connection_gateway", "location_check"]local = ["local_auth"]local_auth = ["macro_middleware/local_auth"]+location_check = [][dependencies]anyhow = { workspace = true }diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs b/rust/cloud-storage/document_storage_service/src/api/documents/location.rsindex 561b539e02..37f90d2dc0 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/location.rs@@ -272,7 +272,7 @@ async fn get_editable_url();// Check if the item exists in s3- #[cfg(not(feature = "disable_location_check"))]+ #[cfg(feature = "location_check")]{// NOTE: owner is not url encodedlet document_key = build_cloud_storage_bucket_document_key(@@ -323,7 +323,7 @@ pub(in crate::api::documents) async fn get_static_url();// Check if the item exists in s3- #[cfg(not(feature = "disable_location_check"))]+ #[cfg(feature = "location_check")]{// NOTE: owner is not url encodedlet document_key = build_cloud_storage_bucket_document_key(@@ -368,7 +368,7 @@ async fn get_converted_docx_url();// Check if the item exists in s3- #[cfg(not(feature = "disable_location_check"))]+ #[cfg(feature = "location_check")]{let document_key = format!("{}/{}/{}.pdf",diff --git a/rust/cloud-storage/document_storage_service/src/service/conn_gateway/mod.rs b/rust/cloud-storage/document_storage_service/src/service/conn_gateway/mod.rsindex 6d12c9ee77..ed79170d18 100644--- a/rust/cloud-storage/document_storage_service/src/service/conn_gateway/mod.rs+++ b/rust/cloud-storage/document_storage_service/src/service/conn_gateway/mod.rs@@ -8,7 +8,7 @@ pub async fn update_live_comment_state(document_id: &str,message: AnnotationIncrementalUpdate<'_>,) -> () {- if cfg!(feature = "disable_connection_gateway") {+ if cfg!(not(feature = "connection_gateway")) {tracing::info!("bypassing connection gateway");} else {let entities = vec![EntityType::Document.with_entity_str(document_id)];diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/copy_document.rs b/rust/cloud-storage/document_storage_service/src/service/s3/copy_document.rsindex ec65c4b40c..5166d1d47f 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/copy_document.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/copy_document.rs@@ -8,8 +8,7 @@ pub(in crate::service::s3) async fn copy_document(source_key: &str,destination_key: &str,) -> anyhow::Result<()> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/delete.rs b/rust/cloud-storage/document_storage_service/src/service/s3/delete.rsindex dfb10e5d1b..1db847a95e 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/delete.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/delete.rs@@ -8,8 +8,7 @@ pub(in crate::service::s3) async fn delete_objects(bucket: &str,objects: Vec<String>,) -> anyhow::Result<()> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}@@ -46,8 +45,7 @@ pub(in crate::service::s3) async fn delete_document(user_id: &str,document_id: &str,) -> anyhow::Result<()> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/exists.rs b/rust/cloud-storage/document_storage_service/src/service/s3/exists.rsindex 817611d1db..62da013194 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/exists.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/exists.rs@@ -8,8 +8,7 @@ pub(in crate::service::s3) async fn exists(bucket: &str,key: &str,) -> anyhow::Result<bool> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(true);}let resp = client.head_object().bucket(bucket).key(key).send().await;diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/get_presigned_url.rs b/rust/cloud-storage/document_storage_service/src/service/s3/get_presigned_url.rsindex 761c2cc433..b110c19031 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/get_presigned_url.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/get_presigned_url.rs@@ -10,8 +10,7 @@ pub(in crate::service::s3) async fn get_presigned_url(bucket: &str,key: &str,) -> anyhow::Result<String> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok("fake".to_string());}diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/put_presigned_url.rs b/rust/cloud-storage/document_storage_service/src/service/s3/put_presigned_url.rsindex a1642ed46e..9c492f2b2b 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/put_presigned_url.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/put_presigned_url.rs@@ -16,8 +16,7 @@ pub(in crate::service::s3) async fn put_presigned_url(sha: &str,content_type: ContentType,) -> anyhow::Result<String> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok("fake".to_string());}// Allows the app 2 minutes to grab the documentdiff --git a/rust/cloud-storage/document_storage_service/src/service/s3/upload_document.rs b/rust/cloud-storage/document_storage_service/src/service/s3/upload_document.rsindex e2ba8b88a4..a753712fc5 100644--- a/rust/cloud-storage/document_storage_service/src/service/s3/upload_document.rs+++ b/rust/cloud-storage/document_storage_service/src/service/s3/upload_document.rs@@ -7,8 +7,7 @@ pub(in crate::service::s3) async fn upload_document(key: &str,byte_stream: ByteStream,) -> anyhow::Result<()> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}diff --git a/rust/cloud-storage/document_text_extractor/src/handler/extract_text_citations.rs b/rust/cloud-storage/document_text_extractor/src/handler/extract_text_citations.rsindex e55ef37fd6..e7a30ac572 100644--- a/rust/cloud-storage/document_text_extractor/src/handler/extract_text_citations.rs+++ b/rust/cloud-storage/document_text_extractor/src/handler/extract_text_citations.rs@@ -220,6 +220,7 @@ mod test {use crate::handler::extract_text_citations::ref_id_extract_text;use crate::service::db::DBClient;+ #[ignore = "this test requires a very specific system environment which is hard to replicate in CI"]#[tokio::test]pub async fn test_local_extract() {let db_url = std::env::var("DATABASE_URL").unwrap();@@ -233,7 +234,7 @@ mod test {let test_file = "deepseek.pdf";let mut f = File::open(test_file).unwrap();let mut data: Vec<u8> = vec![];- f.read_to_end(&mut data);+ f.read_to_end(&mut data).unwrap();let pdf_file = pdfium.load_pdf_from_byte_vec(data, None).unwrap();let (refs, text) = ref_id_extract_text(&pdf_file);println!("{}", text);diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.tomlindex e2fee9d326..690ce190b9 100644--- a/rust/cloud-storage/email_service/Cargo.toml+++ b/rust/cloud-storage/email_service/Cargo.toml@@ -22,12 +22,17 @@ name = "backfill_search"path = "src/bin/backfill_search/backfill_search.rs"[features]-disable_attachment_upload = []-disable_connection_gateway = []-disable_contacts_sync = []-disable_gmail_webhook_auth = []-disable_sfs_map = []+attachment_upload = []+connection_gateway = []+contacts_sync = []+default = [+ "attachment_upload",+ "connection_gateway",+ "contacts_sync",+ "sfs_map",+]local_queue = []+sfs_map = [][dependencies]anyhow = { workspace = true }diff --git a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs b/rust/cloud-storage/email_service/src/api/email/attachments/get.rsindex ffdbe4d89d..debfff0030 100644--- a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs+++ b/rust/cloud-storage/email_service/src/api/email/attachments/get.rs@@ -182,7 +182,7 @@ pub async fn upload_single_attachment(attachment: &mut service::attachment::Attachment,attachment_data: Vec<u8>,) -> anyhow::Result<String> {- if cfg!(feature = "disable_attachment_upload") {+ if cfg!(not(feature = "attachment_upload")) {attachment.data_url = Some("https://example.com/mock-url".to_string());return Ok("https://example.com/mock-url".to_string());}diff --git a/rust/cloud-storage/email_service/src/api/email/messages/send.rs b/rust/cloud-storage/email_service/src/api/email/messages/send.rsindex d7267d1585..d4d1426643 100644--- a/rust/cloud-storage/email_service/src/api/email/messages/send.rs+++ b/rust/cloud-storage/email_service/src/api/email/messages/send.rs@@ -212,12 +212,12 @@ async fn insert_sent_message();message_to_send.thread_db_id = thread_db_id;}- Some(id) => {+ Some(thread_db_id) => {// need to upsert the thread's provider_id in case it doesn't exist already (e.g. if we are// sending a previously existing draft that is the first message in the thread)email_db_client::threads::update::update_thread_provider_id(tx,- id,+ thread_db_id,link_id,&thread_provider_id.clone().unwrap(),)@@ -225,7 +225,7 @@ async fn insert_sent_message(.context(format!("Failed to update provider id to {} for thread {}",thread_provider_id.clone().unwrap(),- id+ thread_db_id))?;}}diff --git a/rust/cloud-storage/email_service/src/api/gmail/webhook.rs b/rust/cloud-storage/email_service/src/api/gmail/webhook.rsindex 8d5952c415..8b1df92602 100644--- a/rust/cloud-storage/email_service/src/api/gmail/webhook.rs+++ b/rust/cloud-storage/email_service/src/api/gmail/webhook.rs@@ -21,10 +21,8 @@ pub async fn webhook_handler(headers: HeaderMap,extract::Json(req): extract::Json<GmailWebhookPayload>,) -> Result<Response, Response> {- if !cfg!(feature = "disable_gmail_webhook_auth") {- // Validate the token in the headers sent from Google- validate_google_token(&ctx, &headers).await?;- }+ // Validate the token in the headers sent from Google+ validate_google_token(&ctx, &headers).await?;let email_address = &req.message.data.email_address;let link = email_db_client::links::get::fetch_link_by_email(diff --git a/rust/cloud-storage/email_service/src/main.rs b/rust/cloud-storage/email_service/src/main.rsindex e0f318dbb6..9e49ec8877 100644--- a/rust/cloud-storage/email_service/src/main.rs+++ b/rust/cloud-storage/email_service/src/main.rs@@ -295,7 +295,7 @@ async fn main() -> anyhow::Result<()> {.await;});- if !cfg!(feature = "disable_sfs_map") {+ if cfg!(feature = "sfs_map") {for worker in sfs_uploader_workers {let db_sfs_uploader = db.clone();let sfs_client_sfs_uploader = sfs_client.clone();diff --git a/rust/cloud-storage/email_service/src/pubsub/backfill/increment_counters.rs b/rust/cloud-storage/email_service/src/pubsub/backfill/increment_counters.rsindex 99fc830d13..6a5e22e944 100644--- a/rust/cloud-storage/email_service/src/pubsub/backfill/increment_counters.rs+++ b/rust/cloud-storage/email_service/src/pubsub/backfill/increment_counters.rs@@ -123,9 +123,7 @@ async fn handle_attachment_upload(job_id: Uuid,) -> Result<(), ProcessingError> {// temporarily only enabling for macro emails for testing- if !link.macro_id.as_ref().ends_with("@macro.com")- || cfg!(feature = "disable_attachment_upload")- {+ if !link.macro_id.as_ref().ends_with("@macro.com") || cfg!(not(feature = "attachment_upload")) {return Ok(());}@@ -152,7 +150,7 @@ async fn handle_attachment_upload(#[tracing::instrument(skip(ctx))]async fn handle_contacts_sync(ctx: &PubSubContext, link: &Link) -> Result<(), ProcessingError> {- if cfg!(feature = "disable_contacts_sync") {+ if cfg!(not(feature = "contacts_sync")) {return Ok(());}@@ -237,9 +235,7 @@ async fn handle_thread_completed(})?;// temporarily only for macro emails, for testing- if link.macro_id.as_ref().ends_with("@macro.com")- && !cfg!(feature = "disable_attachment_upload")- {+ if link.macro_id.as_ref().ends_with("@macro.com") && !cfg!(not(feature = "attachment_upload")) {let attachments =email_db_client::attachments::provider::upload::fetch_thread_attachments_for_backfill(&ctx.db,diff --git a/rust/cloud-storage/email_service/src/pubsub/util.rs b/rust/cloud-storage/email_service/src/pubsub/util.rsindex 7f34ee7986..58956b6eab 100644--- a/rust/cloud-storage/email_service/src/pubsub/util.rs+++ b/rust/cloud-storage/email_service/src/pubsub/util.rs@@ -72,11 +72,12 @@ pub async fn complete_transaction_with_processing_error<T>(/// Send message to connection gateway to trigger email refresh if user is active on FE#[tracing::instrument(skip(client), level = "debug")]pub async fn cg_refresh_email(client: &ConnectionGatewayClient, macro_id: &str, event_type: &str) {- #[cfg(not(feature = "disable_connection_gateway"))]- let _ = client- .refresh_email(macro_id, event_type)- .await- .inspect_err(|e| tracing::error!(macro_id = %macro_id, "Failed to refresh email: {e}"));+ if cfg!(feature = "connection_gateway") {+ let _ = client+ .refresh_email(macro_id, event_type)+ .await+ .inspect_err(|e| tracing::error!(macro_id = %macro_id, "Failed to refresh email: {e}"));+ }}pub async fn fetch_access_token_for_link(diff --git a/rust/cloud-storage/email_service/src/pubsub/webhook/operations/upsert_message.rs b/rust/cloud-storage/email_service/src/pubsub/webhook/operations/upsert_message.rsindex 9838f98623..6bfe5f9b2b 100644--- a/rust/cloud-storage/email_service/src/pubsub/webhook/operations/upsert_message.rs+++ b/rust/cloud-storage/email_service/src/pubsub/webhook/operations/upsert_message.rs@@ -181,7 +181,7 @@ async fn handle_attachment_upload() -> result::Result<(), ProcessingError> {// temporarily only for macro emails, for testing purposesif !link.macro_id.0.as_ref().ends_with("@macro.com")- || cfg!(feature = "disable_attachment_upload")+ || cfg!(not(feature = "attachment_upload"))|| message_attachment_count == 0{return Ok(());@@ -239,7 +239,7 @@ async fn handle_contacts_sync(provider_message_id: &str,) -> result::Result<(), ProcessingError> {// if the user sent the message, upsert contacts for its recipients in contacts-service.- if !cfg!(feature = "disable_contacts_sync") || !is_sent || recipient_emails.is_empty() {+ if cfg!(feature = "contacts_sync") || !is_sent || recipient_emails.is_empty() {return Ok(());}diff --git a/rust/cloud-storage/email_service/src/util/process_pre_insert/sfs_map.rs b/rust/cloud-storage/email_service/src/util/process_pre_insert/sfs_map.rsindex 67ffca192a..684e43bd32 100644--- a/rust/cloud-storage/email_service/src/util/process_pre_insert/sfs_map.rs+++ b/rust/cloud-storage/email_service/src/util/process_pre_insert/sfs_map.rs@@ -23,7 +23,7 @@ pub async fn store_threads_images(db: &PgPool,sfs_client: &StaticFileServiceClient,) {- if cfg!(feature = "disable_sfs_map") {+ if cfg!(not(feature = "sfs_map")) {return;}@@ -504,8 +504,8 @@ mod tests {);// Specifically test that data URLs and CID URLs are excluded- assert!(!result.contains(&"data:image/png;base64,iVBORw0KGgo".to_string()));- assert!(!result.contains(&"cid:content-id-12345".to_string()));+ assert!(!result.contains("data:image/png;base64,iVBORw0KGgo"));+ assert!(!result.contains("cid:content-id-12345"));// Verify deduplication workslet duplicate_count = result@@ -604,46 +604,41 @@ mod tests {assert_eq!(result, expected_urls);}- #[cfg(test)]- mod tests {- use super::*;- use std::collections::HashMap;-- #[test]- fn test_rewrite_html_image_links_with_src_and_srcset() {- // Create a mapping of original URLs to SFS URLs- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image1.jpg".to_string(),- "https://static-file-service.macro.com/f123/image1.jpg".to_string(),- );- url_map.insert(- "https://example.com/small.jpg".to_string(),- "https://static-file-service.macro.com/f124/small.jpg".to_string(),- );- url_map.insert(- "https://example.com/medium.jpg".to_string(),- "https://static-file-service.macro.com/f125/medium.jpg".to_string(),- );- url_map.insert(- "https://example.com/large.jpg".to_string(),- "https://static-file-service.macro.com/f126/large.jpg".to_string(),- );- url_map.insert(- "https://picsum.photos/600/300".to_string(),- "https://static-file-service.macro.com/f127/picsum600.jpg".to_string(),- );- url_map.insert(- "https://picsum.photos/320/160".to_string(),- "https://static-file-service.macro.com/f128/picsum320.jpg".to_string(),- );- url_map.insert(- "https://picsum.photos/480/240".to_string(),- "https://static-file-service.macro.com/f129/picsum480.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_src_and_srcset() {+ // Create a mapping of original URLs to SFS URLs+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image1.jpg".to_string(),+ "https://static-file-service.macro.com/f123/image1.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/small.jpg".to_string(),+ "https://static-file-service.macro.com/f124/small.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/medium.jpg".to_string(),+ "https://static-file-service.macro.com/f125/medium.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/large.jpg".to_string(),+ "https://static-file-service.macro.com/f126/large.jpg".to_string(),+ );+ url_map.insert(+ "https://picsum.photos/600/300".to_string(),+ "https://static-file-service.macro.com/f127/picsum600.jpg".to_string(),+ );+ url_map.insert(+ "https://picsum.photos/320/160".to_string(),+ "https://static-file-service.macro.com/f128/picsum320.jpg".to_string(),+ );+ url_map.insert(+ "https://picsum.photos/480/240".to_string(),+ "https://static-file-service.macro.com/f129/picsum480.jpg".to_string(),+ );- // HTML with both src and srcset attributes- let original_html = r#"<!DOCTYPE html>+ // HTML with both src and srcset attributes+ let original_html = r#"<!DOCTYPE html><html><body><h1>Test Email</h1>@@ -675,61 +670,53 @@ mod tests {</body></html>"#;- // Call the function to test- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ // Call the function to test+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check for specific macro.com URLs in the result- assert!(- result.contains("src=\"https://static-file-service.macro.com/f123/image1.jpg\"")- );- assert!(- result- .contains("srcset=\"https://static-file-service.macro.com/f124/small.jpg 320w")- );- assert!(result.contains("https://static-file-service.macro.com/f125/medium.jpg 800w"));- assert!(- result.contains("https://static-file-service.macro.com/f126/large.jpg 1200w\"")- );- assert!(- result.contains("src=\"https://static-file-service.macro.com/f127/picsum600.jpg\"")- );- assert!(result.contains(- "srcset=\"https://static-file-service.macro.com/f128/picsum320.jpg 320w"- ));- assert!(- result.contains("https://static-file-service.macro.com/f129/picsum480.jpg 480w")- );- assert!(- result.contains("https://static-file-service.macro.com/f127/picsum600.jpg 600w\"")- );+ // Check for specific macro.com URLs in the result+ assert!(result.contains("src=\"https://static-file-service.macro.com/f123/image1.jpg\""));+ assert!(+ result.contains("srcset=\"https://static-file-service.macro.com/f124/small.jpg 320w")+ );+ assert!(result.contains("https://static-file-service.macro.com/f125/medium.jpg 800w"));+ assert!(result.contains("https://static-file-service.macro.com/f126/large.jpg 1200w\""));+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/f127/picsum600.jpg\"")+ );+ assert!(+ result+ .contains("srcset=\"https://static-file-service.macro.com/f128/picsum320.jpg 320w")+ );+ assert!(result.contains("https://static-file-service.macro.com/f129/picsum480.jpg 480w"));+ assert!(result.contains("https://static-file-service.macro.com/f127/picsum600.jpg 600w\""));- // URLs not in the map should remain unchanged- assert!(result.contains("src=\"https://example.com/not-in-map.jpg\""));- assert!(result.contains("https://example.com/not-in-map-1.jpg 800w"));- }+ // URLs not in the map should remain unchanged+ assert!(result.contains("src=\"https://example.com/not-in-map.jpg\""));+ assert!(result.contains("https://example.com/not-in-map-1.jpg 800w"));+ }- #[test]- fn test_rewrite_html_image_links_with_complex_srcset() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/img-1x.jpg".to_string(),- "https://static-file-service.macro.com/a1b2c3/img-1x.jpg".to_string(),- );- url_map.insert(- "https://example.com/img-2x.jpg".to_string(),- "https://static-file-service.macro.com/d4e5f6/img-2x.jpg".to_string(),- );- url_map.insert(- "https://example.com/img-3x.jpg".to_string(),- "https://static-file-service.macro.com/g7h8i9/img-3x.jpg".to_string(),- );- url_map.insert(- "https://example.com/img-4x.jpg".to_string(),- "https://static-file-service.macro.com/j0k1l2/img-4x.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_complex_srcset() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/img-1x.jpg".to_string(),+ "https://static-file-service.macro.com/a1b2c3/img-1x.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/img-2x.jpg".to_string(),+ "https://static-file-service.macro.com/d4e5f6/img-2x.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/img-3x.jpg".to_string(),+ "https://static-file-service.macro.com/g7h8i9/img-3x.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/img-4x.jpg".to_string(),+ "https://static-file-service.macro.com/j0k1l2/img-4x.jpg".to_string(),+ );- // Test with density descriptors and unusual formatting- let original_html = r#"<!DOCTYPE html>+ // Test with density descriptors and unusual formatting+ let original_html = r#"<!DOCTYPE html><html><body><!-- Srcset with density descriptors -->@@ -749,51 +736,42 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check density descriptors are preserved with macro.com URLs- assert!(- result.contains(- "srcset=\"https://static-file-service.macro.com/a1b2c3/img-1x.jpg 1x"- )- );- assert!(result.contains("https://static-file-service.macro.com/d4e5f6/img-2x.jpg 2x"));- assert!(- result.contains("https://static-file-service.macro.com/g7h8i9/img-3x.jpg 3x\"")- );+ // Check density descriptors are preserved with macro.com URLs+ assert!(+ result.contains("srcset=\"https://static-file-service.macro.com/a1b2c3/img-1x.jpg 1x")+ );+ assert!(result.contains("https://static-file-service.macro.com/d4e5f6/img-2x.jpg 2x"));+ assert!(result.contains("https://static-file-service.macro.com/g7h8i9/img-3x.jpg 3x\""));- // Check unusual formatting is normalized but descriptors preserved- assert!(- result.contains(- "srcset=\"https://static-file-service.macro.com/a1b2c3/img-1x.jpg 1x, "- )- );- assert!(- result.contains("https://static-file-service.macro.com/d4e5f6/img-2x.jpg 2x, ")- );- assert!(- result.contains("https://static-file-service.macro.com/j0k1l2/img-4x.jpg 4x\"")- );- }+ // Check unusual formatting is normalized but descriptors preserved+ assert!(+ result+ .contains("srcset=\"https://static-file-service.macro.com/a1b2c3/img-1x.jpg 1x, ")+ );+ assert!(result.contains("https://static-file-service.macro.com/d4e5f6/img-2x.jpg 2x, "));+ assert!(result.contains("https://static-file-service.macro.com/j0k1l2/img-4x.jpg 4x\""));+ }- #[test]- fn test_rewrite_html_image_links_with_multiple_img_tags() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/banner.jpg".to_string(),- "https://static-file-service.macro.com/files/banner-12345.jpg".to_string(),- );- url_map.insert(- "https://example.com/logo.png".to_string(),- "https://static-file-service.macro.com/files/logo-67890.png".to_string(),- );- url_map.insert(- "https://example.com/profile.jpg".to_string(),- "https://static-file-service.macro.com/files/profile-abcde.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_multiple_img_tags() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/banner.jpg".to_string(),+ "https://static-file-service.macro.com/files/banner-12345.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/logo.png".to_string(),+ "https://static-file-service.macro.com/files/logo-67890.png".to_string(),+ );+ url_map.insert(+ "https://example.com/profile.jpg".to_string(),+ "https://static-file-service.macro.com/files/profile-abcde.jpg".to_string(),+ );- // Test with multiple img tags in complex HTML structure- let original_html = r#"<!DOCTYPE html>+ // Test with multiple img tags in complex HTML structure+ let original_html = r#"<!DOCTYPE html><html><head><title>Test Multiple Images</title>@@ -816,40 +794,36 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check all images are rewritten with macro.com URLs- assert!(- result- .contains("src=\"https://static-file-service.macro.com/files/logo-67890.png\"")- );- assert!(- result.contains(- "src=\"https://static-file-service.macro.com/files/banner-12345.jpg\""- )- );- assert!(- result.contains(- "src=\"https://static-file-service.macro.com/files/profile-abcde.jpg\""- )- );+ // Check all images are rewritten with macro.com URLs+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/files/logo-67890.png\"")+ );+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/files/banner-12345.jpg\"")+ );+ assert!(+ result+ .contains("src=\"https://static-file-service.macro.com/files/profile-abcde.jpg\"")+ );- // Check HTML structure is preserved- assert!(result.contains("<header>"));- assert!(result.contains("<article>"));- assert!(result.contains("<div class=\"profile\">"));- }+ // Check HTML structure is preserved+ assert!(result.contains("<header>"));+ assert!(result.contains("<article>"));+ assert!(result.contains("<div class=\"profile\">"));+ }- #[test]- fn test_rewrite_html_image_links_with_no_matches() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/not-in-html.jpg".to_string(),- "https://static-file-service.macro.com/not-in-html-uuid.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_no_matches() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/not-in-html.jpg".to_string(),+ "https://static-file-service.macro.com/not-in-html-uuid.jpg".to_string(),+ );- // Test with no matching URLs- let original_html = r#"<!DOCTYPE html>+ // Test with no matching URLs+ let original_html = r#"<!DOCTYPE html><html><body><img src="https://example.com/image1.jpg" alt="Image 1">@@ -859,20 +833,20 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Original HTML should be unchanged- assert!(result.contains("src=\"https://example.com/image1.jpg\""));- assert!(result.contains("src=\"https://example.com/image2.jpg\""));- assert!(result.contains("srcset=\"https://example.com/image2-small.jpg 320w,"));- assert!(result.contains("https://example.com/image2-large.jpg 800w\""));- }+ // Original HTML should be unchanged+ assert!(result.contains("src=\"https://example.com/image1.jpg\""));+ assert!(result.contains("src=\"https://example.com/image2.jpg\""));+ assert!(result.contains("srcset=\"https://example.com/image2-small.jpg 320w,"));+ assert!(result.contains("https://example.com/image2-large.jpg 800w\""));+ }- #[test]- fn test_rewrite_html_image_links_with_empty_map() {- let url_map = HashMap::new();+ #[test]+ fn test_rewrite_html_image_links_with_empty_map() {+ let url_map = HashMap::new();- let original_html = r#"<!DOCTYPE html>+ let original_html = r#"<!DOCTYPE html><html><body><img src="https://example.com/image.jpg" alt="Image">@@ -881,22 +855,22 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Original HTML should be unchanged- assert_eq!(result, original_html);- }+ // Original HTML should be unchanged+ assert_eq!(result, original_html);+ }- #[test]- fn test_rewrite_html_image_links_maintains_other_attributes() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image.jpg".to_string(),- "https://static-file-service.macro.com/cache/image-uuid123.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_maintains_other_attributes() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image.jpg".to_string(),+ "https://static-file-service.macro.com/cache/image-uuid123.jpg".to_string(),+ );- // Test that other attributes are preserved- let original_html = r#"<!DOCTYPE html>+ // Test that other attributes are preserved+ let original_html = r#"<!DOCTYPE html><html><body><img src="https://example.com/image.jpg"@@ -910,82 +884,85 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check URL is rewritten with macro.com URL- assert!(- result.contains(- "src=\"https://static-file-service.macro.com/cache/image-uuid123.jpg\""- )- );+ // Check URL is rewritten with macro.com URL+ assert!(+ result+ .contains("src=\"https://static-file-service.macro.com/cache/image-uuid123.jpg\"")+ );- // Check other attributes are preserved- assert!(result.contains("alt=\"Description\""));- assert!(result.contains("width=\"300\""));- assert!(result.contains("height=\"200\""));- assert!(result.contains("loading=\"lazy\""));- assert!(result.contains("class=\"responsive-image\""));- assert!(result.contains("id=\"hero-image\""));- assert!(result.contains("data-custom=\"value\""));- }+ // Check other attributes are preserved+ assert!(result.contains("alt=\"Description\""));+ assert!(result.contains("width=\"300\""));+ assert!(result.contains("height=\"200\""));+ assert!(result.contains("loading=\"lazy\""));+ assert!(result.contains("class=\"responsive-image\""));+ assert!(result.contains("id=\"hero-image\""));+ assert!(result.contains("data-custom=\"value\""));+ }- #[test]- fn test_rewrite_html_image_links_with_whitespace_in_urls() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image.jpg".to_string(),- "https://static-file-service.macro.com/whitespace-test/image.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_whitespace_in_urls() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image.jpg".to_string(),+ "https://static-file-service.macro.com/whitespace-test/image.jpg".to_string(),+ );- // Test with whitespace in URLs- let original_html = r#"<!DOCTYPE html>+ // Test with whitespace in URLs+ let original_html = r#"<!DOCTYPE html><html><body><img src=" https://example.com/image.jpg " alt="Image with whitespace"></body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check URL is rewritten despite whitespace with macro.com URL- assert!(result.contains(+ // Check URL is rewritten despite whitespace with macro.com URL+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/whitespace-test/image.jpg\""- ));- }+ )+ );+ }- #[test]- fn test_rewrite_html_image_links_with_malformed_html() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image.jpg".to_string(),- "https://static-file-service.macro.com/malformed/image-abc123.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_malformed_html() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image.jpg".to_string(),+ "https://static-file-service.macro.com/malformed/image-abc123.jpg".to_string(),+ );- // Test with malformed HTML- let malformed_html = r#"<img src="https://example.com/image.jpg" alt="Unclosed tag"+ // Test with malformed HTML+ let malformed_html = r#"<img src="https://example.com/image.jpg" alt="Unclosed tag"<p>Missing closing tag<div>Nested unclosed tags<img src="https://example.com/image.jpg">"#;- // The function should still work with malformed HTML- let result = rewrite_html_image_links(malformed_html, &url_map).unwrap();+ // The function should still work with malformed HTML+ let result = rewrite_html_image_links(malformed_html, &url_map).unwrap();- // Check URL is still rewritten with macro.com URL- assert!(result.contains(+ // Check URL is still rewritten with macro.com URL+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/malformed/image-abc123.jpg\""- ));- }+ )+ );+ }- #[test]- fn test_rewrite_html_image_links_with_html_entities() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image.jpg".to_string(),- "https://static-file-service.macro.com/entities-test/image-xyz789.jpg".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_html_entities() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image.jpg".to_string(),+ "https://static-file-service.macro.com/entities-test/image-xyz789.jpg".to_string(),+ );- // Test with HTML entities in the document- let html_with_entities = r#"<!DOCTYPE html>+ // Test with HTML entities in the document+ let html_with_entities = r#"<!DOCTYPE html><html><body><p>Text with & entity and "quotes"</p>@@ -993,32 +970,30 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(html_with_entities, &url_map).unwrap();+ let result = rewrite_html_image_links(html_with_entities, &url_map).unwrap();- // Check URL is rewritten with macro.com URL and entities are preserved- assert!(result.contains(- "src=\"https://static-file-service.macro.com/entities-test/image-xyz789.jpg\""- ));- assert!(result.contains("& entity"));- assert!(result.contains(""quotes""));- }+ // Check URL is rewritten with macro.com URL and entities are preserved+ assert!(result.contains(+ "src=\"https://static-file-service.macro.com/entities-test/image-xyz789.jpg\""+ ));+ assert!(result.contains("& entity"));+ assert!(result.contains(""quotes""));+ }- #[test]- fn test_rewrite_html_image_links_with_multiple_srcset_attributes() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/image-1.jpg".to_string(),- "https://static-file-service.macro.com/multi-srcset/image-1-uuid456.jpg"- .to_string(),- );- url_map.insert(- "https://example.com/image-2.jpg".to_string(),- "https://static-file-service.macro.com/multi-srcset/image-2-uuid789.jpg"- .to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_multiple_srcset_attributes() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/image-1.jpg".to_string(),+ "https://static-file-service.macro.com/multi-srcset/image-1-uuid456.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/image-2.jpg".to_string(),+ "https://static-file-service.macro.com/multi-srcset/image-2-uuid789.jpg".to_string(),+ );- // Multiple img tags with srcset- let original_html = r#"<!DOCTYPE html>+ // Multiple img tags with srcset+ let original_html = r#"<!DOCTYPE html><html><body><img srcset="https://example.com/image-1.jpg 1x" alt="First image">@@ -1026,43 +1001,47 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check both srcsets are rewritten with macro.com URLs- assert!(result.contains("srcset=\"https://static-file-service.macro.com/multi-srcset/image-1-uuid456.jpg 1x\""));- assert!(result.contains("srcset=\"https://static-file-service.macro.com/multi-srcset/image-2-uuid789.jpg 1x\""));- }+ // Check both srcsets are rewritten with macro.com URLs+ assert!(result.contains(+ "srcset=\"https://static-file-service.macro.com/multi-srcset/image-1-uuid456.jpg 1x\""+ ));+ assert!(result.contains(+ "srcset=\"https://static-file-service.macro.com/multi-srcset/image-2-uuid789.jpg 1x\""+ ));+ }- #[test]- fn test_rewrite_html_image_links_with_realistic_email_template() {- let mut url_map = HashMap::new();- url_map.insert(- "https://example.com/header-logo.png".to_string(),- "https://static-file-service.macro.com/email/header-logo-e7d9f2.png".to_string(),- );- url_map.insert(- "https://example.com/hero-small.jpg".to_string(),- "https://static-file-service.macro.com/email/hero-small-a1b2c3.jpg".to_string(),- );- url_map.insert(- "https://example.com/hero-medium.jpg".to_string(),- "https://static-file-service.macro.com/email/hero-medium-d4e5f6.jpg".to_string(),- );- url_map.insert(- "https://example.com/hero-large.jpg".to_string(),- "https://static-file-service.macro.com/email/hero-large-g7h8i9.jpg".to_string(),- );- url_map.insert(- "https://example.com/product-1.jpg".to_string(),- "https://static-file-service.macro.com/email/product-1-j0k1l2.jpg".to_string(),- );- url_map.insert(- "https://example.com/footer-logo.png".to_string(),- "https://static-file-service.macro.com/email/footer-logo-m3n4p5.png".to_string(),- );+ #[test]+ fn test_rewrite_html_image_links_with_realistic_email_template() {+ let mut url_map = HashMap::new();+ url_map.insert(+ "https://example.com/header-logo.png".to_string(),+ "https://static-file-service.macro.com/email/header-logo-e7d9f2.png".to_string(),+ );+ url_map.insert(+ "https://example.com/hero-small.jpg".to_string(),+ "https://static-file-service.macro.com/email/hero-small-a1b2c3.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/hero-medium.jpg".to_string(),+ "https://static-file-service.macro.com/email/hero-medium-d4e5f6.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/hero-large.jpg".to_string(),+ "https://static-file-service.macro.com/email/hero-large-g7h8i9.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/product-1.jpg".to_string(),+ "https://static-file-service.macro.com/email/product-1-j0k1l2.jpg".to_string(),+ );+ url_map.insert(+ "https://example.com/footer-logo.png".to_string(),+ "https://static-file-service.macro.com/email/footer-logo-m3n4p5.png".to_string(),+ );- // Realistic email template with multiple images- let original_html = r#"<!DOCTYPE html>+ // Realistic email template with multiple images+ let original_html = r#"<!DOCTYPE html><html><head><title>Monthly Newsletter</title>@@ -1095,30 +1074,35 @@ mod tests {</body></html>"#;- let result = rewrite_html_image_links(original_html, &url_map).unwrap();+ let result = rewrite_html_image_links(original_html, &url_map).unwrap();- // Check all URLs are replaced with macro.com URLs- assert!(result.contains(- "src=\"https://static-file-service.macro.com/email/header-logo-e7d9f2.png\""- ));- assert!(result.contains(- "src=\"https://static-file-service.macro.com/email/hero-medium-d4e5f6.jpg\""- ));- assert!(result.contains(- "srcset=\"https://static-file-service.macro.com/email/hero-small-a1b2c3.jpg 320w,"- ));- assert!(result.contains(+ // Check all URLs are replaced with macro.com URLs+ assert!(result.contains(+ "src=\"https://static-file-service.macro.com/email/header-logo-e7d9f2.png\""+ ));+ assert!(result.contains(+ "src=\"https://static-file-service.macro.com/email/hero-medium-d4e5f6.jpg\""+ ));+ assert!(result.contains(+ "srcset=\"https://static-file-service.macro.com/email/hero-small-a1b2c3.jpg 320w,"+ ));+ assert!(+ result.contains("https://static-file-service.macro.com/email/hero-medium-d4e5f6.jpg 600w,"- ));- assert!(result.contains(+ )+ );+ assert!(+ result.contains("https://static-file-service.macro.com/email/hero-large-g7h8i9.jpg 1200w\""- ));- assert!(result.contains(+ )+ );+ assert!(+ result.contains("src=\"https://static-file-service.macro.com/email/product-1-j0k1l2.jpg\""- ));- assert!(result.contains(- "src=\"https://static-file-service.macro.com/email/footer-logo-m3n4p5.png\""- ));- }+ )+ );+ assert!(result.contains(+ "src=\"https://static-file-service.macro.com/email/footer-logo-m3n4p5.png\""+ ));}}diff --git a/rust/cloud-storage/email_service/src/util/sync_contacts.rs b/rust/cloud-storage/email_service/src/util/sync_contacts.rsindex a259bd2327..b5d288b427 100644--- a/rust/cloud-storage/email_service/src/util/sync_contacts.rs+++ b/rust/cloud-storage/email_service/src/util/sync_contacts.rs@@ -192,7 +192,7 @@ async fn process_and_store_contacts("Inserted contacts into DB");- if cfg!(feature = "disable_sfs_map") {+ if cfg!(not(feature = "sfs_map")) {return Ok(());}// Async enqueue messages to sfs_uploader worker that populates the sfs_url for the contacts profile imagesdiff --git a/rust/cloud-storage/gmail_client/src/auth.rs b/rust/cloud-storage/gmail_client/src/auth.rsindex 4b33d41182..968c8cb5a8 100644--- a/rust/cloud-storage/gmail_client/src/auth.rs+++ b/rust/cloud-storage/gmail_client/src/auth.rs@@ -119,6 +119,7 @@ mod tests {use anyhow::Context;#[tokio::test]+ #[ignore = "Jwt env var is not available in CI"]async fn test_verify_real_google_jwt() -> anyhow::Result<()> {let gmail_client = super::GmailClient::new("hello".to_string());diff --git a/rust/cloud-storage/insight_service/src/insight/deduplication.rs b/rust/cloud-storage/insight_service/src/insight/deduplication.rsindex d1821f6e40..297d9e07a1 100644--- a/rust/cloud-storage/insight_service/src/insight/deduplication.rs+++ b/rust/cloud-storage/insight_service/src/insight/deduplication.rs@@ -245,16 +245,16 @@ impl InsightDeduplicator {}/// Calculate edit distance between two strings+ #[expect(+ clippy::needless_range_loop,+ reason = "clippy's suggestion here is bad"+ )]fn calculate_edit_distance(&self, s1: &str, s2: &str) -> usize {let len1 = s1.len();let len2 = s2.len();let mut matrix = vec![vec![0; len2 + 1]; len1 + 1];// Initialize first row and column- #[expect(- clippy::needless_range_loop,- reason = "clippy's suggestion here is bad"- )]for i in 0..=len1 {matrix[i][0] = i;}diff --git a/rust/cloud-storage/integration_tests/test_build_full_pdf_modification_data/src/bin/main.rs b/rust/cloud-storage/integration_tests/test_build_full_pdf_modification_data/src/bin/main.rsindex 92b53e1f19..cf6816f143 100644--- a/rust/cloud-storage/integration_tests/test_build_full_pdf_modification_data/src/bin/main.rs+++ b/rust/cloud-storage/integration_tests/test_build_full_pdf_modification_data/src/bin/main.rs@@ -19,17 +19,11 @@ async fn main() {let initial_modification_data =get_pdf_modification_data_for_document(&pool, document_id).await;- if initial_modification_data.is_err() {- panic!("{:?}", initial_modification_data.unwrap_err());- }let initial_modification_data = initial_modification_data.unwrap();let full_modification_data =get_complete_pdf_modification_data(&pool, document_id, Some(initial_modification_data)).await;- if full_modification_data.is_err() {- panic!("{:?}", full_modification_data.unwrap_err());- }println!("{}",diff --git a/rust/cloud-storage/macro_env_var/src/tests.rs b/rust/cloud-storage/macro_env_var/src/tests.rsindex c402585a91..b129db8b14 100644--- a/rust/cloud-storage/macro_env_var/src/tests.rs+++ b/rust/cloud-storage/macro_env_var/src/tests.rs@@ -82,16 +82,3 @@ fn test_struct_with_fields_mock() {fn it_should_panic() {Config::unwrap_new();}--env_var!(- struct MyThirdThing {- Foo,- Bar- }-);--#[test]-#[cfg(feature = "test-comptime")]-fn test_comptime() {- const VALUES: MyThirdThing = MyThirdThing::new_comptime();-}diff --git a/rust/cloud-storage/macro_redis_cluster_client/src/decrement_count.rs b/rust/cloud-storage/macro_redis_cluster_client/src/decrement_count.rsindex 0ef54eb04c..963c7a01d1 100644--- a/rust/cloud-storage/macro_redis_cluster_client/src/decrement_count.rs+++ b/rust/cloud-storage/macro_redis_cluster_client/src/decrement_count.rs@@ -105,6 +105,7 @@ mod tests {use redis::Commands;#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_decrement_count() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");@@ -173,6 +174,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_decrement_counts() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");diff --git a/rust/cloud-storage/macro_redis_cluster_client/src/exists.rs b/rust/cloud-storage/macro_redis_cluster_client/src/exists.rsindex f21e4cbde7..6877076f54 100644--- a/rust/cloud-storage/macro_redis_cluster_client/src/exists.rs+++ b/rust/cloud-storage/macro_redis_cluster_client/src/exists.rs@@ -83,6 +83,7 @@ mod tests {use redis::Commands;#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_exists() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");@@ -106,6 +107,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_find_non_existing_shas() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");diff --git a/rust/cloud-storage/macro_redis_cluster_client/src/increment_count.rs b/rust/cloud-storage/macro_redis_cluster_client/src/increment_count.rsindex 03a5ac2561..c89c0b223d 100644--- a/rust/cloud-storage/macro_redis_cluster_client/src/increment_count.rs+++ b/rust/cloud-storage/macro_redis_cluster_client/src/increment_count.rs@@ -1,9 +1,8 @@+use super::{SHA_COUNT_KEY_PREFIX, SHA_DELETE_BUCKET};use anyhow::Context;use redis::AsyncCommands;use tracing::instrument;-use super::{SHA_COUNT_KEY_PREFIX, SHA_DELETE_BUCKET};-#[instrument(skip(client))]pub(crate) async fn increment_count(client: &redis::cluster::ClusterClient,@@ -73,6 +72,7 @@ mod tests {use redis::Commands;#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_increment_count() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");@@ -101,6 +101,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_increment_counts() {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");diff --git a/rust/cloud-storage/sha_cleanup_worker/src/service/redis/get_shas.rs b/rust/cloud-storage/sha_cleanup_worker/src/service/redis/get_shas.rsindex 718c07ff51..0717468a9a 100644--- a/rust/cloud-storage/sha_cleanup_worker/src/service/redis/get_shas.rs+++ b/rust/cloud-storage/sha_cleanup_worker/src/service/redis/get_shas.rs@@ -25,6 +25,7 @@ mod tests {use redis::Commands;#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_get_set_members() -> Result<(), anyhow::Error> {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");diff --git a/rust/cloud-storage/sha_cleanup_worker/src/service/redis/remove_set_member.rs b/rust/cloud-storage/sha_cleanup_worker/src/service/redis/remove_set_member.rsindex 7cd7af2b00..0d99646d0a 100644--- a/rust/cloud-storage/sha_cleanup_worker/src/service/redis/remove_set_member.rs+++ b/rust/cloud-storage/sha_cleanup_worker/src/service/redis/remove_set_member.rs@@ -53,6 +53,7 @@ mod tests {use redis::Commands;#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_remove_set_member() -> Result<(), anyhow::Error> {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");@@ -90,6 +91,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Redis cluster doesn't exist in CI"]async fn test_remove_set_members() -> Result<(), anyhow::Error> {let redis_client = redis::cluster::ClusterClient::new(vec!["redis://localhost:6369"]).expect("could not connect to redis client");diff --git a/rust/cloud-storage/sha_cleanup_worker/src/service/s3/delete.rs b/rust/cloud-storage/sha_cleanup_worker/src/service/s3/delete.rsindex 5ac0a31d78..2ff1df790c 100644--- a/rust/cloud-storage/sha_cleanup_worker/src/service/s3/delete.rs+++ b/rust/cloud-storage/sha_cleanup_worker/src/service/s3/delete.rs@@ -8,8 +8,7 @@ pub(in crate::service::s3) async fn delete_objects(bucket: &str,objects: Vec<String>,) -> Result<(), anyhow::Error> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}const MAX_DELETE_OBJECTS: usize = 1000;@@ -51,8 +50,7 @@ pub(in crate::service::s3) async fn delete_object(bucket: &str,key: &str,) -> Result<(), anyhow::Error> {- #[cfg(feature = "local")]- {+ if cfg!(feature = "local") {return Ok(());}diff --git a/rust/cloud-storage/static_file_service/src/service/dynamodb/put_item.rs b/rust/cloud-storage/static_file_service/src/service/dynamodb/put_item.rsindex ce65a0c5e5..76ffa8789c 100644--- a/rust/cloud-storage/static_file_service/src/service/dynamodb/put_item.rs+++ b/rust/cloud-storage/static_file_service/src/service/dynamodb/put_item.rs@@ -54,6 +54,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Dynamodb doesn't exist in CI"]async fn test_put_item_with_transaction() -> Result<()> {let client = create_test_client().await?;let test_id = "test_transaction_id";@@ -122,6 +123,7 @@ mod tests {}#[tokio::test]+ #[ignore = "Dynamodb doesn't exist in CI"]async fn test_put_item_idempotency() -> Result<()> {let client = create_test_client().await?;let test_id = "test_idempotency_id";diff --git a/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs b/rust/cloud-storage/unfurl_service/src/unfurl/mod.rsindex 3a6eac365d..8360e81e47 100644--- a/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs+++ b/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs@@ -1,7 +1,6 @@pub mod url_parsers;use anyhow::{Context, Error};-use http::StatusCode;use scraper::{Html, Selector};use serde::{Deserialize, Serialize};use std::collections::HashMap;@@ -24,6 +23,7 @@ pub struct GetUnfurlResponse {pub favicon_url: Option<String>,}+#[cfg_attr(feature = "mock", expect(dead_code))]fn no_tag(tag: &str) -> Error {anyhow::anyhow!(format!("Missing expected tag: [{}]", tag))}@@ -67,6 +67,7 @@ fn parse_document(html_content: &str, url: &Url) -> Result<HashMap<String, StrinOk(meta_tags)}+#[cfg_attr(feature = "mock", expect(dead_code))]fn find_favicon(document: &Html, base_url: &Url) -> Option<String> {let links_selector = Selector::parse("link").ok()?;@@ -96,6 +97,8 @@ pub async fn extract_meta_tags() -> Result<HashMap<String, String>, Box<dyn std::error::Error + Send + Sync>> {// Fetch the HTML content// TODO: how to handle malicious input?++ use http::StatusCode;let url = Url::parse(url).context("invalid url")?;let response = reqwest::get(url.clone()).await?;diff --git a/rust/cloud-storage/worker_trigger/Cargo.toml b/rust/cloud-storage/worker_trigger/Cargo.tomlindex a91da4650d..3b13d26efb 100644--- a/rust/cloud-storage/worker_trigger/Cargo.toml+++ b/rust/cloud-storage/worker_trigger/Cargo.toml@@ -4,9 +4,6 @@ name = "worker_trigger"publish = falseversion = "0.1.0"-[features]-local = []-[dependencies]anyhow = { workspace = true }aws-config = { workspace = true }diff --git a/rust/cloud-storage/worker_trigger/src/service/ecs/mod.rs b/rust/cloud-storage/worker_trigger/src/service/ecs/mod.rsindex 961b0246a8..53580167da 100644--- a/rust/cloud-storage/worker_trigger/src/service/ecs/mod.rs+++ b/rust/cloud-storage/worker_trigger/src/service/ecs/mod.rs@@ -1,7 +1,5 @@mod run_task;use aws_sdk_ecs as ecs;-#[allow(unused_imports)]-use mockall::automock;#[cfg(not(test))]pub use ECSClient as ECS;@@ -14,7 +12,7 @@ pub struct ECSClient {inner: ecs::Client,}-#[cfg_attr(test, automock)]+#[cfg_attr(test, mockall::automock)]impl ECSClient {pub fn new(inner: ecs::Client) -> Self {Self { inner }diff --git a/rust/cloud-storage/worker_trigger/src/service/ecs/run_task.rs b/rust/cloud-storage/worker_trigger/src/service/ecs/run_task.rsindex 83a3827fbf..66e8491049 100644--- a/rust/cloud-storage/worker_trigger/src/service/ecs/run_task.rs+++ b/rust/cloud-storage/worker_trigger/src/service/ecs/run_task.rs@@ -9,12 +9,6 @@ pub(in crate::service::ecs) async fn run_task(cluster: &str,subnets: Vec<String>,) -> Result<(), anyhow::Error> {- #[cfg(feature = "local")]- {- tracing::trace!("task");- return Ok(());- }-let aws_vpc_configuration: AwsVpcConfiguration = AwsVpcConfiguration::builder().set_subnets(Some(subnets)).assign_public_ip(AssignPublicIp::Disabled)