Skip to content

Comments

Liveness check with updated dependencies#1429

Merged
gayaldassanayake merged 16 commits intoballerina-platform:masterfrom
gayaldassanayake:cdc-isalive-dep-fix
Feb 18, 2026
Merged

Liveness check with updated dependencies#1429
gayaldassanayake merged 16 commits intoballerina-platform:masterfrom
gayaldassanayake:cdc-isalive-dep-fix

Conversation

@gayaldassanayake
Copy link
Contributor

@gayaldassanayake gayaldassanayake commented Feb 16, 2026

Purpose

Fixes:

Examples

Checklist

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

Summary

This pull request updates the MySQL module to improve CDC listener liveness handling and synchronizes several dependency and build artifact versions.

Key changes

  • Module and artifacts

    • Bumps module version to 1.16.2 and updates native/compiler plugin artifact references to 1.16.2 snapshot builds.
    • Minor fix applied related to listener port handling.
  • Dependencies and build

    • Upgrades multiple stdlib and library versions (notably sql, time, http, crypto, jwt, observe, url, mime, oauth2) and adds new packages (avro 1.2.0, Confluent Avro SerDes 1.0.2, Confluent Schema Registry 0.4.3, Kafka 4.6.3).
    • Updates Dependencies.toml, build.gradle, and gradle.properties to declare new/updated packages and version properties.
  • Functional changes

    • CdcListener configuration field widened from map & readonly to map & readonly to allow broader configuration values.
    • Listener initialization updated to assemble Debezium-style configuration entries and includes a new livenessInterval setting to control liveness checks.
  • Tests

    • Adds a test module with four liveness-focused tests covering pre-start, running, post-stop, and inactivity scenarios for the CDC listener.

Impact

  • Intent: improve liveness behavior and align the module with updated platform and dependency versions.
  • Public API: no removals detected; primary changes are configuration type widening, dependency updates, build artifact updates, and added tests.

@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Walkthrough

Bumps package and native/plugin artifact versions to 1.16.2, updates several stdlib and Ballerinax dependency versions (adds Avro/Kafka/Confluent), changes CdcListener config type to map<anydata> & readonly, and adds liveness tests for the CDC listener.

Changes

Cohort / File(s) Summary
Package & Compiler Configuration
ballerina/Ballerina.toml, ballerina/CompilerPlugin.toml
Bumped package version to 1.16.2; updated mysql-native and sql-native dependency versions and local artifact paths; switched compiler plugin artifact path to mysql-compiler-plugin-1.16.2-SNAPSHOT.jar.
Dependency Manifests & Build
ballerina/Dependencies.toml, build.gradle, gradle.properties
Added Avro/Kafka/Confluent packages and versions; upgraded multiple stdlib versions (sql, crypto, http, time, jwt, observe, etc.); added Gradle dependency entries and new version properties; adjusted scopes and package dependency lists.
CDC Listener Implementation
ballerina/cdc_listener.bal
Changed CdcListener config field from map<string> & readonly to map<anydata> & readonly; refactored init to populate debeziumConfigs, merge into final listener config, and include livenessInterval.
Tests
ballerina/tests/listener_liveness_test.bal
Added four liveness tests covering pre-start, running, post-stop, and inactivity scenarios for the CDC listener.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble on versions, hop through the trees,
Configs now hold anydata with ease.
Liveness checks beat a steady drum,
New deps arrive — I wiggle my thumb.
Hooray for builds and tests — one carrot for me! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description uses the template but leaves all sections incomplete—Purpose shows only 'Fixes:', Examples is empty, and all Checklist items are unchecked. Fill in the Purpose section with specific details about what is being fixed, provide relevant examples if applicable, and check/address the relevant checklist items before merging.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: adding liveness check functionality and updating multiple package dependencies across the project.
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
  • Post copyable unit tests in a comment

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

@gayaldassanayake gayaldassanayake marked this pull request as draft February 16, 2026 05:24
Copy link

@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

🤖 Fix all issues with AI agents
In `@ballerina/Ballerina.toml`:
- Around line 18-19: The version and JAR path are inconsistent: the version key
"version" is set to "1.16.2" while the path references
"mysql-native-1.16.2-SNAPSHOT.jar"; update either the version field to
"1.16.2-SNAPSHOT" or change the path to point to "mysql-native-1.16.2.jar" so
the "version" value and the JAR filename in the "path" string match; ensure you
update the "version" key and/or the path literal accordingly to reflect whether
this is a snapshot or a release.
🧹 Nitpick comments (1)
ballerina/tests/listener_liveness_test.bal (1)

24-38: Missing cleanup for attached service.

The test attaches testService to mysqlListener but never detaches or stops the listener. While the listener isn't started, consider adding cleanup for consistency and to avoid potential resource leaks in the test environment.

♻️ Suggested cleanup
 function testLivenessBeforeListenerStart() returns error? {
     CdcListener mysqlListener = new ({
         database: {
             username: cdcUsername,
             password: cdcPassword,
             port
         },
         options: {
             snapshotMode: cdc:NO_DATA
         }
     });
     check mysqlListener.attach(testService);
     boolean liveness = check cdc:isLive(mysqlListener);
     test:assertFalse(liveness, "Liveness check passes even before listener starts");
+    check mysqlListener.detach(testService);
 }

Comment on lines +18 to +19
version = "1.16.2"
path = "../native/build/libs/mysql-native-1.16.2-SNAPSHOT.jar"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Version mismatch between declared version and JAR path.

The version field is "1.16.2" but the path references mysql-native-1.16.2-SNAPSHOT.jar. This inconsistency could cause confusion during dependency resolution or release processes.

Consider aligning these values:

  • If this is a snapshot/development build, update version to "1.16.2-SNAPSHOT"
  • If this is a release, ensure the path references the non-SNAPSHOT JAR
🤖 Prompt for AI Agents
In `@ballerina/Ballerina.toml` around lines 18 - 19, The version and JAR path are
inconsistent: the version key "version" is set to "1.16.2" while the path
references "mysql-native-1.16.2-SNAPSHOT.jar"; update either the version field
to "1.16.2-SNAPSHOT" or change the path to point to "mysql-native-1.16.2.jar" so
the "version" value and the JAR filename in the "path" string match; ensure you
update the "version" key and/or the path literal accordingly to reflect whether
this is a snapshot or a release.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.51%. Comparing base (5cbfcbc) to head (3c29dd8).
⚠️ Report is 18 commits behind head on master.

❌ Your project status has failed because the head coverage (74.51%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1429      +/-   ##
============================================
+ Coverage     74.43%   74.51%   +0.07%     
  Complexity      125      125              
============================================
  Files            27       27              
  Lines           669      671       +2     
  Branches        128      128              
============================================
+ Hits            498      500       +2     
  Misses          122      122              
  Partials         49       49              

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

@gayaldassanayake gayaldassanayake marked this pull request as ready for review February 18, 2026 12:13
Copy link

@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

🤖 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/tests/listener_liveness_test.bal`:
- Around line 25-33: The database port field in the CdcListener initializer is
using an undefined shorthand `port`; update the `CdcListener mysqlListener = new
({ ... })` database config to use the explicit field `port: cdcPort` (replace
the `port` shorthand) so the `database` map compiles and matches other tests'
usage of `cdcPort`.

---

Duplicate comments:
In `@ballerina/Ballerina.toml`:
- Around line 18-19: The TOML file has a mismatch between the version key and
the referenced JAR: the version = "1.16.2" field must match the JAR name in the
path value; either update the version key to "1.16.2-SNAPSHOT" to match
mysql-native-1.16.2-SNAPSHOT.jar or change the path to point to a non‑SNAPSHOT
JAR (e.g., mysql-native-1.16.2.jar). Edit the version and/or path entries (the
version field and the path value) so they are consistent.

daneshk
daneshk previously approved these changes Feb 18, 2026
Copy link

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

🧹 Nitpick comments (2)
ballerina/tests/listener_liveness_test.bal (2)

24-34: Reduce repeated listener setup.

The same database + options configuration is duplicated across all four tests. Consider extracting a small helper to construct the listener config so future changes stay consistent across the suite.

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

In `@ballerina/tests/listener_liveness_test.bal` around lines 24 - 34, Multiple
tests duplicate the same CdcListener configuration (the database and options
blocks used when constructing CdcListener in testLivenessBeforeListenerStart and
the other three tests); factor this into a small helper such as a function
(e.g., newTestListenerConfig or createCdcListener) that returns the
configuration record or directly constructs and returns a CdcListener instance
so all tests call that helper instead of repeating the database: { username:
cdcUsername, password: cdcPassword, port: cdcPort } and options: { snapshotMode:
cdc:NO_DATA } blocks; update testLivenessBeforeListenerStart and the other tests
to use the helper (referencing CdcListener and cdc:NO_DATA) to keep
configuration centralized and consistent.

98-101: Consider polling instead of a fixed 10‑second wait.

The hard-coded wait makes the test slower and can still be flaky. A short-interval poll with a timeout usually gives the same coverage with less runtime.

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

In `@ballerina/tests/listener_liveness_test.bal` around lines 98 - 101, Replace
the fixed runtime:sleep(10) with a short-interval polling loop that repeatedly
calls cdc:isLive(mysqlListener) until either it returns false or a small timeout
elapses; use a small poll interval (e.g., 100–200ms) to reduce test runtime and
flakiness, and then assertFalse on the final liveness result (keep using
mysqlListener, cdc:isLive, and test:assertFalse) so the test fails if liveness
remains true after the timeout.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ballerina/tests/listener_liveness_test.bal`:
- Around line 24-34: Multiple tests duplicate the same CdcListener configuration
(the database and options blocks used when constructing CdcListener in
testLivenessBeforeListenerStart and the other three tests); factor this into a
small helper such as a function (e.g., newTestListenerConfig or
createCdcListener) that returns the configuration record or directly constructs
and returns a CdcListener instance so all tests call that helper instead of
repeating the database: { username: cdcUsername, password: cdcPassword, port:
cdcPort } and options: { snapshotMode: cdc:NO_DATA } blocks; update
testLivenessBeforeListenerStart and the other tests to use the helper
(referencing CdcListener and cdc:NO_DATA) to keep configuration centralized and
consistent.
- Around line 98-101: Replace the fixed runtime:sleep(10) with a short-interval
polling loop that repeatedly calls cdc:isLive(mysqlListener) until either it
returns false or a small timeout elapses; use a small poll interval (e.g.,
100–200ms) to reduce test runtime and flakiness, and then assertFalse on the
final liveness result (keep using mysqlListener, cdc:isLive, and
test:assertFalse) so the test fails if liveness remains true after the timeout.

@gayaldassanayake gayaldassanayake merged commit 7e4c506 into ballerina-platform:master Feb 18, 2026
5 of 6 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.

4 participants