Skip to content

Fix extracting rule properties in updateRule#266

Merged
ayeshLK merged 4 commits intoballerina-platform:2201.8.xfrom
iamvirul:fix-updaterule-2201.8.x
Mar 27, 2026
Merged

Fix extracting rule properties in updateRule#266
ayeshLK merged 4 commits intoballerina-platform:2201.8.xfrom
iamvirul:fix-updaterule-2201.8.x

Conversation

@iamvirul
Copy link
Copy Markdown
Member

Purpose

Resolves : ballerina-platform/ballerina-library#8730
Fix the updateRule operation in the Admin client which was not actually updating rule properties (filter/action).

The getUpdatedRulePropertiesFromBObjectmethod in ASBUtils.javawas incorrectly looking for action and filter fields at the top level of the UpdateRuleOptions BMap. However, the Ballerina UpdateRuleOptions record nests these fields inside a SqlRule rule field. This meant the update was silently ignored and the existing rule properties were returned unchanged.

The fix aligns the update logic with the create logic getCreateRulePropertiesFromBObject, correctly reading from the nested rule (RECORD_FIELD_SQL_RULE) map.

Examples

// Before fix: this would silently do nothing
asb:SqlRule sqlRule = {filter: "1=1", action: "SET x = 5"};
asb:RuleProperties? rule = check adminClient->updateRule("topic", "subscription", "rule", rule = sqlRule);

// After fix: rule filter and action are correctly updated

Checklist

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a886f9d3-f2d7-4869-8bf2-c837e1811f16

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Fixes Admin client updateRule so that rule updates correctly apply filter/action by extracting them from the nested rule: SqlRule field in UpdateRuleOptions (aligning with create-rule behavior).

Changes:

  • Update getUpdatedRulePropertiesFromBObject to read action/filter from the nested rule map (RECORD_FIELD_SQL_RULE).
  • Add a changelog entry documenting the fix.

Reviewed changes

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

File Description
native/src/main/java/io/ballerina/lib/asb/util/ASBUtils.java Fixes update-rule property extraction to use nested rule record fields.
changelog.md Notes the updateRule fix in the Unreleased “Fixed” section.

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@iamvirul iamvirul force-pushed the fix-updaterule-2201.8.x branch from c4cac3c to 66baf6c Compare March 23, 2026 16:23
Copy link
Copy Markdown
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Ayesh Almeida <77491511+ayeshLK@users.noreply.github.com>
@ayeshLK ayeshLK merged commit d3f4414 into ballerina-platform:2201.8.x Mar 27, 2026
3 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