OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

[2.x] Deprecate 'Whitelist' classes in package 'org.opensearch.painless.spi' and create alternative 'Allowlist' classes

Open tlfeng opened this issue 3 years ago • 6 comments

Description

To support inclusive language, the whitelist terminology is going to be replaced by allowlist in the code base.

Issues Resolved

A part of issue https://github.com/opensearch-project/OpenSearch/issues/1683

Check List

  • [ ] New functionality includes testing.
    • [ ] All tests pass
  • [ ] New functionality has been documented.
    • [ ] New functionality has javadoc added
  • [ ] Commits are signed per the DCO using --signoff

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.

tlfeng avatar Aug 02 '22 23:08 tlfeng

Gradle Check (Jenkins) Run Completed with:

  • RESULT: FAILURE :x:
  • URL: https://build.ci.opensearch.org/job/gradle-check/1319/
  • CommitID: ef128b70b5096b61b5043f9b0f0450c8b5d423db

github-actions[bot] avatar Aug 02 '22 23:08 github-actions[bot]

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE :x:
  • URL: https://build.ci.opensearch.org/job/gradle-check/1320/
  • CommitID: a9c6e650a28b8dd7f0ce152e72c8b337ffaebdeb

github-actions[bot] avatar Aug 03 '22 00:08 github-actions[bot]

Gradle Check (Jenkins) Run Completed with:

  • RESULT: FAILURE :x:
  • URL: https://build.ci.opensearch.org/job/gradle-check/1324/
  • CommitID: 355b748e0fadc2899853365ff739d80c256f9981

github-actions[bot] avatar Aug 03 '22 03:08 github-actions[bot]

Gradle Check (Jenkins) Run Completed with:

  • RESULT: SUCCESS :white_check_mark:
  • URL: https://build.ci.opensearch.org/job/gradle-check/1323/
  • CommitID: 6f77583cf0f8d4c233253b78cfbc3e908f46cfba

github-actions[bot] avatar Aug 03 '22 04:08 github-actions[bot]

Codecov Report

Merging #4101 (6f77583) into 2.x (3bf01e9) will increase coverage by 0.16%. The diff coverage is 74.12%.

:exclamation: Current head 6f77583 differs from pull request most recent head 50ade46. Consider uploading reports for the commit 50ade46 to get more accurate results

@@             Coverage Diff              @@
##                2.x    #4101      +/-   ##
============================================
+ Coverage     70.45%   70.62%   +0.16%     
- Complexity    56513    56749     +236     
============================================
  Files          4540     4554      +14     
  Lines        272326   272705     +379     
  Branches      40017    40048      +31     
============================================
+ Hits         191860   192587     +727     
+ Misses        64360    64047     -313     
+ Partials      16106    16071      -35     
Impacted Files Coverage Δ
...a/org/opensearch/gradle/test/DistroTestPlugin.java 0.00% <ø> (ø)
...nsearch/painless/spi/AllowlistInstanceBinding.java 0.00% <0.00%> (ø)
...va/org/opensearch/painless/spi/WhitelistClass.java 100.00% <ø> (ø)
...opensearch/painless/spi/WhitelistClassBinding.java 57.14% <ø> (ø)
...va/org/opensearch/painless/spi/WhitelistField.java 50.00% <ø> (ø)
...nsearch/painless/spi/WhitelistInstanceBinding.java 57.14% <ø> (ø)
...a/org/opensearch/painless/spi/WhitelistMethod.java 100.00% <ø> (ø)
...rg/opensearch/common/settings/ClusterSettings.java 91.89% <ø> (ø)
...index/fielddata/ordinals/GlobalOrdinalMapping.java 77.27% <ø> (ø)
...search/index/fielddata/ordinals/MultiOrdinals.java 60.60% <0.00%> (ø)
... and 528 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 03 '22 04:08 codecov-commenter

Gradle Check (Jenkins) Run Completed with:

  • RESULT: SUCCESS :white_check_mark:
  • URL: https://build.ci.opensearch.org/job/gradle-check/1325/
  • CommitID: 50ade462d2aba610bc8e8eb6d4f86b02344d75f1

github-actions[bot] avatar Aug 03 '22 04:08 github-actions[bot]

After the incomplete attempt to provide alternative allowlist APIs as well as keeping the existing whitelist APIs in this PR, I decided not to deprecate the whitelist APIs before replacing them with allowlist APIs in a future major version. We will post a plan for the version of removing whitelist APIs. Developers can keep using the existing whitelist APIs till the further notice.

The impact of the plugin developers is likely be minor, if making as breaking change instead of deprecated in advance. There are 2 plugins (alerting and k-NN) in opensearch-project organization using the whitelist Java APIs, and the affected APIs of them are:

 public Map<ScriptContext<?>, List<Whitelist>> getContextWhitelists()
 -> public Map<ScriptContext<?>, List<Allowlist>> getContextAllowlists()
 
org.opensearch.painless.spi.Whitelist -> Allowlist
org.opensearch.painless.spi.WhitelistLoader -> AllowlistLoader

tlfeng avatar Aug 11 '22 00:08 tlfeng