Skip to content

refactor: remove unused e-mail controller#2318

Merged
jo-elimu merged 3 commits intomainfrom
remove-unused-email-controller
Jul 29, 2025
Merged

refactor: remove unused e-mail controller#2318
jo-elimu merged 3 commits intomainfrom
remove-unused-email-controller

Conversation

@jo-elimu
Copy link
Copy Markdown
Member

elimu-ai/wiki#194

Issue Number

  • Resolves #

Purpose

Technical Details

Testing Instructions

Screenshots


Format Checks

Note

Files in PRs are automatically checked for format violations with mvn spotless:check.

If this PR contains files with format violations, run mvn spotless:apply to fix them.

@jo-elimu jo-elimu self-assigned this Jul 29, 2025
@jo-elimu jo-elimu requested a review from a team as a code owner July 29, 2025 08:16
@jo-elimu jo-elimu requested review from AshishBagdane, nya-elimu and tomaszsmy and removed request for a team July 29, 2025 08:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 29, 2025

## Walkthrough

The dependency tree for the project was updated to version 2.6.112-SNAPSHOT, removing several transitive dependencies related to `commons-validator`. The `AddEmailController` class, which handled contributor email addition and validation, was deleted. Multiple REST controllers had their response media type annotations changed from `APPLICATION_JSON_UTF8_VALUE` to `APPLICATION_JSON_VALUE`. Additionally, the storybook import logic was enhanced to detect more metadata markers in chapter text.

## Changes

| Cohort / File(s)                                                                                  | Change Summary                                                                                                    |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| **Dependency Tree Update**<br>`pom-dependency-tree.txt`                                         | Updated dependency tree to 2.6.112-SNAPSHOT; removed transitive dependencies on `commons-validator` and related libraries. |
| **Controller Removal**<br>`src/main/java/ai/elimu/web/content/contributor/AddEmailController.java` | Deleted the `AddEmailController`, which managed contributor email addition, validation, and persistence logic.    |
| **REST Controllers Media Type Update**<br>`src/main/java/ai/elimu/rest/v2/applications/ApplicationsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/EmojisRestController.java`, `src/main/java/ai/elimu/rest/v2/content/ImagesRestController.java`, `src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/LettersRestController.java`, `src/main/java/ai/elimu/rest/v2/content/NumbersRestController.java`, `src/main/java/ai/elimu/rest/v2/content/SoundsRestController.java`, `src/main/java/ai/elimu/rest/v2/content/StoryBooksRestController.java`, `src/main/java/ai/elimu/rest/v2/content/VideosRestController.java`, `src/main/java/ai/elimu/rest/v2/content/WordsRestController.java` | Changed `@RequestMapping` annotation `produces` attribute from `MediaType.APPLICATION_JSON_UTF8_VALUE` to `MediaType.APPLICATION_JSON_VALUE` in multiple REST controllers, updating the Content-Type header for JSON responses. |
| **StoryBook Metadata Detection Enhancement**<br>`src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java` | Extended metadata detection in ePUB import by adding checks for "translated by" and Thai phrases to exclude metadata chapters. |

## Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3009c50 and bb22235.

📒 Files selected for processing (1)
  • src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
🔇 Additional comments (1)
src/main/java/ai/elimu/web/content/storybook/StoryBookCreateFromEPubController.java (1)

388-390: LGTM! Enhanced metadata detection for translation indicators.

The addition of translation markers ("translated by", "แปลโดย", "แปล โดย") appropriately extends the metadata detection logic to filter out translator credit pages from imported storybook content. The Thai language variants are particularly relevant for the LETS_READ_ASIA provider as indicated by the comments.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-unused-email-controller

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pom-dependency-tree.txt (1)

22-22: Consider excluding commons-lang:2.6; only keep commons-lang3

Both the very old commons-lang:commons-lang:2.6 (line 22) and the modern org.apache.commons:commons-lang3:3.15.0 (line 29) are now on the class-path. They share similar package names (org.apache.commons.lang.* vs org.apache.commons.lang3.*) but provide overlapping utilities, leading to:

• ​Unnecessary WAR size increase
• Confusion for developers (two different APIs with similar names)
• Risk of accidentally using the deprecated 2.x API in new code

Unless 2.x is required by legacy code you still keep, add an <exclusion> on the artifact that drags it in (often commons-dbcp or commons-csv) and rely solely on commons-lang3.

Also applies to: 29-29

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6361048 and 30242a9.

⛔ Files ignored due to path filters (1)
  • pom.xml is excluded by !**/*.xml
📒 Files selected for processing (2)
  • pom-dependency-tree.txt (1 hunks)
  • src/main/java/ai/elimu/web/content/contributor/AddEmailController.java (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/ai/elimu/web/content/contributor/AddEmailController.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
pom-dependency-tree.txt (2)

Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.

Learnt from: jo-elimu
PR: #2312
File: src/main/java/ai/elimu/entity/analytics/LetterSoundLearningEvent.java:19-31
Timestamp: 2025-07-27T03:40:02.040Z
Learning: In the elimu.ai webapp project, the database schema file at src/main/resources/META-INF/jpa-schema-export.sql is auto-generated from JPA entity annotations, so manual updates to this file are not needed when adding new entity fields.

🔇 Additional comments (2)
pom-dependency-tree.txt (2)

116-155: Heavy Selenium stack is on compile scope – move to test to avoid bloating the WAR

selenium-java and its ~40 transitive jars (lines 116-155) are marked compile. Unless the webapp uses Selenium at runtime (rare; it is usually only for integration tests), keep them under test scope to:

• Shrink the deployed artifact dramatically
• Cut startup time & CVE surface area
• Avoid licensing/compliance noise in production

Action: change the dependency in the POM to

<scope>test</scope>

and verify nothing in main-src refers to Selenium classes.


1-11: Dependency tree looks clean – commons-validator & friends successfully gone

Snapshot bump to 2.6.112-SNAPSHOT no longer lists commons-validator, commons-beanutils, commons-digester, or commons-logging, confirming the e-mail controller removal eliminated unused baggage. Nice cleanup!

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 29, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.14%. Comparing base (65cd53c) to head (bb22235).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...t/storybook/StoryBookCreateFromEPubController.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2318      +/-   ##
============================================
+ Coverage     17.12%   17.14%   +0.01%     
+ Complexity      462      461       -1     
============================================
  Files           261      260       -1     
  Lines          7741     7730      -11     
  Branches        897      898       +1     
============================================
- Hits           1326     1325       -1     
+ Misses         6333     6323      -10     
  Partials         82       82              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jo-elimu jo-elimu merged commit 97ebc15 into main Jul 29, 2025
12 of 14 checks passed
@jo-elimu jo-elimu deleted the remove-unused-email-controller branch July 29, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant