Skip to content

feat/CUS-9870-Added class to subtract minutes#290

Merged
akhil-testsigma merged 1 commit intodevfrom
feat/CUS-9870-Added-class-to-subtract-minutes
Dec 24, 2025
Merged

feat/CUS-9870-Added class to subtract minutes#290
akhil-testsigma merged 1 commit intodevfrom
feat/CUS-9870-Added-class-to-subtract-minutes

Conversation

@akhil-testsigma
Copy link
Copy Markdown
Contributor

@akhil-testsigma akhil-testsigma commented Dec 24, 2025

Publish this addon as public

Addon Name: Add minutes to the specific date time and store the output in specific format
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira : https://testsigma.atlassian.net/browse/CUS-9870
Added class to subtract minutes

Summary by CodeRabbit

  • New Features

    • Added subtract minutes from datetime functionality with customizable output formats and runtime variable storage.
  • Improvements

    • Enhanced error messages and diagnostic logging for datetime operations.
  • Chores

    • Updated project version and dependencies including Lombok and Apache Commons Lang.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 24, 2025

📝 Walkthrough

Walkthrough

The pull request updates the project version, upgrades dependencies (Lombok, adds commons-lang3), improves exception handling in AddMinutesToDateTime, and introduces a new SubtractMinutesToDateTime class that mirrors the add functionality. Additional changes to a Calculator class include a new method, updated method signature, and variable renaming.

Changes

Cohort / File(s) Summary
Maven Configuration
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/pom.xml
Version bump (1.0.1 → 1.0.3), Lombok update (1.18.20 → 1.18.30), new commons-lang3:3.17.0 dependency added
DateTime Utilities Enhancement
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/AddMinutesToDateTime.java
Enhanced exception handling: added ExceptionUtils import, replaced raw e.getMessage() with ExceptionUtils.getMessage(e) and exception toString with ExceptionUtils.getStackTrace(e) in catch block
DateTime Subtraction Feature
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
New WebAction class that subtracts minutes from datetime/time inputs, validates input, computes result, formats output, and stores in RunTimeData; includes execute() method and subtractMinutesToDateTime(String, String, String, int) helper
Calculator Module Updates
src/calculator.py
Added coderabbit_add(x, y) method; updated coderabbit_formula(x, y) signature to include z parameter; renamed global variable from old_global_var to new_global_var

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Twitching whiskers with glee,
Minutes subtract with newfound ease!
Exception handlers so precise,
Version bumped—improvements nice!
From add to subtract we now can choose, 🕐
Formatters dance, there's nothing to lose!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: adding a new class (SubtractMinutesToDateTime) to subtract minutes from datetime values.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/CUS-9870-Added-class-to-subtract-minutes

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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: 7

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11fe940 and b8d0783.

📒 Files selected for processing (3)
  • add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/pom.xml
  • add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/AddMinutesToDateTime.java
  • add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
🔇 Additional comments (2)
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/pom.xml (1)

9-9: LGTM!

The version bump to 1.0.3 is appropriate for the new subtract minutes functionality being added.

add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/AddMinutesToDateTime.java (1)

9-9: LGTM! Improved exception handling.

The use of ExceptionUtils improves error handling by providing more robust error message extraction and full stack trace logging. This is a good enhancement for debugging and error reporting.

Also applies to: 78-82

<testsigma.addon.maven.plugin>1.0.0</testsigma.addon.maven.plugin>
<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
<lombok.version>1.18.20</lombok.version>
<lombok.version>1.18.30</lombok.version>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Lombok version 1.18.30 latest stable release security advisories

💡 Result:

Short answer: There are no Lombok-specific security advisories or CVEs targeting lombok 1.18.30. Project Lombok states the tool is a build-time dependency and is "highly unlikely" to be a source of security vulnerabilities; the 1.18.30 release (Sept 20, 2023) contains only platform/bugfix changes. If you worry about transitive or test-only deps (e.g., Log4j), those are separate projects to track. [1][2][3][4]

Sources:

  • Project Lombok — Security page. [1]
  • Lombok changelog — v1.18.30 (Sept 20, 2023). [2]
  • Maven Central listing for org.projectlombok:lombok:1.18.30. [3]
  • Project Lombok GitHub — discussion: Log4j issue (lombok itself not affected). [4]

🌐 Web query:

Lombok latest version 2024 2025 current release

💡 Result:

As of Dec 24, 2025 the latest Project Lombok release is 1.18.42 (published Sept 18, 2025). [1][2]

Sources:
[1] Maven Central listing for org.projectlombok:lombok.
[2] lombok-annotations changelog / release notes.


Update Lombok to version 1.18.42.

Lombok 1.18.30 is secure with no known CVEs, but version 1.18.42 (released September 2025) is the current stable release. Update to the latest version for bug fixes and improvements.

🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/pom.xml
around line 20, the project is declaring Lombok version 1.18.30; update this
property to 1.18.42. Edit the <lombok.version> element to 1.18.42, save the pom,
and run a Maven build (or mvn -U) to refresh dependencies and verify there are
no compilation or test regressions.

Comment on lines +64 to +68
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
</dependency>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Apache Commons Lang 3 latest version 2025 security advisories

💡 Result:

Short answer

  • Latest Commons Lang 3 release (as of Dec 24, 2025): 3.20.0 (released Nov 12, 2025). [1]
  • Known recent security advisory: CVE-2025-48924 — uncontrolled recursion (StackOverflowError/DoS) in ClassUtils.getClass(...) affecting commons-lang3 >=3.0 and <3.18.0; fixed in 3.18.0. Upgrade to 3.18.0+ (recommended: 3.20.0). [2][3]

Sources

  • Apache Commons Lang release notes (3.20.0). [1]
  • NVD CVE-2025-48924 entry. [2]
  • GitHub Advisory / vendor advisories about CVE-2025-48924 (notes that 3.18.0 contains the fix). [3]

Upgrade commons-lang3 to version 3.20.0 to address critical security vulnerability.

Version 3.17.0 is vulnerable to CVE-2025-48924 (uncontrolled recursion causing DoS in ClassUtils.getClass) affecting all versions < 3.18.0. Upgrade to 3.20.0 (latest stable, released Nov 12, 2025) or at minimum 3.18.0 where the vulnerability is fixed.

🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/pom.xml
around lines 64 to 68 the project depends on commons-lang3 version 3.17.0 which
is vulnerable; update the <version> from 3.17.0 to 3.20.0 (or at minimum 3.18.0)
for that dependency, run a Maven build (mvn -U clean verify) to refresh and
validate, and update any generated lock/CI config or dependency-management
entries that pin the older version to ensure the new version is used across the
build.

Comment on lines +16 to +20
@Data
@Action(actionText = "Subtract minute minutes to the input-datetime with input-datetime-format, convert to output-datetime-format format, and store it in a runtime variable variable-name",
description = "Subtracts specified minutes to a given input datetime, converts the resulting datetime to a specified date-time format, and stores it in a runtime variable",
applicationType = ApplicationType.WEB,
useCustomScreenshot = false)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix grammatical errors in the action text and description.

The annotation contains grammatical errors:

  • Line 17: "Subtract minute minutes to" should be "Subtract minutes from"
  • Line 18: "Subtracts specified minutes to" should be "Subtracts specified minutes from"

These are user-facing strings that affect clarity and professionalism.

🔎 Proposed fix
-@Action(actionText = "Subtract minute minutes to the input-datetime with input-datetime-format, convert to output-datetime-format format, and store it in a runtime variable variable-name",
-        description = "Subtracts specified minutes to a given input datetime, converts the resulting datetime to a specified date-time format, and stores it in a runtime variable",
+@Action(actionText = "Subtract minutes from the input-datetime with input-datetime-format, convert to output-datetime-format format, and store it in a runtime variable variable-name",
+        description = "Subtracts specified minutes from a given input datetime, converts the resulting datetime to a specified date-time format, and stores it in a runtime variable",
         applicationType = ApplicationType.WEB,
         useCustomScreenshot = false)
🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
around lines 16 to 20, the actionText and description contain incorrect
prepositions ("to" should be "from") and minor wording issues; update the
actionText to use "Subtract minutes from the input-datetime with
input-datetime-format, convert to output-datetime-format, and store it in a
runtime variable variable-name" and update the description to "Subtracts
specified minutes from a given input datetime, converts the resulting datetime
to a specified date-time format, and stores it in a runtime variable."

Comment on lines +29 to +30
@TestData(reference = "minute")
private com.testsigma.sdk.TestData minutesToAdd;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Rename variable for consistency with subtract operation.

The variable is named minutesToAdd but this class performs subtraction. For clarity and maintainability, rename it to minutesToSubtract.

🔎 Proposed fix
     @TestData(reference = "minute")
-    private com.testsigma.sdk.TestData minutesToAdd;
+    private com.testsigma.sdk.TestData minutesToSubtract;

Note: This will also require updating references at lines 45 and 49.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
around lines 29-30, the TestData field is named minutesToAdd but this class
performs subtraction; rename the field to minutesToSubtract and update all
references accordingly (notably at lines 45 and 49) so getters/setters/usages
reflect the new name; ensure imports and serialization annotations (if any)
remain correct and run a build to catch any remaining references.

Comment on lines +66 to +67
setSuccessMessage(String.format("Added %s minutes to %s and stored the output in '%s' format. %s : %s",
minutes, dateTimeString, outputFormatString, variableNameString, newDateTime));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

CRITICAL: Success message incorrectly states "Added" instead of "Subtracted".

The success message says "Added %s minutes" but this class performs subtraction. This will mislead users about what operation was actually performed.

🔎 Proposed fix
-                setSuccessMessage(String.format("Added %s minutes to %s and stored the output in '%s' format. %s : %s",
+                setSuccessMessage(String.format("Subtracted %s minutes from %s and stored the output in '%s' format. %s : %s",
                         minutes, dateTimeString, outputFormatString, variableNameString, newDateTime));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setSuccessMessage(String.format("Added %s minutes to %s and stored the output in '%s' format. %s : %s",
minutes, dateTimeString, outputFormatString, variableNameString, newDateTime));
setSuccessMessage(String.format("Subtracted %s minutes from %s and stored the output in '%s' format. %s : %s",
minutes, dateTimeString, outputFormatString, variableNameString, newDateTime));
🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
around lines 66 to 67, the success message wrongly says "Added %s minutes" even
though this class subtracts minutes; change the message to "Subtracted %s
minutes" (keep the rest of the format and variables the same) so the
String.format reflects the actual operation performed.

Comment on lines +69 to +71
result = com.testsigma.sdk.Result.FAILED;
setErrorMessage("Failed to add minutes. Please check the input datetime, input datetime format, and output datetime format.");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update error message to reflect subtract operation.

The error message says "Failed to add minutes" but should say "Failed to subtract minutes" to match the operation.

🔎 Proposed fix
             } else {
                 result = com.testsigma.sdk.Result.FAILED;
-                setErrorMessage("Failed to add minutes. Please check the input datetime, input datetime format, and output datetime format.");
+                setErrorMessage("Failed to subtract minutes. Please check the input datetime, input datetime format, and output datetime format.");
             }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
result = com.testsigma.sdk.Result.FAILED;
setErrorMessage("Failed to add minutes. Please check the input datetime, input datetime format, and output datetime format.");
}
result = com.testsigma.sdk.Result.FAILED;
setErrorMessage("Failed to subtract minutes. Please check the input datetime, input datetime format, and output datetime format.");
}
🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
around lines 69 to 71, the error message incorrectly says "Failed to add
minutes"; change the text to "Failed to subtract minutes. Please check the input
datetime, input datetime format, and output datetime format." so the message
correctly reflects the subtract operation and keep the rest of the error
handling unchanged.

Comment on lines +86 to +108
public String subtractMinutesToDateTime(String dateTimeString, String inputFormatString, String outputFormatString, int minutesToSubtract) {
try {
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(inputFormatString);

//Determine if the input date time is Date or Time
if (inputFormatString.contains("HH") || inputFormatString.contains("mm") || inputFormatString.contains("ss")) {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalTime time = LocalTime.parse(dateTimeString, inputFormatter);
LocalTime newTime = time.minusMinutes(minutesToSubtract);
logger.info("Successfully added minutes to the input time");

return newTime.format(outputFormatter);

} else {

DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalDateTime dateTime = LocalDateTime.parse(dateTimeString, inputFormatter);

LocalDateTime newDateTime = dateTime.minusMinutes(minutesToSubtract);
logger.info("Successfully added minutes to the input datetime");

return newDateTime.format(outputFormatter);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update log messages to reflect subtract operation.

The log messages at lines 95 and 105 say "Successfully added minutes" but should say "Successfully subtracted minutes" to match the operation being performed.

🔎 Proposed fix
             if (inputFormatString.contains("HH") || inputFormatString.contains("mm") || inputFormatString.contains("ss")) {
                 DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
                 LocalTime time = LocalTime.parse(dateTimeString, inputFormatter);
                 LocalTime newTime = time.minusMinutes(minutesToSubtract);
-                logger.info("Successfully added minutes to the input time");
+                logger.info("Successfully subtracted minutes from the input time");

                 return newTime.format(outputFormatter);

             } else {

                 DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
                 LocalDateTime dateTime = LocalDateTime.parse(dateTimeString, inputFormatter);

                 LocalDateTime newDateTime = dateTime.minusMinutes(minutesToSubtract);
-                logger.info("Successfully added minutes to the input datetime");
+                logger.info("Successfully subtracted minutes from the input datetime");

                 return newDateTime.format(outputFormatter);
             }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public String subtractMinutesToDateTime(String dateTimeString, String inputFormatString, String outputFormatString, int minutesToSubtract) {
try {
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(inputFormatString);
//Determine if the input date time is Date or Time
if (inputFormatString.contains("HH") || inputFormatString.contains("mm") || inputFormatString.contains("ss")) {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalTime time = LocalTime.parse(dateTimeString, inputFormatter);
LocalTime newTime = time.minusMinutes(minutesToSubtract);
logger.info("Successfully added minutes to the input time");
return newTime.format(outputFormatter);
} else {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalDateTime dateTime = LocalDateTime.parse(dateTimeString, inputFormatter);
LocalDateTime newDateTime = dateTime.minusMinutes(minutesToSubtract);
logger.info("Successfully added minutes to the input datetime");
return newDateTime.format(outputFormatter);
}
public String subtractMinutesToDateTime(String dateTimeString, String inputFormatString, String outputFormatString, int minutesToSubtract) {
try {
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern(inputFormatString);
//Determine if the input date time is Date or Time
if (inputFormatString.contains("HH") || inputFormatString.contains("mm") || inputFormatString.contains("ss")) {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalTime time = LocalTime.parse(dateTimeString, inputFormatter);
LocalTime newTime = time.minusMinutes(minutesToSubtract);
logger.info("Successfully subtracted minutes from the input time");
return newTime.format(outputFormatter);
} else {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(outputFormatString);
LocalDateTime dateTime = LocalDateTime.parse(dateTimeString, inputFormatter);
LocalDateTime newDateTime = dateTime.minusMinutes(minutesToSubtract);
logger.info("Successfully subtracted minutes from the input datetime");
return newDateTime.format(outputFormatter);
}
🤖 Prompt for AI Agents
In
add_minutes_to_the_specific_date_time_and_store_the_output_in_specific_format/src/main/java/com/testsigma/addons/web/SubtractMinutesToDateTime.java
around lines 86 to 108, the logger messages incorrectly state "Successfully
added minutes..." while the method subtracts minutes; update the two log calls
to "Successfully subtracted minutes to the input time" and "Successfully
subtracted minutes to the input datetime" (or similar consistent phrasing) so
the logs reflect the subtract operation.

@akhil-testsigma akhil-testsigma merged commit 56f9f38 into dev Dec 24, 2025
2 checks passed
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.

2 participants