Skip to content

test: regression tests for csv exports#2282

Merged
jo-elimu merged 4 commits intomainfrom
2280-regression-tests-csv-export
Jun 24, 2025
Merged

test: regression tests for csv exports#2282
jo-elimu merged 4 commits intomainfrom
2280-regression-tests-csv-export

Conversation

@jo-elimu
Copy link
Copy Markdown
Member

Issue Number

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 Jun 24, 2025
@jo-elimu jo-elimu requested a review from a team as a code owner June 24, 2025 13:01
@jo-elimu jo-elimu requested review from AshishBagdane, shiv810 and vuriaval and removed request for a team June 24, 2025 13:01
@jo-elimu jo-elimu linked an issue Jun 24, 2025 that may be closed by this pull request
3 tasks
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 100 lines in your changes missing coverage. Please review.

Project coverage is 16.45%. Comparing base (0a4f4d5) to head (e8c0abd).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
.../ai/elimu/web/servlet/CustomDispatcherServlet.java 0.00% 15 Missing ⚠️
...etterSoundAssessmentEventsCsvExportController.java 0.00% 13 Missing ⚠️
...dents/NumberLearningEventsCsvExportController.java 0.00% 13 Missing ⚠️
...dents/WordAssessmentEventsCsvExportController.java 0.00% 13 Missing ⚠️
...ts/StoryBookLearningEventsCsvExportController.java 0.00% 12 Missing ⚠️
...udents/VideoLearningEventsCsvExportController.java 0.00% 12 Missing ⚠️
...tudents/WordLearningEventsCsvExportController.java 0.00% 12 Missing ⚠️
.../LetterSoundLearningEventsCsvExportController.java 0.00% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2282      +/-   ##
============================================
- Coverage     16.47%   16.45%   -0.03%     
  Complexity      450      450              
============================================
  Files           254      254              
  Lines          7477     7488      +11     
  Branches        849      868      +19     
============================================
  Hits           1232     1232              
- Misses         6180     6191      +11     
  Partials         65       65              

☔ 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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

The changes introduce explicit setting of HTTP response status to 500 (Internal Server Error) in the exception handlers of several student analytics CSV export controllers. Null checks are added before accessing enum fields to prevent NullPointerExceptions. Loop variables are renamed for brevity. Conditional logic is added for experiment field assignment during event population. Selenium-based UI tests are added to verify CSV export endpoints, and minor updates are made to test utilities and dependency versioning.

Changes

File(s) Change Summary
src/main/java/ai/elimu/web/analytics/students/*CsvExportController.java (all 8 controllers) Add null checks before calling .ordinal() on enums; rename loop variable to event; set HTTP 500 status on exceptions.
src/main/java/ai/elimu/web/servlet/CustomDispatcherServlet.java Add conditional logic for experiment fields assignment based on week count during event population.
src/test/java/selenium/analytics/students/StudentPage.java Add methods to retrieve CSV export URLs for multiple event types.
src/test/java/selenium/analytics/students/StudentTest.java Remove unused import.
src/test/java/selenium/analytics/students/csv/StudentCsvExportTest.java Add new Selenium test class verifying CSV export endpoints for student analytics.
pom-dependency-tree.txt Update main project artifact version from 2.6.78-SNAPSHOT to 2.6.79-SNAPSHOT.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant Logger/Discord
    participant Response

    Client->>Controller: Request CSV export
    alt Normal operation
        Controller->>Response: Return CSV file (HTTP 200)
    else Exception occurs
        Controller->>Logger/Discord: Log error and notify
        Controller->>Response: Set HTTP status 500
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Add Discord notification (#2280)
Add regression test (#2280)
Handle NullPointer exception (#2280) Null checks added before accessing enum fields to prevent NullPointerExceptions.

Assessment against linked issues: Out-of-scope changes

Code Change (file_path) Explanation
Conditional experiment field assignment logic (src/main/java/ai/elimu/web/servlet/CustomDispatcherServlet.java) This logic relates to event population timing and is unrelated to CSV export exception handling or regression testing in #2280.
Version bump in dependency tree (pom-dependency-tree.txt) Project version update is unrelated to the objectives of #2280.

Possibly related PRs

Suggested reviewers

  • vrudas
  • SnehaHS65
  • Souvik-Cyclic

📜 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 5d87c97 and e8c0abd.

📒 Files selected for processing (7)
  • src/main/java/ai/elimu/web/analytics/students/LetterSoundAssessmentEventsCsvExportController.java (1 hunks)
  • src/main/java/ai/elimu/web/analytics/students/LetterSoundLearningEventsCsvExportController.java (3 hunks)
  • src/main/java/ai/elimu/web/analytics/students/NumberLearningEventsCsvExportController.java (3 hunks)
  • src/main/java/ai/elimu/web/analytics/students/StoryBookLearningEventsCsvExportController.java (3 hunks)
  • src/main/java/ai/elimu/web/analytics/students/VideoLearningEventsCsvExportController.java (3 hunks)
  • src/main/java/ai/elimu/web/analytics/students/WordAssessmentEventsCsvExportController.java (3 hunks)
  • src/main/java/ai/elimu/web/analytics/students/WordLearningEventsCsvExportController.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/main/java/ai/elimu/web/analytics/students/WordAssessmentEventsCsvExportController.java
  • src/main/java/ai/elimu/web/analytics/students/StoryBookLearningEventsCsvExportController.java
  • src/main/java/ai/elimu/web/analytics/students/NumberLearningEventsCsvExportController.java
  • src/main/java/ai/elimu/web/analytics/students/LetterSoundLearningEventsCsvExportController.java
  • src/main/java/ai/elimu/web/analytics/students/VideoLearningEventsCsvExportController.java
  • src/main/java/ai/elimu/web/analytics/students/WordLearningEventsCsvExportController.java
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: test_rest
  • GitHub Check: build (ubuntu-latest, 17)
  • GitHub Check: build (windows-latest, 21)
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (macos-latest, 21)
  • GitHub Check: build (ubuntu-latest, 21)
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: test_rest
🔇 Additional comments (2)
src/main/java/ai/elimu/web/analytics/students/LetterSoundAssessmentEventsCsvExportController.java (2)

64-77: LGTM! Clean variable renaming improves readability.

The variable renaming from letterSoundAssessmentEvent to event makes the code more concise and readable while maintaining clarity in the loop context.


73-74: Excellent defensive programming with null checks.

Adding null checks before calling .ordinal() on the enum fields prevents potential NullPointerException during CSV export. This is a robust approach for handling optional experiment data.

✨ Finishing Touches
  • 📝 Generate Docstrings

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 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.

@jo-elimu jo-elimu merged commit 1bbd4b2 into main Jun 24, 2025
19 of 20 checks passed
@jo-elimu jo-elimu deleted the 2280-regression-tests-csv-export branch June 24, 2025 14:09
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.

Exception during CSV export

1 participant