refactor(ses): split 7,464-line service.rs into sub-modules#285
Merged
vieiralucas merged 2 commits intomainfrom Apr 12, 2026
Merged
refactor(ses): split 7,464-line service.rs into sub-modules#285vieiralucas merged 2 commits intomainfrom
vieiralucas merged 2 commits intomainfrom
Conversation
Split monolithic service.rs into 9 files following the SSM pattern: - mod.rs: struct, dispatch, helpers, tests (3,908 lines) - misc.rs: tags, dedicated IPs, import/export jobs (1,622 lines) - configuration_sets.rs: config set CRUD + event destinations (500 lines) - identities.rs: email identity operations (490 lines) - contact_lists.rs: contact list + contact CRUD (440 lines) - templates.rs: email template CRUD (222 lines) - account.rs: account settings, VDM (173 lines) - sending.rs: SendEmail, SendBulkEmail (160 lines) - suppression.rs: suppression list operations (120 lines) Also updates conformance audit paths for the SES split.
There was a problem hiding this comment.
3 issues found across 10 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-ses/src/service/misc.rs">
<violation number="1" location="crates/fakecloud-ses/src/service/misc.rs:472">
P2: Managed dedicated IP generation is based on pool count, which can reuse existing IP keys and overwrite another pool’s dedicated IP records after pool deletions/re-creations.</violation>
</file>
<file name="crates/fakecloud-ses/src/service/configuration_sets.rs">
<violation number="1" location="crates/fakecloud-ses/src/service/configuration_sets.rs:356">
P2: Configuration-set existence is checked before taking the write lock, which creates a race where a concurrent delete can still allow insertion of an event destination for a deleted set.</violation>
</file>
<file name="crates/fakecloud-ses/src/service/templates.rs">
<violation number="1" location="crates/fakecloud-ses/src/service/templates.rs:208">
P3: Use a Content-Type that matches the rendered body (text/plain when only Text is present).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| // For MANAGED pools, generate some fake IPs | ||
| if scaling_mode == "MANAGED" { | ||
| let pool_idx = state.dedicated_ip_pools.len() as u8; |
There was a problem hiding this comment.
P2: Managed dedicated IP generation is based on pool count, which can reuse existing IP keys and overwrite another pool’s dedicated IP records after pool deletions/re-creations.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/fakecloud-ses/src/service/misc.rs, line 472:
<comment>Managed dedicated IP generation is based on pool count, which can reuse existing IP keys and overwrite another pool’s dedicated IP records after pool deletions/re-creations.</comment>
<file context>
@@ -0,0 +1,1622 @@
+
+ // For MANAGED pools, generate some fake IPs
+ if scaling_mode == "MANAGED" {
+ let pool_idx = state.dedicated_ip_pools.len() as u8;
+ for i in 1..=3 {
+ let ip_addr = format!("198.51.100.{}", pool_idx * 10 + i);
</file context>
| ) -> Result<AwsResponse, AwsServiceError> { | ||
| let body: Value = Self::parse_body(req)?; | ||
|
|
||
| let state_read = self.state.read(); |
There was a problem hiding this comment.
P2: Configuration-set existence is checked before taking the write lock, which creates a race where a concurrent delete can still allow insertion of an event destination for a deleted set.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/fakecloud-ses/src/service/configuration_sets.rs, line 356:
<comment>Configuration-set existence is checked before taking the write lock, which creates a race where a concurrent delete can still allow insertion of an event destination for a deleted set.</comment>
<file context>
@@ -0,0 +1,500 @@
+ ) -> Result<AwsResponse, AwsServiceError> {
+ let body: Value = Self::parse_body(req)?;
+
+ let state_read = self.state.read();
+ if !state_read.configuration_sets.contains_key(config_set_name) {
+ return Ok(Self::json_error(
</file context>
| // Build a simplified MIME message | ||
| let mut mime = format!("Subject: {}\r\n", rendered_subject); | ||
| mime.push_str("MIME-Version: 1.0\r\n"); | ||
| mime.push_str("Content-Type: text/html; charset=UTF-8\r\n"); |
There was a problem hiding this comment.
P3: Use a Content-Type that matches the rendered body (text/plain when only Text is present).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/fakecloud-ses/src/service/templates.rs, line 208:
<comment>Use a Content-Type that matches the rendered body (text/plain when only Text is present).</comment>
<file context>
@@ -0,0 +1,222 @@
+ // Build a simplified MIME message
+ let mut mime = format!("Subject: {}\r\n", rendered_subject);
+ mime.push_str("MIME-Version: 1.0\r\n");
+ mime.push_str("Content-Type: text/html; charset=UTF-8\r\n");
+ mime.push_str("\r\n");
+ if let Some(ref html) = rendered_html {
</file context>
# Conflicts: # crates/fakecloud-conformance/src/audit.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
service.rsinto 9 focused sub-modulesmod.rs(3,908 lines): struct, dispatch, helpers, testsmisc.rs(1,622 lines): tags, dedicated IPs, import/export jobsconfiguration_sets.rs(500 lines): config set CRUD + event destinationsidentities.rs(490 lines): email identity operationscontact_lists.rs(440 lines): contact list + contact CRUDtemplates.rs(222 lines): email template CRUDaccount.rs(173 lines): account settings, VDMsending.rs(160 lines): SendEmail, SendBulkEmailsuppression.rs(120 lines): suppression list operationsTest plan
cargo clippy --workspace --all-targets -- -D warningspasses cleanSummary by cubic
Split the 7,464-line SES
service.rsinto 9 focused modules to improve maintainability and navigation. Updated conformance audit to detect both the new module layout and the legacy file so checks continue to pass.crates/fakecloud-ses/src/service.rswith:account.rs,configuration_sets.rs,identities.rs,contact_lists.rs,templates.rs,sending.rs,suppression.rs,misc.rs, andmod.rs(struct, dispatch, helpers, tests).crates/fakecloud-conformance/src/audit.rsto include bothservice/mod.rsandservice.rsfor SES.Written for commit 8d46b8f. Summary will update on new commits.