Skip to content

[CUS-12329] fixed the issue of file name being too long.#384

Merged
ManojTestsigma merged 2 commits into
devfrom
CUS-12329
Jun 5, 2026
Merged

[CUS-12329] fixed the issue of file name being too long.#384
ManojTestsigma merged 2 commits into
devfrom
CUS-12329

Conversation

@ManojTestsigma

@ManojTestsigma ManojTestsigma commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

please review this addon and publish as PUBLIC

Addon name : csv_file_update_from_upload_section
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-12329

RCA

in the addon unique time stamp was added for each execution.. because of this we are getting file name too long error.
Screenshot 2026-04-27 at 11 09 39 AM

fix

update the code to add only time stamp and millis to the filename
Screenshot 2026-04-27 at 11 10 45 AM

Summary by CodeRabbit

Release Notes

  • Chores
    • Version updated to 1.0.6

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9504b66f-9559-4783-9484-3dc6f6517ac3

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6b0cf and ba0b41b.

📒 Files selected for processing (1)
  • csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java

📝 Walkthrough

Walkthrough

This PR increments the CSV module version to 1.0.6 and adds a clarifying comment documenting the conversion between 1-based user-facing indices and 0-based internal array indices used in the CSV processing logic.

Changes

CSV Module Maintenance

Layer / File(s) Summary
Version bump and index conversion documentation
csv_file_update_from_upload_section/pom.xml, csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java
Module version incremented to 1.0.6. Inline comment added clarifying that CSV row/column indices from users (1-based) are converted to 0-based indices for internal array access.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • vignesh-testsigma
  • vigneshtestsigma

Poem

🐰 A version hops from four to six,
With comments clear and index mix,
One-based up, then down to zero,
Our CSV docs are now a hero!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing an issue where file names were becoming too long due to exponential path growth in temporary file generation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CUS-12329

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/StoreRowCountCsvFile.java (1)

91-103: ⚠️ Potential issue | 🟡 Minor

originalFileName is now unused — log it or remove it.

The PR description says the fix "keeps the original filename extracted and logged separately for traceability". In this file, however, originalFileName is computed at line 91 and never referenced again (the log at line 102 only includes tempPath), making it effectively dead code and also diverging from the behavior in WriteCsvFileandStorePath.java and DeleteRowContentFromCsvAndStorePath.java, which both log it.

📝 Suggested fix — log the original name to retain traceability
             String originalFileName = FilenameUtils.getName(new URL(pathOrUrl).getPath());
             // Use only the timestamp for uniqueness — the original name can be arbitrarily long
             // (e.g. an encoded path from a prior temp file), which would exceed OS filename limits
             String uniqueFileName = "temp_" + System.currentTimeMillis() + ".csv";

             String tempPath = FileUtils.getTempDirectoryPath()
                     + File.separator + uniqueFileName;

             File tempFile = new File(tempPath);
             FileUtils.copyURLToFile(new URL(pathOrUrl), tempFile, 10000, 10000);

-            logger.info("Downloaded CSV from URL to temp location: " + tempPath);
+            logger.info("Downloaded CSV from URL (original name: " + originalFileName
+                    + ") to temp location: " + tempPath);
             return tempFile;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/StoreRowCountCsvFile.java`
around lines 91 - 103, The variable originalFileName in
StoreRowCountCsvFile.java is computed but never used; update the download
logging to include it for traceability (similar to WriteCsvFileandStorePath.java
and DeleteRowContentFromCsvAndStorePath.java) by appending originalFileName to
the existing logger.info that currently reports tempPath (or, if you prefer,
remove the originalFileName computation entirely); locate the code around the
URL download where originalFileName, uniqueFileName, tempPath, and tempFile are
defined and ensure the logger.info call references originalFileName so the
original filename is preserved in logs.
🧹 Nitpick comments (2)
csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java (1)

169-175: Filename fix is correct; consider a collision-safe variant.

The "temp_" + millis + ".csv" pattern correctly breaks the recursive embedding of encoded paths that produced the 255-byte filename overflow. As an optional hardening step, two parallel executions hitting convertToFile within the same millisecond would produce the same temp path and race on copyURLToFile (one download could overwrite a sibling's file mid-read). Using Files.createTempFile or appending UUID.randomUUID()/nanoTime() eliminates that race.

♻️ Optional — collision-safe temp file
-            String uniqueFileName = "temp_" + System.currentTimeMillis() + ".csv";
-            logger.info("Given is a URL... Original file name: " + originalFileName + ", Unique file name: "
-                    + uniqueFileName);
-
-            // Create the full path for the temporary file
-            String filePath = String.format("%s%s%s", FileUtils.getTempDirectoryPath(), File.separator, uniqueFileName);
-            File tempFile = new File(filePath);
+            File tempFile = Files.createTempFile("temp_", ".csv").toFile();
+            logger.info("Given is a URL... Original file name: " + originalFileName
+                    + ", Unique file name: " + tempFile.getName());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java`
around lines 169 - 175, The current uniqueFileName generation in
WriteCsvFileandStorePath (variable uniqueFileName inside convertToFile handling
the URL path) uses "temp_"+System.currentTimeMillis()+".csv" which can collide
if called multiple times in the same millisecond; change it to a collision-safe
temp file creation strategy — either use Files.createTempFile(...) to get a
guaranteed-unique temp path or append a UUID (e.g. UUID.randomUUID()) or
System.nanoTime() to the generated name before using it with copyURLToFile;
update any logging that references uniqueFileName accordingly (logger.info
lines) to reflect the new approach.
csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/DeleteRowContentFromCsvAndStorePath.java (1)

80-87: Dead null check on csvFile.

convertToFile either returns a new File(...) or throws — it never returns null. The csvFile == null half of the guard is dead and can be removed for clarity. The !csvFile.exists() check is still useful and should stay.

♻️ Proposed simplification
-            if (csvFile == null || !csvFile.exists()) {
+            if (!csvFile.exists()) {
                 setErrorMessage("CSV File not found or could not be downloaded: " + filePathString);
                 return com.testsigma.sdk.Result.FAILED;
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/DeleteRowContentFromCsvAndStorePath.java`
around lines 80 - 87, The null check on csvFile is dead because convertToFile
either returns a File or throws; update the block in
DeleteRowContentFromCsvAndStorePath so you remove the "csvFile == null ||" part
and only check "!csvFile.exists()"; keep the call to
convertToFile(filePathString), retain logger.info("CSV file path: " +
csvFile.getAbsolutePath()), and keep setErrorMessage(...) and return
com.testsigma.sdk.Result.FAILED when the file does not exist.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/DeleteRowContentFromCsvAndStorePath.java`:
- Around line 26-31: Update the Action annotation on class
DeleteRowContentFromCsvAndStorePath: change the actionText to start with a
capitalized verb ("Clear" instead of "clear") and make the column clause mirror
the row clause for clarity (e.g., change "and column column-number" to "and
column is column-number"); ensure the description string remains unchanged
except for any matching capitalization if you choose to keep consistency between
actionText and description.

---

Outside diff comments:
In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/StoreRowCountCsvFile.java`:
- Around line 91-103: The variable originalFileName in StoreRowCountCsvFile.java
is computed but never used; update the download logging to include it for
traceability (similar to WriteCsvFileandStorePath.java and
DeleteRowContentFromCsvAndStorePath.java) by appending originalFileName to the
existing logger.info that currently reports tempPath (or, if you prefer, remove
the originalFileName computation entirely); locate the code around the URL
download where originalFileName, uniqueFileName, tempPath, and tempFile are
defined and ensure the logger.info call references originalFileName so the
original filename is preserved in logs.

---

Nitpick comments:
In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/DeleteRowContentFromCsvAndStorePath.java`:
- Around line 80-87: The null check on csvFile is dead because convertToFile
either returns a File or throws; update the block in
DeleteRowContentFromCsvAndStorePath so you remove the "csvFile == null ||" part
and only check "!csvFile.exists()"; keep the call to
convertToFile(filePathString), retain logger.info("CSV file path: " +
csvFile.getAbsolutePath()), and keep setErrorMessage(...) and return
com.testsigma.sdk.Result.FAILED when the file does not exist.

In
`@csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java`:
- Around line 169-175: The current uniqueFileName generation in
WriteCsvFileandStorePath (variable uniqueFileName inside convertToFile handling
the URL path) uses "temp_"+System.currentTimeMillis()+".csv" which can collide
if called multiple times in the same millisecond; change it to a collision-safe
temp file creation strategy — either use Files.createTempFile(...) to get a
guaranteed-unique temp path or append a UUID (e.g. UUID.randomUUID()) or
System.nanoTime() to the generated name before using it with copyURLToFile;
update any logging that references uniqueFileName accordingly (logger.info
lines) to reflect the new approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5cfc6b44-91e5-4d14-8426-4553ebeed242

📥 Commits

Reviewing files that changed from the base of the PR and between b42105a and 3b6b0cf.

📒 Files selected for processing (4)
  • csv_file_update_from_upload_section/pom.xml
  • csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/DeleteRowContentFromCsvAndStorePath.java
  • csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/StoreRowCountCsvFile.java
  • csv_file_update_from_upload_section/src/main/java/com/testsigma/addons/web/WriteCsvFileandStorePath.java

@ManojTestsigma
ManojTestsigma merged commit eba2421 into dev Jun 5, 2026
1 check was pending
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