Skip to content

Review API docs in BI editor#1241

Merged
daneshk merged 8 commits intoballerina-platform:mainfrom
daneshk:main
Mar 18, 2026
Merged

Review API docs in BI editor#1241
daneshk merged 8 commits intoballerina-platform:mainfrom
daneshk:main

Conversation

@daneshk
Copy link
Copy Markdown
Member

@daneshk daneshk commented Oct 1, 2025

Purpose

Related issue: ballerina-platform/ballerina-library#8275

Examples

Checklist

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

Overview

This pull request improves the API documentation for the PostgreSQL module to enhance clarity and consistency in the Ballerina IDE editor. The changes consist primarily of documentation refinements across multiple modules, along with the addition of two new utility methods for procedure result iteration.

Key Changes

Documentation Updates

  • client.bal: Comprehensive updates to API documentation for core client methods (query, queryRow, execute, batchExecute, call, close) and configuration types (ClientConfiguration, Options, SSLMode, SecureSocket, CertKey). Documentation now provides clearer parameter descriptions, return value guidance, and usage examples while maintaining backward compatibility with existing public API signatures.
  • cdc_listener.bal: Clarified return type documentation for CDC listener methods to specify exact error types (e.g., cdc:Error vs generic error descriptions).
  • listener_types.bal: Updated documentation comments for PostgreSQL CDC configuration and listener type definitions to improve clarity and consistency.

New Functionality

  • procedure_params.bal: Added two new public methods to the CustomResultIterator class:
    • nextResult() - enables retrieval of the next result from a SQL result iterator
    • getNextQueryResult() - enables retrieval of the next query result from a procedure call result

These additions support improved handling of result iteration when working with stored procedure calls.

Impact

All changes maintain backward compatibility with existing public API signatures. The updates focus on improving developer experience through clearer documentation and enhanced result iteration capabilities for advanced use cases.

Copy link
Copy Markdown
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 updates API documentation throughout the PostgreSQL Ballerina library to improve clarity, consistency, and accuracy. The changes focus on enhancing docstring descriptions for client methods, listener operations, and configuration types.

  • Improved documentation clarity and consistency across client operations (query, execute, call, etc.)
  • Enhanced parameter descriptions and return value documentation
  • Updated terminology from "Postgres" to "PostgreSQL" for consistency

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ballerina/procedure_params.bal Added comprehensive docstrings for CustomResultIterator methods
ballerina/listener_types.bal Updated "Postgres" references to "PostgreSQL" in configuration documentation
ballerina/client.bal Extensively improved client method documentation with clearer descriptions and parameter details
ballerina/cdc_listener.bal Enhanced error return type documentation to specify cdc:Error

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ballerina/client.bal Outdated
Comment thread ballerina/client.bal Outdated
Comment thread ballerina/client.bal Outdated
daneshk and others added 3 commits October 1, 2025 20:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread ballerina/client.bal Outdated
Comment thread ballerina/client.bal Outdated
Comment thread ballerina/listener_types.bal Outdated
Comment thread ballerina/listener_types.bal Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.57%. Comparing base (97a4445) to head (0cfe5e1).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1241      +/-   ##
============================================
- Coverage     81.63%   81.57%   -0.06%     
+ Complexity      864      863       -1     
============================================
  Files            28       28              
  Lines          3523     3523              
  Branches        484      484              
============================================
- Hits           2876     2874       -2     
- Misses          431      432       +1     
- Partials        216      217       +1     

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

This PR updates documentation across PostgreSQL client and CDC listener components, clarifying API descriptions, parameter types, and return behaviors. Additionally, two new public methods are added to the CustomResultIterator class for querying stored procedure results.

Changes

Cohort / File(s) Summary
Documentation Refinements
ballerina/cdc_listener.bal, ballerina/listener_types.bal
Documentation comments clarified to specify exact error types and improve CDC configuration descriptions; no functional changes to code or public signatures.
PostgreSQL Client API Documentation
ballerina/client.bal
Extensive rewording of method descriptions for query, queryRow, execute, batchExecute, call, and close; parameter and return documentation updated for clarity and consistency. Configuration and type field comments refined. No public API signature changes.
Result Iterator Enhancements
ballerina/procedure_params.bal
Two new public methods added to CustomResultIterator: nextResult() for retrieving next result from sql:ResultIterator and getNextQueryResult() for retrieving next query result from sql:ProcedureCallResult, both with external mappings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • shafreenAnfar
  • niveathika
  • aashikam

Poem

🐰 A doc refresh hops through the code,
With clearer words to ease the load,
New methods bound to queries flow,
Where ResultIterators dance and grow!
The API shines, both bright and spry,
No broken bounds, just clearer skies!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Review API docs in BI editor' is vague and generic, lacking specificity about what API docs were reviewed or what changes were made to them. Replace with a more specific title that describes the actual changes, such as 'Update PostgreSQL client API documentation' or 'Clarify CDC listener and client API docs'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description includes a linked issue and properly formatted checklist sections, but lacks substantive details about the specific changes and their purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

🧹 Nitpick comments (1)
ballerina/procedure_params.bal (1)

617-624: Documentation should mention the nil return case.

The return type is record {}|sql:Error?, but the documentation only mentions returning a record or an sql:Error. The nil case (when there are no more results) should be documented for completeness.

📝 Suggested documentation improvement
     # Retrieves the next result from the `sql:ResultIterator`.
     #
     # + iterator - The `sql:ResultIterator` to fetch the next result from.
-    # + return - A record containing the next result, or an `sql:Error` if an error occurs.
+    # + return - A record containing the next result, `()` if there are no more results, or an `sql:Error` if an error occurs.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ballerina/procedure_params.bal` around lines 617 - 624, The doc comment for
public isolated function nextResult(sql:ResultIterator iterator) must document
the nil return case: update the description and the "+ return" line to state
that the function returns the next record, nil when there are no more results,
or an sql:Error if an error occurs; ensure the wording references nextResult and
the return type record {}|sql:Error? so callers know nil signifies
end-of-iteration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ballerina/client.bal`:
- Line 146: Update the documentation comment for the Options type so that the
unit for cachedMetadataFieldSize is "mebibytes" (MiB) instead of "megabytes" to
match the actual unit used and remain consistent with
preparedStatementCacheSize; change the wording for cachedMetadataFieldSize in
the comment where it appears so it reads "mebibytes" and mentions MiB/2^20 bytes
as needed.

---

Nitpick comments:
In `@ballerina/procedure_params.bal`:
- Around line 617-624: The doc comment for public isolated function
nextResult(sql:ResultIterator iterator) must document the nil return case:
update the description and the "+ return" line to state that the function
returns the next record, nil when there are no more results, or an sql:Error if
an error occurs; ensure the wording references nextResult and the return type
record {}|sql:Error? so callers know nil signifies end-of-iteration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ae89cd9-e5f3-40bb-b430-43452fa99417

📥 Commits

Reviewing files that changed from the base of the PR and between 97a4445 and 0cfe5e1.

📒 Files selected for processing (4)
  • ballerina/cdc_listener.bal
  • ballerina/client.bal
  • ballerina/listener_types.bal
  • ballerina/procedure_params.bal

Comment thread ballerina/client.bal
# + cachedMetadataFieldSize - The maximum size (in megabytes) of fields to be cached per connection.
# A value of 0 disables the cache
# + cachedMetadataFieldsCount - The maximum number of fields to be cached per connection. A value of 0 disables the cache
# + cachedMetadataFieldSize - The maximum size in megabytes of fields to be cached per connection. A value of 0 disables the cache
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:

PostgreSQL JDBC cachedMetadataFieldSize preparedStatementCacheSize units documentation

💡 Result:

The PostgreSQL JDBC driver (pgJDBC) provides two relevant connection properties for caching: databaseMetadataCacheFieldsMiB (also referenced as cachedMetadataFieldSize in some contexts) and preparedStatementCacheSizeMiB (also referenced as preparedStatementCacheSize). databaseMetadataCacheFieldsMiB: Specifies the maximum size in megabytes (MiB, mebibytes = 1024*1024 bytes) of fields to be cached per connection. Default: 5. A value of 0 disables the cache. This limits memory usage for the field metadata cache. Related: databaseMetadataCacheFields: Maximum number of fields to cache per connection (integer count). Default: 65536. 0 disables. preparedStatementCacheSizeMiB: Specifies the maximum size in mebibytes (MiB) of the prepared queries cache per connection. Default: 5. Limits to prevent OutOfMemoryError when caching many queries. 0 disables. Related: preparedStatementCacheQueries: Maximum number of queries (entries) to cache per connection. Default: 256. 0 disables. These properties are set via JDBC URL parameters (e.g., ?preparedStatementCacheSizeMiB=10) or Properties object. Each connection has its own independent cache. Official documentation: https://jdbc.postgresql.org/documentation/use/ (Initializing the Driver section) and PGProperty enum docs confirm "megabytes" and "mebibytes" explicitly.

Citations:


Change "megabytes" to "mebibytes" on line 146 for consistency.

According to the PostgreSQL JDBC driver documentation, both cachedMetadataFieldSize and preparedStatementCacheSize use mebibytes (MiB, 2^20 bytes) as their actual unit. Line 146 currently reads "megabytes," which conflicts with the accurate terminology on line 151 ("mebibytes"). Update line 146 to "mebibytes" to match both the actual unit and the consistent terminology across the Options type documentation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ballerina/client.bal` at line 146, Update the documentation comment for the
Options type so that the unit for cachedMetadataFieldSize is "mebibytes" (MiB)
instead of "megabytes" to match the actual unit used and remain consistent with
preparedStatementCacheSize; change the wording for cachedMetadataFieldSize in
the comment where it appears so it reads "mebibytes" and mentions MiB/2^20 bytes
as needed.

@daneshk daneshk merged commit 45bbe4b into ballerina-platform:main Mar 18, 2026
6 checks passed
# + s - The CDC service to attach
# + name - Attachment points
# + return - An error if the service cannot be attached, or `()` if successful
# + return - An `cdc:Error` if the service cannot be attached, or `()` if successful
Copy link
Copy Markdown
Member

@ThisaruGuruge ThisaruGuruge Mar 18, 2026

Choose a reason for hiding this comment

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

Shouldn't this be A cdc:Error?

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.

6 participants