Skip to content

Comments

Cluster#1518

Closed
niveathika wants to merge 4 commits intomasterfrom
cluster
Closed

Cluster#1518
niveathika wants to merge 4 commits intomasterfrom
cluster

Conversation

@niveathika
Copy link
Contributor

Purpose

Examples

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

@niveathika niveathika added the Skip GraalVM Check This will skip the GraalVM compatibility check label Dec 10, 2025
@niveathika niveathika requested a review from Copilot December 10, 2025 11:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new onFileDelete method as a replacement for the deprecated onFileDeleted method in the FTP listener service. The key change is the method signature: onFileDelete is invoked once per deleted file with a single string parameter, while onFileDeleted receives all deleted files as a string[] array in a single invocation.

  • Added new onFileDelete remote function that processes deletions one file at a time
  • Deprecated the existing onFileDeleted method with appropriate compiler warnings
  • Updated task scheduling to use task:Listener instead of task:scheduleJobRecurByFrequency

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
native/src/main/java/io/ballerina/stdlib/ftp/util/FtpConstants.java Added constant for the new ON_FILE_DELETE_REMOTE_FUNCTION
native/src/main/java/io/ballerina/stdlib/ftp/util/FtpUtil.java Updated method lookup to support both onFileDelete and onFileDeleted
native/src/main/java/io/ballerina/stdlib/ftp/server/FtpListener.java Implemented processDeletionCallback to route to appropriate handler based on parameter type, added processFileDeleteCallback for per-file invocation
compiler-plugin/src/main/java/io/ballerina/stdlib/ftp/plugin/PluginConstants.java Added new error codes and messages for onFileDelete validation, updated existing error messages to reference new method
compiler-plugin/src/main/java/io/ballerina/stdlib/ftp/plugin/FtpServiceValidator.java Added validation to prevent using both methods simultaneously and ensure at least one deletion handler exists
compiler-plugin/src/main/java/io/ballerina/stdlib/ftp/plugin/FtpFileDeletedValidator.java Refactored to support validation of both method types with appropriate parameter checks
compiler-plugin-tests/src/test/resources/ballerina_sources/valid_content_service_7/* Added test case for valid onFileDelete usage
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_content_service_22-27/* Added test cases for various onFileDelete validation scenarios
compiler-plugin-tests/src/test/java/io/ballerina/stdlib/ftp/plugin/FtpServiceValidationTest.java Added 6 new test methods to validate onFileDelete behavior and error handling
gradle.properties Updated stdlibTaskVersion from 2.7.0 to 2.11.0
docs/spec/spec.md Updated specification to document onFileDelete instead of onFileDeleted
changelog.md Added entry documenting the deprecation and new method
ballerina/tests/listener_on_file_deleted_test.bal Updated tests to use onFileDelete with per-file invocation pattern
ballerina/listener_endpoint.bal Refactored task scheduling to use task:Listener API instead of job-based scheduling
ballerina/client_endpoint.bal Moved deprecation notices in documentation comments
ballerina/caller.bal Moved deprecation notices in documentation comments
ballerina/Dependencies.toml Updated dependencies to reflect new task library version and added test dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# + path - The resource path
# + content - Content to be written to the file in server
# + return - `()` or else an `ftp:Error` if failed to establish the communication with the FTP server
# # Deprecated: Use the format specific put methods(`putJson`, `putXml`, `putCsv`, `putBytes`, `putText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Copilot uses AI. Check for mistakes.
# + path - The resource path
# + content - Content to be written to the file in server
# + return - `()` or else an `ftp:Error` if failed to establish the communication with the FTP server
# # Deprecated: Use the format specific put methods(`putJson`, `putXml`, `putCsv`, `putBytes`, `putText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Copilot uses AI. Check for mistakes.
Comment on lines 42 to 47
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = client->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Suggested change
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = client->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = client->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors

Copilot uses AI. Check for mistakes.
# + content - Content to be written to the file in server
# + compressionType - Type of the compression to be used if the file should be compressed before uploading
# + return - `()` or else an `ftp:Error` if failed to establish the communication with the FTP server
# # Deprecated: Use the format specific put methods(`putJson`, `putXml`, `putCsv`, `putBytes`, `putText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 39
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = caller->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Suggested change
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = caller->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
# # Deprecated: Use the format specific get methods(`getJson`, `getXml`, `getCsv`, `getBytes`, `getText`) instead.
# ```ballerina
# stream<byte[] & readonly, io:Error?>|ftp:Error channel = caller->get(path);
# ```
#
# + path - The resource path
# + return - A byte stream from which the file can be read or `ftp:Error` in case of errors

Copilot uses AI. Check for mistakes.
# + content - Content to be written to the file in server
# + compressionType - Type of the compression to be used if the file should be compressed before uploading
# + return - `()` or else an `ftp:Error` if failed to establish the communication with the FTP server
# # Deprecated: Use the format specific put methods(`putJson`, `putXml`, `putCsv`, `putBytes`, `putText`) instead.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The comment formatting for the deprecation notice is inconsistent with the rest of the documentation. The deprecation notice should appear before the code example, not after the return parameter description. This pattern is inconsistent with how deprecation is handled in other methods in the same file.

Copilot uses AI. Check for mistakes.
- [Added missing Commons VFS configuration parameters](https://github.com/ballerina-platform/ballerina-library/issues/8369)
- Add functionality for streaming put methods in ftp:Client
- Add functionality for type based put and get in ftp:Caller
- Deprecate `onFileDeleted` method and introduced `onFileDelete`
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

Grammar issue in the changelog entry. The verb tense is inconsistent: "Deprecate" should be changed to "Deprecated" to match the past tense used in "introduced". The entry should read: "Deprecated onFileDeleted method and introduced onFileDelete"

Suggested change
- Deprecate `onFileDeleted` method and introduced `onFileDelete`
- Deprecated `onFileDeleted` method and introduced `onFileDelete`

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.83%. Comparing base (2ab4ca2) to head (d73200c).

Files with missing lines Patch % Lines
ballerina/listener_endpoint.bal 85.71% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1518      +/-   ##
============================================
+ Coverage     81.70%   81.83%   +0.12%     
- Complexity      588      792     +204     
============================================
  Files            40       55      +15     
  Lines          2892     3485     +593     
  Branches        468      595     +127     
============================================
+ Hits           2363     2852     +489     
- Misses          337      381      +44     
- Partials        192      252      +60     

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

@niveathika niveathika force-pushed the cluster branch 2 times, most recently from 13ca981 to 9d70cb9 Compare January 26, 2026 05:57
@sonarqubecloud
Copy link

@niveathika niveathika closed this Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip GraalVM Check This will skip the GraalVM compatibility check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant