Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

seanaye/chore/bump tracing (#922)

Sean Ayea83bbb707b75
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index 2f7be26f64..14336b6d26 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -2420,6 +2420,7 @@ dependencies = [
"s3_client",
"sns_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -2439,6 +2440,7 @@ dependencies = [
"openssl",
"sqlx",
"tokio",
+ "tracing",
]
[[package]]
@@ -2498,6 +2500,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
"urlencoding",
]
@@ -2826,6 +2829,7 @@ dependencies = [
"serde_json",
"sqlx",
"tokio",
+ "tracing",
"urlencoding",
"uuid",
]
@@ -2860,6 +2864,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
"urlencoding",
"zip",
]
@@ -3088,6 +3093,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -3106,6 +3112,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -3215,6 +3222,7 @@ dependencies = [
"sqlx",
"strum",
"tokio",
+ "tracing",
]
[[package]]
@@ -6096,6 +6104,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -6113,6 +6122,7 @@ dependencies = [
"sqlx",
"sqs_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -7627,6 +7637,7 @@ dependencies = [
"openssl",
"sqs_client",
"tokio",
+ "tracing",
"urlencoding",
]
@@ -9073,9 +9084,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
-version = "0.1.41"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"log",
"pin-project-lite",
@@ -9085,9 +9096,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.28"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
@@ -9096,9 +9107,9 @@ dependencies = [
[[package]]
name = "tracing-core"
-version = "0.1.33"
+version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
"valuable",
@@ -9137,9 +9148,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.20"
+version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
+checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
dependencies = [
"matchers",
"nu-ansi-term",
@@ -9373,6 +9384,7 @@ dependencies = [
"tokio",
"tokio-stream",
"tokio-util",
+ "tracing",
"walkdir",
"zip",
]
@@ -9394,6 +9406,7 @@ dependencies = [
"serde_json",
"sqs_client",
"tokio",
+ "tracing",
]
[[package]]
@@ -10087,6 +10100,7 @@ dependencies = [
"mockall",
"serde_json",
"tokio",
+ "tracing",
]
[[package]]
diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.toml
index 969ce75ac0..4872757e97 100644
--- a/rust/cloud-storage/Cargo.toml
+++ b/rust/cloud-storage/Cargo.toml
@@ -191,8 +191,8 @@ tower-http = { version = "0.6.1", features = [
"cors",
"trace",
] }
-tracing = "0.1.41"
-tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
+tracing = "0.1.44"
+tracing-subscriber = { version = "0.3.22", features = ["env-filter", "json"] }
tracing-tree = "0.4.0"
unsynn = "0.3"
urlencoding = "2.1.3"
diff --git a/rust/cloud-storage/authentication_service/src/api/context.rs b/rust/cloud-storage/authentication_service/src/api/context.rs
index e8528cff3a..f17e7527eb 100644
--- a/rust/cloud-storage/authentication_service/src/api/context.rs
+++ b/rust/cloud-storage/authentication_service/src/api/context.rs
@@ -20,7 +20,7 @@ use teams::{
#[derive(Clone, FromRef)]
pub(crate) struct ApiContext {
pub db: PgPool,
- pub auth_client: Arc<crate::service::fusionauth_client::FusionAuthClient>,
+ pub auth_client: Arc<authentication_service::service::fusionauth_client::FusionAuthClient>,
pub macro_cache_client: Arc<MacroCache>,
pub stripe_client: Arc<stripe::Client>,
pub comms_client: Arc<comms_service_client::CommsServiceClient>,
diff --git a/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs b/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
index e459760f63..d87d177983 100644
--- a/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/email/verify_email_link.rs
@@ -5,10 +5,8 @@ use axum::{
response::{IntoResponse, Redirect, Response},
};
-use crate::{
- api::{context::ApiContext, utils::default_redirect_url},
- service::user::create_user::create_user_profile,
-};
+use crate::api::{context::ApiContext, utils::default_redirect_url};
+use authentication_service::service::user::create_user::create_user_profile;
use model::{
response::{EmptyResponse, ErrorResponse},
diff --git a/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs b/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
index 51cb2b4a53..69c1579800 100644
--- a/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
+++ b/rust/cloud-storage/authentication_service/src/api/internal/google_access_token.rs
@@ -1,4 +1,4 @@
-use crate::service::fusionauth_client::FusionAuthClient;
+use authentication_service::service::fusionauth_client::FusionAuthClient;
use axum::{
Json,
extract::{self, State},
diff --git a/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs b/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
index 63c5b67eb7..90f2ebfe2d 100644
--- a/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
+++ b/rust/cloud-storage/authentication_service/src/api/internal/remove_link.rs
@@ -1,5 +1,5 @@
use crate::api::context::ApiContext;
-use crate::service::fusionauth_client::error::FusionAuthClientError;
+use authentication_service::service::fusionauth_client::error::FusionAuthClientError;
use axum::{
Json,
diff --git a/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs b/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
index 254f5cbfae..66d18fc421 100644
--- a/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
+++ b/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
@@ -1,9 +1,9 @@
-use crate::{
- api::{
- context::TokenContext,
- utils::{create_access_token_cookie, create_refresh_token_cookie},
- },
- service::fusionauth_client::{FusionAuthClient, error::FusionAuthClientError},
+use crate::api::{
+ context::TokenContext,
+ utils::{create_access_token_cookie, create_refresh_token_cookie},
+};
+use authentication_service::service::fusionauth_client::{
+ FusionAuthClient, error::FusionAuthClientError,
};
use axum::{
Extension, Json,
diff --git a/rust/cloud-storage/authentication_service/src/api/login/password.rs b/rust/cloud-storage/authentication_service/src/api/login/password.rs
index afe41593b6..e4781bf6aa 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/password.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/password.rs
@@ -1,10 +1,8 @@
-use crate::{
- api::{
- context::ApiContext,
- utils::{create_access_token_cookie, create_refresh_token_cookie},
- },
- service::fusionauth_client::error::FusionAuthClientError,
+use crate::api::{
+ context::ApiContext,
+ utils::{create_access_token_cookie, create_refresh_token_cookie},
};
+use authentication_service::service::fusionauth_client::error::FusionAuthClientError;
use axum::{
Extension, Json,
extract::{self, State},
diff --git a/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs b/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
index 705cb9dbc4..0639a696d8 100644
--- a/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
+++ b/rust/cloud-storage/authentication_service/src/api/login/passwordless.rs
@@ -7,10 +7,8 @@ use axum::{
use std::borrow::Cow;
-use crate::{
- api::context::ApiContext, generate_password::generate_random_password,
- service::fusionauth_client::error::FusionAuthClientError,
-};
+use crate::{api::context::ApiContext, generate_password::generate_random_password};
+use authentication_service::service::fusionauth_client::error::FusionAuthClientError;
use model::{
authentication::login::{request::PasswordlessRequest, response::SsoRequiredResponse},
response::EmptyResponse,
@@ -98,7 +96,7 @@ pub async fn handler(
tracing::trace!(email=%lowercase_email, "user does not exist, we need to create user");
let fusionauth_user_id = ctx
.auth_client
- .create_user(crate::service::fusionauth_client::user::create::User {
+ .create_user(authentication_service::service::fusionauth_client::user::create::User {
email: (&lowercase_email).into(),
password: generate_random_password().into(),
username: None,
diff --git a/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs b/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
index 1367d6a174..3bb9da6f39 100644
--- a/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
+++ b/rust/cloud-storage/authentication_service/src/api/merge/verify_merge_request.rs
@@ -7,9 +7,9 @@ use axum::{
response::{IntoResponse, Response},
};
-use crate::{
- api::context::ApiContext,
- service::fusionauth_client::identity_provider::{IdentityProviderLink, LinkUserRequest},
+use crate::api::context::ApiContext;
+use authentication_service::service::fusionauth_client::identity_provider::{
+ IdentityProviderLink, LinkUserRequest,
};
use model::{
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs b/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
index 0edba81785..5a47711940 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth/passwordless_callback.rs
@@ -7,13 +7,11 @@ use axum::{
use std::collections::HashMap;
use tower_cookies::Cookies;
-use crate::{
- api::{
- context::ApiContext,
- utils::{create_access_token_cookie, create_refresh_token_cookie},
- },
- service::fusionauth_client::error::FusionAuthClientError,
+use crate::api::{
+ context::ApiContext,
+ utils::{create_access_token_cookie, create_refresh_token_cookie},
};
+use authentication_service::service::fusionauth_client::error::FusionAuthClientError;
use model::response::{ErrorResponse, UserTokensResponse};
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
index aa84a0bba8..77aa6e0a0a 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/google.rs
@@ -10,19 +10,17 @@ use model::response::ErrorResponse;
use reqwest::StatusCode;
use tower_cookies::Cookies;
-use crate::{
- api::{
- context::ApiContext,
- oauth2::{
- OAuthState, format_redirect_uri,
- login::{self},
- },
- },
- service::{
- fusionauth_client::identity_provider::{IdentityProviderLink, LinkUserRequest},
- user::create_user::create_user_profile,
+use crate::api::{
+ context::ApiContext,
+ oauth2::{
+ OAuthState, format_redirect_uri,
+ login::{self},
},
};
+use authentication_service::service::{
+ fusionauth_client::identity_provider::{IdentityProviderLink, LinkUserRequest},
+ user::create_user::create_user_profile,
+};
async fn link_user(
ctx: &ApiContext,
diff --git a/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs b/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
index 17ba5bf0ad..8a21bf5a9f 100644
--- a/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
+++ b/rust/cloud-storage/authentication_service/src/api/oauth2/mod.rs
@@ -40,7 +40,7 @@ pub(in crate::api::oauth2) struct OAuthState {
}
#[derive(Debug, serde::Deserialize)]
-pub(in crate::api::oauth2) struct Params {
+pub(in crate::api) struct Params {
/// The code to complete the login
code: String,
/// State that is passed from the original request
@@ -48,7 +48,7 @@ pub(in crate::api::oauth2) struct Params {
}
#[derive(Debug, serde::Deserialize)]
-struct PathParams {
+pub(in crate::api) struct PathParams {
provider: String,
}
diff --git a/rust/cloud-storage/authentication_service/src/api/user/create_user.rs b/rust/cloud-storage/authentication_service/src/api/user/create_user.rs
index a63a110806..d622d93c28 100644
--- a/rust/cloud-storage/authentication_service/src/api/user/create_user.rs
+++ b/rust/cloud-storage/authentication_service/src/api/user/create_user.rs
@@ -83,7 +83,7 @@ pub async fn handler(
ctx.auth_client
.create_user(
- crate::service::fusionauth_client::user::create::User {
+ authentication_service::service::fusionauth_client::user::create::User {
email: email.into(),
password: req.password.into(),
username: Some(req.username.into()),
diff --git a/rust/cloud-storage/authentication_service/src/api/webhooks/user/create_user_webhook.rs b/rust/cloud-storage/authentication_service/src/api/webhooks/user/create_user_webhook.rs
index ee4dfd2f7e..ddb2d14b02 100644
--- a/rust/cloud-storage/authentication_service/src/api/webhooks/user/create_user_webhook.rs
+++ b/rust/cloud-storage/authentication_service/src/api/webhooks/user/create_user_webhook.rs
@@ -7,9 +7,9 @@ use axum::{
use macro_middleware::auth::internal_access::ValidInternalKey;
use rand::Rng;
-use crate::{
- api::context::ApiContext,
- service::{fusionauth_client::error::FusionAuthClientError, user::create_user::create_user},
+use crate::api::context::ApiContext;
+use authentication_service::service::{
+ fusionauth_client::error::FusionAuthClientError, user::create_user::create_user,
};
use model::authentication::webhooks::FusionAuthUserWebhook;
diff --git a/rust/cloud-storage/authentication_service/src/lib.rs b/rust/cloud-storage/authentication_service/src/lib.rs
index 9e817bd4df..b11418955e 100644
--- a/rust/cloud-storage/authentication_service/src/lib.rs
+++ b/rust/cloud-storage/authentication_service/src/lib.rs
@@ -1,6 +1,6 @@
pub mod fetch_and_checksum;
mod generate_password;
-mod service;
+pub mod service;
/// expose auth client to be used in bin
pub use service::fusionauth_client::FusionAuthClient;
diff --git a/rust/cloud-storage/authentication_service/src/main.rs b/rust/cloud-storage/authentication_service/src/main.rs
index 33d8e771be..044582790c 100644
--- a/rust/cloud-storage/authentication_service/src/main.rs
+++ b/rust/cloud-storage/authentication_service/src/main.rs
@@ -30,7 +30,8 @@ mod api;
mod config;
mod generate_password;
mod rate_limit_config;
-mod service;
+
+use authentication_service::service;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
@@ -127,7 +128,7 @@ async fn main() -> anyhow::Result<()> {
.to_string(),
};
- let auth_client = crate::service::fusionauth_client::FusionAuthClient::new(
+ let auth_client = service::fusionauth_client::FusionAuthClient::new(
fusionauth_api_key,
config.fusionauth_client_id.clone(),
fusionauth_client_secret,
diff --git a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
index 8eef1a1762..80240dd56b 100644
--- a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
+++ b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
@@ -1,12 +1,12 @@
-pub(crate) mod apple;
-pub(crate) mod error;
-pub(crate) mod google;
-pub(crate) mod identity_provider;
-pub(crate) mod jwt;
-pub(crate) mod logout;
-pub(crate) mod oauth;
-pub(crate) mod password;
-pub(crate) mod passwordless;
+pub mod apple;
+pub mod error;
+pub mod google;
+pub mod identity_provider;
+pub mod jwt;
+pub mod logout;
+pub mod oauth;
+pub mod password;
+pub mod passwordless;
pub mod user;
pub type Result<T, E = error::FusionAuthClientError> = std::result::Result<T, E>;
@@ -39,16 +39,14 @@ impl AuthedClient {
}
}
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, Default)]
pub struct UnauthedClient {
inner: reqwest::Client,
}
impl UnauthedClient {
pub fn new() -> Self {
- let client = reqwest::Client::new();
-
- Self { inner: client }
+ Self::default()
}
pub fn client(&self) -> &reqwest::Client {
@@ -110,10 +108,10 @@ impl FusionAuthClient {
/// If login_hint is provided, it will be used as the login_hint parameter. This is used to
/// ensure users are correctly redirected for domain specific SSO
#[tracing::instrument(skip(self, state), fields(application_id=%self.application_id, fusion_auth_base_url=%self.fusion_auth_base_url))]
- pub fn construct_oauth2_authorize_url<'a, T>(
+ pub fn construct_oauth2_authorize_url<T>(
&self,
idp_id: &str,
- login_hint: Option<&'a str>,
+ login_hint: Option<&str>,
state: Option<T>,
) -> anyhow::Result<String>
where
diff --git a/rust/cloud-storage/comms/src/domain/models/channel_name.rs b/rust/cloud-storage/comms/src/domain/models/channel_name.rs
index ff633b49d6..c379354aab 100644
--- a/rust/cloud-storage/comms/src/domain/models/channel_name.rs
+++ b/rust/cloud-storage/comms/src/domain/models/channel_name.rs
@@ -9,6 +9,7 @@ pub type NameLookup = HashMap<MacroUserIdStr<'static>, String>;
#[cfg(test)]
mod tests;
+#[tracing::instrument(skip_all)]
pub fn resolve_channel_name(
channel_type: &ChannelType,
channel_name: Option<&str>,
diff --git a/rust/cloud-storage/contacts_service/src/queue.rs b/rust/cloud-storage/contacts_service/src/queue.rs
index 031eb7a1e8..50f8205b59 100644
--- a/rust/cloud-storage/contacts_service/src/queue.rs
+++ b/rust/cloud-storage/contacts_service/src/queue.rs
@@ -184,8 +184,7 @@ impl MessageQueue {
sqs_message: &aws_sdk_sqs::types::Message,
) -> anyhow::Result<()> {
let message = message_from_sqs(sqs_message).await;
- if message.is_some() {
- let message = message.unwrap();
+ if let Some(message) = message {
let _ = process(&message, self).await;
} else {
tracing::info!("Message could not be processed properly");
@@ -556,7 +555,6 @@ mod tests {
];
- let n = group.len();
let body = CreateGroupMessageBody {
group: group.into_iter().map(String::from).collect(),
diff --git a/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml b/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml
index e7c550895f..ee27dec252 100644
--- a/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml
+++ b/rust/cloud-storage/dataloss_prevention_handler/Cargo.toml
@@ -16,3 +16,4 @@ macro_entrypoint = { path = "../macro_entrypoint" }
s3_client = { path = "../s3_client" }
sns_client = { path = "../sns_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
diff --git a/rust/cloud-storage/delete_chat_handler/Cargo.toml b/rust/cloud-storage/delete_chat_handler/Cargo.toml
index 5eeca36858..c5fd917135 100644
--- a/rust/cloud-storage/delete_chat_handler/Cargo.toml
+++ b/rust/cloud-storage/delete_chat_handler/Cargo.toml
@@ -12,6 +12,7 @@ macro_entrypoint = { path = "../macro_entrypoint" }
openssl = { workspace = true }
sqlx = { workspace = true }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/deleted_item_poller/Cargo.toml b/rust/cloud-storage/deleted_item_poller/Cargo.toml
index b4c0187b39..73b9bc4450 100644
--- a/rust/cloud-storage/deleted_item_poller/Cargo.toml
+++ b/rust/cloud-storage/deleted_item_poller/Cargo.toml
@@ -28,6 +28,7 @@ sqs_client = { path = "../sqs_client", default-features = false, features = [
"search",
] }
tokio = { workspace = true }
+tracing = { workspace = true }
urlencoding = { workspace = true }
[package.metadata.cargo-machete]
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs b/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
index 59b9ad1f04..cde69340c4 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
@@ -1,10 +1,6 @@
-use std::sync::Arc;
-
use sqlx::{PgPool, Pool, Postgres};
use tracing::instrument;
-use crate::service::s3::S3;
-
/// Deletes the document
/// This is to only be used if document creation fails
/// Normal document deletion is a "soft delete"
@@ -19,19 +15,6 @@ pub(in crate::api::documents) async fn handle_document_creation_error_cleanup(
.map_err(|e| tracing::error!(error=?e, "failed to delete document"));
}
-/// Deletes the document from s3
-#[instrument(skip(s3_client))]
-pub(in crate::api::documents) async fn delete_document_s3(
- s3_client: Arc<S3>,
- owner: &str,
- document_id: &str,
-) {
- // Delete from s3
- if let Err(e) = s3_client.delete_document(owner, document_id).await {
- tracing::error!(error=?e,"unable to delete document from s3");
- }
-}
-
/// Deletes a given document version if there was an error saving it
#[instrument(skip(db))]
pub(in crate::api::documents) async fn cleanup_document_version_on_error(
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.rs
deleted file mode 100644
index b110c19031..0000000000
--- a/rust/cloud-storage/document_storage_service/src/service/s3/get_presigned_url.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-use aws_sdk_s3 as s3;
-use std::time::Duration;
-use tracing::instrument;
-
-use s3::presigning::PresigningConfig;
-
-#[instrument(skip(client))]
-pub(in crate::service::s3) async fn get_presigned_url(
- client: &s3::Client,
- bucket: &str,
- key: &str,
-) -> anyhow::Result<String> {
- if cfg!(feature = "local") {
- return Ok("fake".to_string());
- }
-
- // Allows the app 2 minutes to grab the document
- let expiry_duration = Duration::from_secs(2 * 60);
-
- // Generate the presigned URL.
- let presigned_url = client
- .get_object()
- .bucket(bucket)
- .key(key)
- .presigned(PresigningConfig::expires_in(expiry_duration)?)
- .await?;
-
- Ok(presigned_url.uri().to_string())
-}
diff --git a/rust/cloud-storage/document_storage_service/src/service/s3/mod.rs b/rust/cloud-storage/document_storage_service/src/service/s3/mod.rs
index 0b3f47c81f..e1c4c3be9f 100644
--- a/rust/cloud-storage/document_storage_service/src/service/s3/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/service/s3/mod.rs
@@ -3,7 +3,6 @@ mod delete;
mod exists;
mod get;
mod get_folder;
-mod get_presigned_url;
mod put_presigned_url;
mod upload_document;
diff --git a/rust/cloud-storage/document_text_extractor/Cargo.toml b/rust/cloud-storage/document_text_extractor/Cargo.toml
index f7326f1478..0e018823d3 100644
--- a/rust/cloud-storage/document_text_extractor/Cargo.toml
+++ b/rust/cloud-storage/document_text_extractor/Cargo.toml
@@ -31,6 +31,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
sqlx = { workspace = true }
tokio = { workspace = true }
+tracing = { workspace = true }
urlencoding = { workspace = true }
uuid = { workspace = true }
diff --git a/rust/cloud-storage/docx_unzip_handler/Cargo.toml b/rust/cloud-storage/docx_unzip_handler/Cargo.toml
index dab73cc348..3dfac66576 100644
--- a/rust/cloud-storage/docx_unzip_handler/Cargo.toml
+++ b/rust/cloud-storage/docx_unzip_handler/Cargo.toml
@@ -38,6 +38,7 @@ sha2 = { workspace = true }
sqlx = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
urlencoding = { workspace = true }
zip = { workspace = true }
diff --git a/rust/cloud-storage/email_db_client/src/messages/update.rs b/rust/cloud-storage/email_db_client/src/messages/update.rs
index 63b2604b04..59a2015fba 100644
--- a/rust/cloud-storage/email_db_client/src/messages/update.rs
+++ b/rust/cloud-storage/email_db_client/src/messages/update.rs
@@ -2,7 +2,7 @@ use anyhow::Context;
use sqlx::types::Uuid;
#[tracing::instrument(skip(tx), level = "info")]
-pub async fn update_message_read_status<'t>(
+pub async fn update_message_read_status(
tx: &mut sqlx::PgConnection,
message_id: Uuid,
fusionauth_user_id: &str,
diff --git a/rust/cloud-storage/email_refresh_handler/Cargo.toml b/rust/cloud-storage/email_refresh_handler/Cargo.toml
index 734ffa4e73..b61ab57534 100644
--- a/rust/cloud-storage/email_refresh_handler/Cargo.toml
+++ b/rust/cloud-storage/email_refresh_handler/Cargo.toml
@@ -18,6 +18,7 @@ models_email = { path = "../models_email" }
sqlx = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/email_scheduled_handler/Cargo.toml b/rust/cloud-storage/email_scheduled_handler/Cargo.toml
index 81e6e8c463..1634e0f5f7 100644
--- a/rust/cloud-storage/email_scheduled_handler/Cargo.toml
+++ b/rust/cloud-storage/email_scheduled_handler/Cargo.toml
@@ -17,6 +17,7 @@ models_email = { path = "../models_email" }
sqlx = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/email_service/src/utils.rs b/rust/cloud-storage/email_service/src/utils.rs
index 9b0467ec70..e8af10e641 100644
--- a/rust/cloud-storage/email_service/src/utils.rs
+++ b/rust/cloud-storage/email_service/src/utils.rs
@@ -1,6 +1,5 @@
use axum::Json;
use axum::http::StatusCode;
-use axum::response::{IntoResponse, Response};
use model::response::ErrorResponse;
/// User IDs are expected to be in the format "macro|[email protected]"
@@ -24,7 +23,9 @@ pub fn email_from_user_id(user_id: &str) -> anyhow::Result<String> {
/// This is a helper function to avoid repeating the same error handling pattern
/// when extracting an email from a user ID in request handlers.
#[tracing::instrument(level = "debug")]
-pub fn extract_email_with_response(user_id: &str) -> Result<String, Response> {
+pub fn extract_email_with_response(
+ user_id: &str,
+) -> Result<String, (StatusCode, Json<ErrorResponse<'static>>)> {
email_from_user_id(user_id).map_err(|e| {
tracing::error!(error=?e, "unable to get email from user id");
(
@@ -33,6 +34,5 @@ pub fn extract_email_with_response(user_id: &str) -> Result<String, Response> {
message: "unable to get email from user id",
}),
)
- .into_response()
})
}
diff --git a/rust/cloud-storage/email_suppression_handler/Cargo.toml b/rust/cloud-storage/email_suppression_handler/Cargo.toml
index acf29efdea..d65da4721f 100644
--- a/rust/cloud-storage/email_suppression_handler/Cargo.toml
+++ b/rust/cloud-storage/email_suppression_handler/Cargo.toml
@@ -17,6 +17,7 @@ serde_json = { workspace = true }
sqlx = { workspace = true }
strum = { workspace = true }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/justfile b/rust/cloud-storage/justfile
index 5da04632e6..ba549f5d7a 100644
--- a/rust/cloud-storage/justfile
+++ b/rust/cloud-storage/justfile
@@ -15,22 +15,23 @@ build:
SQLX_OFFLINE=true cargo build
# Build all lambda functions
+# CARGO_LAMBDA_COMPILER=cargo is needed for NixOS compatibility with aws-lc-sys
build_lambdas:
#!/usr/bin/env -S parallel --shebang --ungroup --jobs {{ num_cpus() }}
- just docx_unzip_handler/build
- just delete_chat_handler/build
- just organization_retention_handler/build
- just organization_retention_trigger/build
- just upload_extractor_lambda_trigger/build
- just upload_extractor_lambda_handler/build
- just worker_trigger/build
- just dataloss_prevention_handler/build
- just search_upload_handler/build
- just document_text_extractor/build
- just email_suppression_handler/build
- just deleted_item_poller/build
- just email_refresh_handler/build
- just user_link_cleanup_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just docx_unzip_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just delete_chat_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just organization_retention_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just organization_retention_trigger/build
+ CARGO_LAMBDA_COMPILER=cargo just upload_extractor_lambda_trigger/build
+ CARGO_LAMBDA_COMPILER=cargo just upload_extractor_lambda_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just worker_trigger/build
+ CARGO_LAMBDA_COMPILER=cargo just dataloss_prevention_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just search_upload_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just document_text_extractor/build
+ CARGO_LAMBDA_COMPILER=cargo just email_suppression_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just deleted_item_poller/build
+ CARGO_LAMBDA_COMPILER=cargo just email_refresh_handler/build
+ CARGO_LAMBDA_COMPILER=cargo just user_link_cleanup_handler/build
# TESTING
diff --git a/rust/cloud-storage/macro_db_client/src/dcs/add_attachment.rs b/rust/cloud-storage/macro_db_client/src/dcs/add_attachment.rs
deleted file mode 100644
index 477df445bf..0000000000
--- a/rust/cloud-storage/macro_db_client/src/dcs/add_attachment.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use model::{StringID, chat::NewChatAttachment};
-use sqlx::{Postgres, Transaction};
-
-#[tracing::instrument(skip(transaction))]
-async fn add_attachment(
- transaction: &mut Transaction<'_, Postgres>,
- new_attachment: NewChatAttachment,
-) -> anyhow::Result<String> {
- let attachment = sqlx::query_as!(
- StringID,
- r#"
- INSERT INTO "ChatAttachment" ("attachmentType", "attachmentId", "chatId")
- VALUES ($1, $2, $3)
- RETURNING id;
- "#,
- new_attachment.attachment_type.to_string(),
- new_attachment.attachment_id,
- new_attachment.chat_id,
- )
- .fetch_one(transaction.as_mut())
- .await?;
-
- Ok(attachment.id)
-}
diff --git a/rust/cloud-storage/macro_db_client/src/dcs/mod.rs b/rust/cloud-storage/macro_db_client/src/dcs/mod.rs
index 24383703eb..c064de4a3f 100644
--- a/rust/cloud-storage/macro_db_client/src/dcs/mod.rs
+++ b/rust/cloud-storage/macro_db_client/src/dcs/mod.rs
@@ -2,7 +2,6 @@
// These queries were migrated from document_cognition_service/src/service/db/
// Chat queries
-pub mod add_attachment;
pub mod append_attachment_to_chat;
pub mod copy_messages;
pub mod create_chat_message;
diff --git a/rust/cloud-storage/macro_db_client/src/document/v2/create.rs b/rust/cloud-storage/macro_db_client/src/document/v2/create.rs
index 69ad6ca28f..f7decd7f00 100644
--- a/rust/cloud-storage/macro_db_client/src/document/v2/create.rs
+++ b/rust/cloud-storage/macro_db_client/src/document/v2/create.rs
@@ -220,11 +220,11 @@ pub async fn create_document_txn(
)
.await?;
- if email_attachment_id.is_some() {
+ if let Some(attachment) = email_attachment_id {
crate::document::document_email::create_document_email_record(
transaction,
&document_id,
- email_attachment_id.unwrap(),
+ attachment,
)
.await?;
}
diff --git a/rust/cloud-storage/macro_db_client/src/projects/nested_projects.rs b/rust/cloud-storage/macro_db_client/src/projects/nested_projects.rs
index e0a4f40625..4f445d4068 100644
--- a/rust/cloud-storage/macro_db_client/src/projects/nested_projects.rs
+++ b/rust/cloud-storage/macro_db_client/src/projects/nested_projects.rs
@@ -3,7 +3,7 @@ use sqlx::{Pool, Postgres};
use super::get_project::get_sub_items::get_all_sub_project_ids;
#[tracing::instrument(skip(db))]
-pub async fn is_project_recursively_nested<'a>(
+pub async fn is_project_recursively_nested(
db: Pool<Postgres>,
project_id: &str,
parent_id: &str,
diff --git a/rust/cloud-storage/macro_db_client/src/user/get/mod.rs b/rust/cloud-storage/macro_db_client/src/user/get/mod.rs
index 8fd2571058..775717cb75 100644
--- a/rust/cloud-storage/macro_db_client/src/user/get/mod.rs
+++ b/rust/cloud-storage/macro_db_client/src/user/get/mod.rs
@@ -10,7 +10,7 @@ use model::user::{UserInfo, UserInfoWithMacroUserId};
/// Gets the stripe customer id for a given user id
#[tracing::instrument(skip(db))]
-pub async fn get_stripe_customer_id_by_user_id<'a>(
+pub async fn get_stripe_customer_id_by_user_id(
db: &sqlx::Pool<sqlx::Postgres>,
user_id: &MacroUserId<Lowercase<'_>>,
) -> Result<Option<String>, sqlx::Error> {
diff --git a/rust/cloud-storage/macro_notify/src/message_attribute.rs b/rust/cloud-storage/macro_notify/src/message_attribute.rs
index c67dbbb351..5064b5402b 100644
--- a/rust/cloud-storage/macro_notify/src/message_attribute.rs
+++ b/rust/cloud-storage/macro_notify/src/message_attribute.rs
@@ -9,15 +9,3 @@ pub(crate) fn build_string_message_attribute(
.build()?;
Ok(result)
}
-
-/// Builds a number message attribute
-#[tracing::instrument]
-pub(crate) fn build_number_message_attribute(
- attr: i32,
-) -> anyhow::Result<aws_sdk_sqs::types::MessageAttributeValue> {
- let result = aws_sdk_sqs::types::MessageAttributeValue::builder()
- .data_type("Number")
- .string_value(attr.to_string())
- .build()?;
- Ok(result)
-}
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.rs
index 963c7a01d1..f3b2d22192 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
@@ -1,60 +1,10 @@
use anyhow::Context;
use redis::AsyncCommands;
-use tracing::instrument;
use super::SHA_COUNT_KEY_PREFIX;
-/// Decrements the count of a given sha
-/// If the count of a sha hits 0 it will also place the sha into a shas-to-delete set
-#[instrument(skip(client))]
-pub(crate) async fn decrement_count(
- client: &redis::cluster::ClusterClient,
- delete_bucket: &str,
- sha: &str,
- decrement_amount: i64,
-) -> anyhow::Result<()> {
- let mut redis_connection = client
- .get_async_connection()
- .await
- .context("unable to connect to redis")?;
-
- let key = format!("{}{}", SHA_COUNT_KEY_PREFIX, sha);
-
- let count = redis_connection
- .get::<&str, i64>(key.as_str())
- .await
- .unwrap_or(0);
-
- // If the count is 0 (count is actually 0 OR the key doesn't exist)
- // Or if the count - decrement_amount will be lte 0
- // We need to add the sha to the delete bucket
- // and delete the count key
- if count == 0 || count - decrement_amount <= 0 {
- redis_connection
- .del::<&str, bool>(key.as_str())
- .await
- .map_err(|e| anyhow::Error::msg(format!("unable to delete sha count {:?}", e)))?;
- redis_connection
- .sadd::<&str, &str, bool>(delete_bucket, sha)
- .await
- .map_err(|e| {
- anyhow::Error::msg(format!("unable to add sha to delete bucket set {:?}", e))
- })?;
- return Ok(());
- }
-
- // decrement sha key
- redis_connection
- .decr::<&str, i64, i64>(key.as_str(), decrement_amount)
- .await
- .map_err(anyhow::Error::from)?;
-
- Ok(())
-}
-
/// Decrements the count of given shas
/// If the count of a sha hits 0 it will also place the sha into a shas-to-delete set
-#[instrument(skip(client))]
pub(crate) async fn decrement_counts(
client: &redis::cluster::ClusterClient,
delete_bucket: &str,
@@ -104,75 +54,6 @@ mod tests {
use super::*;
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");
-
- let mut conn = redis_client
- .get_connection()
- .expect("unable to connect to redis");
-
- // Cleanup from previous test runs
- conn.del::<&str, bool>("sha:test_decrement_count_one")
- .unwrap();
- conn.del::<&str, bool>("sha:test_decrement_count_two")
- .unwrap();
- conn.del::<&str, bool>("sha:test_decrement_count_three")
- .unwrap();
- conn.del::<&str, bool>("test_decrement_count_bucket")
- .unwrap();
-
- let _ = conn.set::<&str, i32, i32>("sha:test_decrement_count_one", 2);
- let _ = conn.set::<&str, i32, i32>("sha:test_decrement_count_two", 1);
- let _ = conn.set::<&str, i32, i32>("sha:test_decrement_count_three", 3);
-
- let res = decrement_count(
- &redis_client,
- "test_decrement_count_bucket",
- "test_decrement_count_one",
- 1,
- )
- .await;
- assert_eq!(res.is_ok(), true);
- let count: i32 = conn.get("sha:test_decrement_count_one").unwrap();
- assert_eq!(count, 1);
-
- let res = decrement_count(
- &redis_client,
- "test_decrement_count_bucket",
- "test_decrement_count_two",
- 2,
- )
- .await;
- assert_eq!(res.is_ok(), true);
- let count: i32 = conn.get("sha:test_decrement_count_two").unwrap_or(0);
- assert_eq!(count, 0);
-
- let res = decrement_count(
- &redis_client,
- "test_decrement_count_bucket",
- "test_decrement_count_three",
- 3,
- )
- .await;
- assert_eq!(res.is_ok(), true);
- let count: i32 = conn.get("sha:test_decrement_count_three").unwrap_or(0);
- assert_eq!(count, 0);
-
- let mut res = conn
- .smembers::<&str, Vec<String>>("test_decrement_count_bucket")
- .unwrap();
-
- res.sort();
-
- assert_eq!(
- res,
- vec!["test_decrement_count_three", "test_decrement_count_two"]
- );
- }
-
#[tokio::test]
#[ignore = "Redis cluster doesn't exist in CI"]
async fn test_decrement_counts() {
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.rs
index c89c0b223d..69df553620 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,43 +1,7 @@
use super::{SHA_COUNT_KEY_PREFIX, SHA_DELETE_BUCKET};
use anyhow::Context;
use redis::AsyncCommands;
-use tracing::instrument;
-#[instrument(skip(client))]
-pub(crate) async fn increment_count(
- client: &redis::cluster::ClusterClient,
- sha: &str,
-) -> anyhow::Result<()> {
- let mut redis_connection = client
- .get_async_connection()
- .await
- .context("unable to connect to redis")?;
-
- let key = format!("{}{}", SHA_COUNT_KEY_PREFIX, sha);
-
- // sets sha key to 0 if it doesn't exist
- redis_connection
- .set_nx::<&str, i32, bool>(key.as_str(), 0)
- .await
- .map_err(anyhow::Error::from)?;
-
- redis_connection
- .srem::<&str, &str, bool>(SHA_DELETE_BUCKET, sha)
- .await
- .map_err(|e| {
- anyhow::Error::msg(format!("unable to remove sha to delete bucket set {:?}", e))
- })?;
-
- // increments sha key by 1
- redis_connection
- .incr::<&str, i32, i32>(key.as_str(), 1)
- .await
- .map_err(anyhow::Error::from)?;
-
- Ok(())
-}
-
-#[tracing::instrument(skip(client))]
pub(crate) async fn increment_counts(
client: &redis::cluster::ClusterClient,
shas: Vec<String>,
@@ -71,35 +35,6 @@ mod tests {
use super::*;
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");
-
- let mut conn = redis_client
- .get_connection()
- .expect("unable to connect to redis");
-
- // Cleanup from previous test runs
- conn.del::<&str, bool>("sha:test_increment_count_one")
- .unwrap();
- conn.del::<&str, bool>("sha:test_increment_count_two")
- .unwrap();
-
- let _ = conn.set::<&str, i32, i32>("sha:test_increment_count_two", 2);
-
- let res = increment_count(&redis_client, &"test_increment_count_one").await;
- assert_eq!(res.is_ok(), true);
- let count: i32 = conn.get("sha:test_increment_count_one").unwrap();
- assert_eq!(count, 1);
-
- let res = increment_count(&redis_client, &"test_increment_count_two").await;
- assert_eq!(res.is_ok(), true);
- let count: i32 = conn.get("sha:test_increment_count_two").unwrap();
- assert_eq!(count, 3);
- }
-
#[tokio::test]
#[ignore = "Redis cluster doesn't exist in CI"]
async fn test_increment_counts() {
diff --git a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
index cb6b3e0644..2179b414a7 100644
--- a/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
+++ b/rust/cloud-storage/models_email/src/email/service/body_parsing/body_replyless/mod.rs
@@ -8,18 +8,10 @@ use html_parser::extract_reply_html;
use plaintext_parser::extract_reply_plaintext;
pub fn get_body_replyless_for_message(message: &message::Message) -> Option<String> {
- if message.body_html_sanitized.is_some() {
- extract_reply_html(
- message.subject.as_deref(),
- message.body_html_sanitized.as_ref().unwrap(),
- )
- .into()
- } else if message.body_text.is_some() {
- extract_reply_plaintext(
- message.subject.as_deref(),
- message.body_text.as_ref().unwrap(),
- )
- .into()
+ if let Some(sanitized) = message.body_html_sanitized.as_ref() {
+ extract_reply_html(message.subject.as_deref(), sanitized).into()
+ } else if let Some(body) = message.body_text.as_ref() {
+ extract_reply_plaintext(message.subject.as_deref(), body).into()
} else {
None
}
@@ -96,7 +88,7 @@ mod tests {
fn test_email_extraction(full_email: &str, expected_reply: &str, test_name: &str) {
// Create a message with HTML content
- let mut message = service::message::Message {
+ let message = service::message::Message {
db_id: None,
provider_id: None,
global_id: None,
@@ -132,7 +124,7 @@ mod tests {
updated_at: Default::default(),
};
- let mut body_replyless = get_body_replyless_for_message(&message);
+ let body_replyless = get_body_replyless_for_message(&message);
assert_eq!(
body_replyless
diff --git a/rust/cloud-storage/organization_retention_handler/Cargo.toml b/rust/cloud-storage/organization_retention_handler/Cargo.toml
index c06cb5b412..3445215e67 100644
--- a/rust/cloud-storage/organization_retention_handler/Cargo.toml
+++ b/rust/cloud-storage/organization_retention_handler/Cargo.toml
@@ -15,6 +15,7 @@ openssl = { workspace = true }
sqlx = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/organization_retention_trigger/Cargo.toml b/rust/cloud-storage/organization_retention_trigger/Cargo.toml
index ea13484044..64c40c80d6 100644
--- a/rust/cloud-storage/organization_retention_trigger/Cargo.toml
+++ b/rust/cloud-storage/organization_retention_trigger/Cargo.toml
@@ -16,6 +16,7 @@ serde_json = { workspace = true }
sqlx = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/search_upload_handler/Cargo.toml b/rust/cloud-storage/search_upload_handler/Cargo.toml
index a047fabe98..46e56a9eac 100644
--- a/rust/cloud-storage/search_upload_handler/Cargo.toml
+++ b/rust/cloud-storage/search_upload_handler/Cargo.toml
@@ -17,6 +17,7 @@ sqs_client = { path = "../sqs_client", default-features = false, features = [
"search",
] }
tokio = { workspace = true }
+tracing = { workspace = true }
urlencoding = { workspace = true }
[package.metadata.cargo-machete]
diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs
index d2d3436ada..9c32290eb7 100644
--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs
+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs
@@ -1608,7 +1608,10 @@ async fn test_cursor_pagination_with_document_filter(db: PgPool) -> anyhow::Resu
)
.await?;
- assert!(second_page_items.len() > 0, "Second page should have items");
+ assert!(
+ !second_page_items.is_empty(),
+ "Second page should have items"
+ );
// Verify filter still applies on second page
for item in &second_page_items {
diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
index 63bcdb3597..6eec49eed5 100644
--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
@@ -202,204 +202,3 @@ pub async fn unexpanded_generic_cursor_soup(
Ok(items)
}
-
-/// Returns objects that a user has EXPLICIT access to, including project items.
-///
-/// This function only returns items that the user has been directly granted permissions for.
-/// If a user has access to a project that contains other items, those "child" items will NOT
-/// be included in the results unless the user has been explicitly granted permissions on them.
-/// This ensures that only directly authorized items are returned, not those with implicit
-/// (inherited) access.
-#[tracing::instrument(skip(db, limit, cursor))]
-pub async fn no_frecency_unexpanded_generic_cursor_soup(
- db: &PgPool,
- user_id: MacroUserIdStr<'_>,
- limit: u16,
- cursor: Query<String, SimpleSortMethod, ()>,
-) -> Result<Vec<SoupItem>, sqlx::Error> {
- let query_limit = limit as i64;
- let sort_method_str = cursor.sort_method().to_string();
- let (cursor_id, cursor_timestamp) = cursor.vals();
-
- let status_property_id = SystemPropertyKey::STATUS_UUID;
- let completed_option_id = StatusOption::COMPLETED_UUID.to_string();
-
- let items: Vec<SoupItem> = sqlx::query!(
- r#"
- WITH UserAccessibleItems AS (
- SELECT DISTINCT ON ("item_id", "item_type")
- "item_id",
- "item_type"
- FROM "UserItemAccess"
- WHERE "user_id" = $1
- ORDER BY "item_id", "item_type",
- CASE "access_level"
- WHEN 'owner' THEN 4
- WHEN 'edit' THEN 3
- WHEN 'comment' THEN 2
- WHEN 'view' THEN 1
- ELSE 0
- END DESC
- ),
- Combined AS (
- SELECT
- 'document' as "item_type!",
- d.id as "id!",
- CAST(COALESCE(di.id, db.id) as TEXT) as "document_version_id",
- d.owner as "user_id!",
- d.name as "name!",
- d."branchedFromId" as "branched_from_id",
- d."branchedFromVersionId" as "branched_from_version_id",
- d."documentFamilyId" as "document_family_id",
- d."fileType" as "file_type",
- d."createdAt"::timestamptz as "created_at!",
- d."updatedAt"::timestamptz as "updated_at!",
- d."projectId" as "project_id",
- NULL as "is_persistent",
- di.sha as "sha",
- dt.sub_type as "sub_type?: DocumentSubType",
- uh."updatedAt"::timestamptz as "viewed_at",
- CASE $2
- WHEN 'viewed_updated' THEN COALESCE(uh."updatedAt", d."updatedAt")
- WHEN 'viewed_at' THEN COALESCE(uh."updatedAt", '1970-01-01 00:00:00+00')
- WHEN 'created_at' THEN d."createdAt"
- ELSE d."updatedAt"
- END::timestamptz as "sort_ts!",
- CASE
- WHEN dt.sub_type = 'task'
- AND ep_status.values->'value' ? $6
- THEN true
- WHEN dt.sub_type = 'task'
- THEN false
- ELSE NULL
- END as "is_completed"
- FROM "Document" d
- LEFT JOIN document_sub_type dt ON dt.document_id = d.id
- LEFT JOIN entity_properties ep_status
- ON dt.sub_type = 'task'
- AND ep_status.entity_id = d.id
- AND ep_status.entity_type = 'TASK'
- AND ep_status.property_definition_id = $7
- INNER JOIN UserAccessibleItems uai
- ON uai.item_id = d.id
- AND uai.item_type = 'document'
- LEFT JOIN "UserHistory" uh
- ON uh."itemId" = d.id
- AND uh."itemType" = 'document'
- AND uh."userId" = $1
- LEFT JOIN LATERAL (
- SELECT b.id
- FROM "DocumentBom" b
- WHERE b."documentId" = d.id
- ORDER BY b."createdAt" DESC
- LIMIT 1
- ) db ON true
- LEFT JOIN LATERAL (
- Select i.id, i.sha
- FROM "DocumentInstance" i
- WHERE i."documentId" = d.id
- ORDER BY i."updatedAt" DESC
- LIMIT 1
- ) di ON true
- WHERE d."deletedAt" IS NULL
-
- UNION ALL
-
- SELECT
- 'chat' as "item_type!",
- c.id as "id!",
- NULL as "document_version_id",
- c."userId" as "user_id!",
- c.name as "name!",
- NULL as "branched_from_id",
- NULL as "branched_from_version_id",
- NULL as "document_family_id",
- NULL as "file_type",
- c."createdAt"::timestamptz as "created_at!",
- c."updatedAt"::timestamptz as "updated_at!",
- c."projectId" as "project_id",
- c."isPersistent" as "is_persistent",
- NULL as "sha",
- NULL as "sub_type",
- uh."updatedAt"::timestamptz as "viewed_at",
- CASE $2
- WHEN 'viewed_updated' THEN COALESCE(uh."updatedAt", c."updatedAt")
- WHEN 'viewed_at' THEN COALESCE(uh."updatedAt", '1970-01-01 00:00:00+00')
- WHEN 'created_at' THEN c."createdAt"
- ELSE c."updatedAt"
- END::timestamptz as "sort_ts!",
- NULL as "is_completed"
- FROM "Chat" c
- INNER JOIN UserAccessibleItems uai
- ON uai.item_id = c.id
- AND uai.item_type = 'chat'
- LEFT JOIN "UserHistory" uh
- ON uh."itemId" = c.id
- AND uh."itemType" = 'chat'
- AND uh."userId" = $1
- WHERE c."deletedAt" IS NULL
-
- UNION ALL
-
- SELECT
- 'project' as "item_type!",
- p.id as "id!",
- NULL as "document_version_id",
- p."userId" as "user_id!",
- p.name as "name!",
- NULL as "branched_from_id",
- NULL as "branched_from_version_id",
- NULL as "document_family_id",
- NULL as "file_type",
- p."createdAt"::timestamptz as "created_at!",
- p."updatedAt"::timestamptz as "updated_at!",
- p."parentId" as "project_id",
- NULL as "is_persistent",
- NULL as "sha",
- NULL as "sub_type",
- uh."updatedAt"::timestamptz as "viewed_at",
- CASE $2
- WHEN 'viewed_updated' THEN COALESCE(uh."updatedAt", p."updatedAt")
- WHEN 'viewed_at' THEN COALESCE(uh."updatedAt", '1970-01-01 00:00:00+00')
- WHEN 'created_at' THEN p."createdAt"
- ELSE p."updatedAt"
- END::timestamptz as "sort_ts!",
- NULL as "is_completed"
- FROM "Project" p
- INNER JOIN UserAccessibleItems uai
- ON uai.item_id = p.id
- AND uai.item_type = 'project'
- LEFT JOIN "UserHistory" uh
- ON uh."itemId" = p.id
- AND uh."itemType" = 'project'
- AND uh."userId" = $1
- WHERE p."deletedAt" IS NULL
- )
- SELECT Combined.* FROM Combined
- LEFT JOIN frecency_aggregates fa
- ON fa.entity_id = Combined."id!"
- AND fa.entity_type = Combined."item_type!"
- AND fa.user_id = $1
- WHERE fa.id IS NULL
- AND (
- ($4::timestamptz IS NULL)
- OR
- (Combined."sort_ts!", Combined."id!") < ($4, $5)
- )
- ORDER BY Combined."sort_ts!" DESC, Combined."updated_at!" DESC
- LIMIT $3
- "#,
- user_id.as_ref(), // $1
- sort_method_str, // $2
- query_limit, // $3
- cursor_timestamp, // $4
- cursor_id, // $5
- completed_option_id, // $6
- status_property_id, // $7
- )
- .try_map(map_soup_type!())
- .fetch_all(db)
- .await?;
-
- Ok(items)
-}
diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs
index e064eb1173..84a74e0312 100644
--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs
+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/unexpanded/tests.rs
@@ -1,6 +1,5 @@
use crate::outbound::pg_soup_repo::unexpanded::{
- by_cursor::{no_frecency_unexpanded_generic_cursor_soup, unexpanded_generic_cursor_soup},
- by_ids::unexpanded_soup_by_ids,
+ by_cursor::unexpanded_generic_cursor_soup, by_ids::unexpanded_soup_by_ids,
};
use macro_db_migrator::MACRO_DB_MIGRATIONS;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
@@ -9,7 +8,7 @@ use models_pagination::Identify;
use models_pagination::{PaginateOn, Query, SimpleSortMethod};
use models_soup::item::SoupItem;
use sqlx::{Pool, Postgres};
-use std::collections::{HashMap, HashSet};
+use std::collections::HashMap;
use uuid::Uuid;
// testing the sorting methods work as expected
@@ -439,263 +438,6 @@ async fn test_unexpanded_soup_by_ids_access_control(pool: Pool<Postgres>) -> any
Ok(())
}
-// Test that no_frecency_unexpanded_generic_cursor_soup excludes items with frecency records
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../../../macro_db_client/fixtures",
- scripts("no_frecency_items_unexpanded")
- )
-)]
-async fn test_no_frecency_unexpanded_filters_out_frecency_items(
- pool: Pool<Postgres>,
-) -> anyhow::Result<()> {
- let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
-
- // Test with UpdatedAt sort - should return only items without frecency
- let items = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id,
- 20,
- Query::Sort(SimpleSortMethod::UpdatedAt, ()),
- )
- .await?;
-
- // Should get 5 items (2 docs + 2 chats + 1 project without frecency)
- assert_eq!(
- items.len(),
- 5,
- "Should only return items without frecency records"
- );
-
- // Verify the returned items are the ones WITHOUT frecency
- let returned_ids: HashSet<Uuid> = items.iter().map(|item| item.id()).collect();
-
- let expected_ids: HashSet<Uuid> = [
- "44444444-4444-4444-4444-444444444444", // doc-no-frecency-1
- "55555555-5555-5555-5555-555555555555", // doc-no-frecency-2
- "66666666-6666-6666-6666-666666666666", // chat-no-frecency-1
- "77777777-7777-7777-7777-777777777777", // chat-no-frecency-2
- "88888888-8888-8888-8888-888888888888", // project-no-frecency
- ]
- .iter()
- .map(|&s| Uuid::parse_str(s).unwrap())
- .collect();
-
- assert_eq!(
- returned_ids, expected_ids,
- "Should only get items without frecency records"
- );
-
- // Verify none of the frecency items are returned
- let frecency_items = [
- Uuid::parse_str("44444444-ffff-ffff-ffff-ffffffffffff").unwrap(), // doc-with-frecency-1
- Uuid::parse_str("55555555-ffff-ffff-ffff-ffffffffffff").unwrap(), // doc-with-frecency-2
- Uuid::parse_str("66666666-ffff-ffff-ffff-ffffffffffff").unwrap(), // chat-with-frecency-1
- Uuid::parse_str("88888888-ffff-ffff-ffff-ffffffffffff").unwrap(), // project-with-frecency
- ];
- for frecency_id in &frecency_items {
- assert!(
- !returned_ids.contains(frecency_id),
- "Should not return item with frecency: {}",
- frecency_id
- );
- }
-
- Ok(())
-}
-
-// Test sorting methods work correctly for no_frecency unexpanded query
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../../../macro_db_client/fixtures",
- scripts("no_frecency_items_unexpanded")
- )
-)]
-async fn test_no_frecency_unexpanded_sorting_methods(pool: Pool<Postgres>) -> anyhow::Result<()> {
- let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
-
- let get_item_ids =
- |items: &[SoupItem]| -> Vec<Uuid> { items.iter().map(|item| item.id()).collect() };
-
- // Test UpdatedAt sorting
- {
- let items = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id.copied(),
- 20,
- Query::Sort(SimpleSortMethod::UpdatedAt, ()),
- )
- .await?;
- assert_eq!(items.len(), 5, "UpdatedAt should return 5 items");
-
- let item_ids = get_item_ids(&items);
- // Ordered by updatedAt DESC: doc-no-frecency-1 (2/13), doc-no-frecency-2 (2/12),
- // chat-no-frecency-1 (2/10), chat-no-frecency-2 (2/09), project-no-frecency (2/07)
- let expected_ids = vec![
- Uuid::parse_str("44444444-4444-4444-4444-444444444444").unwrap(), // doc-no-frecency-1
- Uuid::parse_str("55555555-5555-5555-5555-555555555555").unwrap(), // doc-no-frecency-2
- Uuid::parse_str("66666666-6666-6666-6666-666666666666").unwrap(), // chat-no-frecency-1
- Uuid::parse_str("77777777-7777-7777-7777-777777777777").unwrap(), // chat-no-frecency-2
- Uuid::parse_str("88888888-8888-8888-8888-888888888888").unwrap(), // project-no-frecency
- ];
- assert_eq!(
- item_ids, expected_ids,
- "Failed to sort correctly by UpdatedAt"
- );
- }
-
- // Test CreatedAt sorting
- {
- let items = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id.copied(),
- 20,
- Query::Sort(SimpleSortMethod::CreatedAt, ()),
- )
- .await?;
- assert_eq!(items.len(), 5, "CreatedAt should return 5 items");
-
- let item_ids = get_item_ids(&items);
- // Ordered by createdAt DESC: project-no-frecency (1/18), chat-no-frecency-2 (1/16),
- // chat-no-frecency-1 (1/15), doc-no-frecency-2 (1/13), doc-no-frecency-1 (1/12)
- let expected_ids = vec![
- Uuid::parse_str("88888888-8888-8888-8888-888888888888").unwrap(), // project-no-frecency
- Uuid::parse_str("77777777-7777-7777-7777-777777777777").unwrap(), // chat-no-frecency-2
- Uuid::parse_str("66666666-6666-6666-6666-666666666666").unwrap(), // chat-no-frecency-1
- Uuid::parse_str("55555555-5555-5555-5555-555555555555").unwrap(), // doc-no-frecency-2
- Uuid::parse_str("44444444-4444-4444-4444-444444444444").unwrap(), // doc-no-frecency-1
- ];
- assert_eq!(
- item_ids, expected_ids,
- "Failed to sort correctly by CreatedAt"
- );
- }
-
- // Test ViewedAt sorting
- {
- let items = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id,
- 20,
- Query::Sort(SimpleSortMethod::ViewedAt, ()),
- )
- .await?;
- assert_eq!(items.len(), 5, "ViewedAt should return 5 items");
-
- let item_ids = get_item_ids(&items);
- // Ordered by UserHistory.updatedAt DESC: doc-no-frecency-1 (3/17), doc-no-frecency-2 (3/16),
- // chat-no-frecency-1 (3/15), chat-no-frecency-2 (3/14), project-no-frecency (3/13)
- let expected_ids = vec![
- Uuid::parse_str("44444444-4444-4444-4444-444444444444").unwrap(), // doc-no-frecency-1
- Uuid::parse_str("55555555-5555-5555-5555-555555555555").unwrap(), // doc-no-frecency-2
- Uuid::parse_str("66666666-6666-6666-6666-666666666666").unwrap(), // chat-no-frecency-1
- Uuid::parse_str("77777777-7777-7777-7777-777777777777").unwrap(), // chat-no-frecency-2
- Uuid::parse_str("88888888-8888-8888-8888-888888888888").unwrap(), // project-no-frecency
- ];
- assert_eq!(
- item_ids, expected_ids,
- "Failed to sort correctly by ViewedAt"
- );
- }
-
- Ok(())
-}
-
-// Test cursor-based pagination for no_frecency unexpanded query
-#[sqlx::test(
- migrator = "MACRO_DB_MIGRATIONS",
- fixtures(
- path = "../../../../../macro_db_client/fixtures",
- scripts("no_frecency_items_unexpanded")
- )
-)]
-async fn test_no_frecency_unexpanded_cursor_pagination(pool: Pool<Postgres>) -> anyhow::Result<()> {
- let user_id = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();
-
- // Get first page with limit of 2
- let result = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id.copied(),
- 2,
- Query::Sort(SimpleSortMethod::UpdatedAt, ()),
- )
- .await?
- .into_iter()
- .paginate_on(2, SimpleSortMethod::UpdatedAt)
- .into_page();
-
- assert_eq!(result.items.len(), 2, "Should get 2 items in first page");
-
- // First two items should be the most recently updated
- let doc1_uuid = Uuid::parse_str("44444444-4444-4444-4444-444444444444").unwrap();
- let doc2_uuid = Uuid::parse_str("55555555-5555-5555-5555-555555555555").unwrap();
-
- match &result.items[0] {
- SoupItem::Document(doc) => {
- assert_eq!(doc.id, doc1_uuid, "First item should be doc-no-frecency-1");
- }
- _ => panic!("First item should be a document"),
- }
-
- match &result.items[1] {
- SoupItem::Document(doc) => {
- assert_eq!(doc.id, doc2_uuid, "Second item should be doc-no-frecency-2");
- }
- _ => panic!("Second item should be a document"),
- }
-
- // Get second page using cursor
- let items = no_frecency_unexpanded_generic_cursor_soup(
- &pool,
- user_id,
- 2,
- Query::new(
- result.next_cursor.map(|s| {
- let decoded = s.decode_json().unwrap();
- models_pagination::Cursor {
- id: decoded.id.to_string(),
- limit: decoded.limit,
- val: decoded.val,
- filter: decoded.filter,
- }
- }),
- SimpleSortMethod::UpdatedAt,
- (),
- ),
- )
- .await?;
-
- assert_eq!(items.len(), 2, "Should get 2 items in second page");
-
- // Next two items should be the chats
- let chat1_uuid = Uuid::parse_str("66666666-6666-6666-6666-666666666666").unwrap();
- let chat2_uuid = Uuid::parse_str("77777777-7777-7777-7777-777777777777").unwrap();
-
- match &items[0] {
- SoupItem::Chat(chat) => {
- assert_eq!(
- chat.id, chat1_uuid,
- "Third item should be chat-no-frecency-1"
- );
- }
- _ => panic!("Third item should be a chat"),
- }
-
- match &items[1] {
- SoupItem::Chat(chat) => {
- assert_eq!(
- chat.id, chat2_uuid,
- "Fourth item should be chat-no-frecency-2"
- );
- }
- _ => panic!("Fourth item should be a chat"),
- }
-
- Ok(())
-}
-
// Test that is_completed field is correctly set based on task status
#[sqlx::test(
migrator = "MACRO_DB_MIGRATIONS",
diff --git a/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip
index 30fbae421b..e4ebd9e680 100644
Binary files a/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip
index ed23ad19d4..010f65341c 100644
Binary files a/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip b/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip
index 8cebfe6805..5e9aca705a 100644
Binary files a/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip and b/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/document-text-extractor/bootstrap.zip b/rust/cloud-storage/target/lambda/document-text-extractor/bootstrap.zip
deleted file mode 100644
index 1d039bf763..0000000000
Binary files a/rust/cloud-storage/target/lambda/document-text-extractor/bootstrap.zip and /dev/null differ
diff --git a/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip b/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip
index 7d202388fa..ff4341331a 100644
Binary files a/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip and b/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/docx-unzip-handler/bootstrap.zip b/rust/cloud-storage/target/lambda/docx-unzip-handler/bootstrap.zip
deleted file mode 100644
index 352aed9e6d..0000000000
Binary files a/rust/cloud-storage/target/lambda/docx-unzip-handler/bootstrap.zip and /dev/null differ
diff --git a/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip
index 5c221698ad..d95a8a7f0c 100644
Binary files a/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip
index 45cae836a9..4ed6c01325 100644
Binary files a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip
index 20baa63e35..d45b2d69ff 100644
Binary files a/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip
index 1511265e0b..9574f13a65 100644
Binary files a/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/lambda_aggregate_frecency/bootstrap.zip b/rust/cloud-storage/target/lambda/lambda_aggregate_frecency/bootstrap.zip
deleted file mode 100644
index 8384d116cc..0000000000
Binary files a/rust/cloud-storage/target/lambda/lambda_aggregate_frecency/bootstrap.zip and /dev/null differ
diff --git a/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip
index c2e9b55b0d..6b5c6b349c 100644
Binary files a/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip
index 04e2d9c0d0..74e83422e0 100644
Binary files a/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip
index 23390e763a..2fd2e29c75 100644
Binary files a/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip
index 2280dcde56..251d976a0e 100644
Binary files a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip
index db57b26ee7..42f2afc7fe 100644
Binary files a/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip
index 5c8cf8846b..054e50946d 100644
Binary files a/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip differ
diff --git a/rust/cloud-storage/target/lambda/worker-trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/worker-trigger/bootstrap.zip
deleted file mode 100644
index 1fa62e0f62..0000000000
Binary files a/rust/cloud-storage/target/lambda/worker-trigger/bootstrap.zip and /dev/null differ
diff --git a/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip
index 9c61fc33df..2b526b2c82 100644
Binary files a/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip differ
diff --git a/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs b/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs
index 8360e81e47..5fd748d250 100644
--- a/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs
+++ b/rust/cloud-storage/unfurl_service/src/unfurl/mod.rs
@@ -23,13 +23,12 @@ 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))
-}
-
#[tracing::instrument]
fn parse_document(html_content: &str, url: &Url) -> Result<HashMap<String, String>, Error> {
+ fn no_tag(tag: &str) -> Error {
+ anyhow::anyhow!(format!("Missing expected tag: [{}]", tag))
+ }
+
// Parse the HTML document
let document = Html::parse_document(html_content);
@@ -67,7 +66,6 @@ fn parse_document(html_content: &str, url: &Url) -> Result<HashMap<String, Strin
Ok(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()?;
@@ -90,9 +88,8 @@ fn find_favicon(document: &Html, base_url: &Url) -> Option<String> {
None
}
-#[cfg(not(feature = "mock"))]
#[tracing::instrument]
-pub async fn extract_meta_tags(
+pub async fn extract_meta_tags_prod(
url: &str,
) -> Result<HashMap<String, String>, Box<dyn std::error::Error + Send + Sync>> {
// Fetch the HTML content
@@ -138,10 +135,19 @@ pub fn append_optimistic_favico(
meta_tags
}
-#[cfg(feature = "mock")]
pub async fn extract_meta_tags(
url: &str,
-) -> Result<HashMap<String, String>, Box<dyn std::error::Error>> {
+) -> Result<HashMap<String, String>, Box<dyn std::error::Error + Send + Sync>> {
+ if cfg!(feature = "mock") {
+ extract_meta_tags_mock(url).await
+ } else {
+ extract_meta_tags_prod(url).await
+ }
+}
+
+pub async fn extract_meta_tags_mock(
+ url: &str,
+) -> Result<HashMap<String, String>, Box<dyn std::error::Error + Send + Sync>> {
if url == "https://hello.com" {
let mut m = HashMap::new();
m.insert("property:og:title".to_string(), "Hello".to_string());
diff --git a/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml b/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
index 7f02489f42..c8bae78e74 100644
--- a/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
+++ b/rust/cloud-storage/upload_extractor_lambda_handler/Cargo.toml
@@ -32,6 +32,7 @@ tempfile = "3.19.1"
tokio = { workspace = true }
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
+tracing = { workspace = true }
walkdir = "2.3.2"
zip = { workspace = true }
diff --git a/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml b/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml
index 96e5fc630a..d4763b52ab 100644
--- a/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml
+++ b/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml
@@ -18,6 +18,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
sqs_client = { path = "../sqs_client" }
tokio = { workspace = true }
+tracing = { workspace = true }
[package.metadata.cargo-machete]
ignored = ["openssl"]
diff --git a/rust/cloud-storage/worker_trigger/Cargo.toml b/rust/cloud-storage/worker_trigger/Cargo.toml
index 65bc9d663e..df1d2ec303 100644
--- a/rust/cloud-storage/worker_trigger/Cargo.toml
+++ b/rust/cloud-storage/worker_trigger/Cargo.toml
@@ -15,3 +15,4 @@ macro_env = { path = "../macro_env" }
mockall = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
+tracing = { workspace = true }