Skip to content

[Rule-based Auto-tagging] bug fix on Update Rule API with multiple attributes#19497

Merged
jainankitk merged 1 commit intoopensearch-project:mainfrom
ruai0511:updaterule1
Oct 2, 2025
Merged

[Rule-based Auto-tagging] bug fix on Update Rule API with multiple attributes#19497
jainankitk merged 1 commit intoopensearch-project:mainfrom
ruai0511:updaterule1

Conversation

@ruai0511
Copy link
Copy Markdown
Contributor

@ruai0511 ruai0511 commented Oct 1, 2025

Description

This PR implements a bug fix for the Update Rule API used in rule-based auto-tagging.

Previously, if a rule had two attributes and an update request was sent with only one attribute, both existing attributes would be replaced. With this fix, only the specified attribute will be updated, while the others remain unchanged.

For example,
the previous rule is

{
  "description": "test1",
  "principal": {"username": ["alice"]},"index_pattern": ["my-index"],
  "workload_group": "x5_wjV3lRjWRO5tG1fydgw"
}'

and we only update the field index_pattern, the result will still have the original principal entry

{
  "description": "test1",
  "index_pattern": ["my-indexxx"],
  "workload_group": "x5_wjV3lRjWRO5tG1fydgw"
}'

{"id":"83e89252-7d30-30ab-8e07-082817115c08","description":"test1","index_pattern":["my-indexxx"],"principal":{"username":["alice"]},"workload_group":"x5_wjV3lRjWRO5tG1fydgw","updated_at":"2025-10-01T21:38:45.397891Z"}%     

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@ruai0511 ruai0511 requested a review from a team as a code owner October 1, 2025 21:55
@ruai0511 ruai0511 added the v3.3.0 label Oct 1, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

❌ Gradle check result for f6eabf7: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@jainankitk
Copy link
Copy Markdown
Contributor

Test failures look related:

[Test Result](https://build.ci.opensearch.org/job/gradle-check/64888/testReport/) (2 failures / +2)

    [org.opensearch.rule.RuleUtilsTests.testComposeUpdateAllFields](https://build.ci.opensearch.org/job/gradle-check/64888/testReport/junit/org.opensearch.rule/RuleUtilsTests/testComposeUpdateAllFields/)
    [org.opensearch.rule.service.IndexStoredRulePersistenceServiceTests.testConcurrentUpdateDuplicateRules](https://build.ci.opensearch.org/job/gradle-check/64888/testReport/junit/org.opensearch.rule.service/IndexStoredRulePersistenceServiceTests/testConcurrentUpdateDuplicateRules/)

@ruai0511 - Can you check once?

Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

✅ Gradle check result for f7f55a2: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.95%. Comparing base (1633e1a) to head (f7f55a2).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...n/src/main/java/org/opensearch/rule/RuleUtils.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19497      +/-   ##
============================================
- Coverage     73.07%   72.95%   -0.12%     
+ Complexity    70414    70392      -22     
============================================
  Files          5708     5711       +3     
  Lines        322502   322587      +85     
  Branches      46705    46716      +11     
============================================
- Hits         235653   235334     -319     
- Misses        67865    68274     +409     
+ Partials      18984    18979       -5     

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

@jainankitk jainankitk merged commit 4269bdd into opensearch-project:main Oct 2, 2025
33 checks passed
peteralfonsi pushed a commit to peteralfonsi/OpenSearch that referenced this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants