Skip to content

Conversation

@mamazzol
Copy link
Contributor

Wrapping user-facing usages of Boolean.parseBoolean in a util method to send a deprecation log.

#128993

@mamazzol mamazzol requested a review from a team as a code owner November 11, 2025 11:23
@mamazzol mamazzol added :Core/Infra/Logging Log management and logging utilities >deprecation labels Nov 11, 2025
@elasticsearchmachine elasticsearchmachine added v9.3.0 Team:Core/Infra Meta label for core/infra team labels Nov 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @mamazzol, I've created a changelog YAML for you. Note that since this PR is labelled >deprecation, you need to update the changelog YAML to fill out the extended information sections.

@elasticsearchmachine
Copy link
Collaborator

Hi @mamazzol, I've updated the changelog YAML for you.

Copy link
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

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

Thanks @mamazzol, a couple of points below.
That's a lot less places than I feared to see 😅 And I think some of these could actually be lenient for good.

@elasticsearchmachine
Copy link
Collaborator

Hi @mamazzol, I've updated the changelog YAML for you. Note that since this PR is labelled >deprecation, you need to update the changelog YAML to fill out the extended information sections.

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

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

I left a couple comments on the scripting portion.

@SuppressForbidden(
reason = "TODO Deprecate any lenient usage of Boolean#parseBoolean https://github.com/elastic/elasticsearch/issues/128993"
)
private static boolean allowUnknownLuceneFileExtensions() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@mamazzol I noticed this is only used in an assertion (and disabled in production), so we can make this one strict as well

public static boolean parseAndCheckForDeprecatedUsage(String value, Category category, String name) {
if (Booleans.isBoolean(value) == false) {
String key = String.format(Locale.ROOT, "lenient.%s.%s", category, name);
deprecationLogger.warn(DeprecationCategory.PARSING, key, DEPRECATED_MESSAGE_TEMPLATE, value, category.displayValue(), name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Two more points, level has to be critical (our default for deprecations) and we should also put the deprecation category on the signature. For SettingsInvocationHandler the category should be SETTINGS.

Copy link
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

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

Thanks @mamazzol , lgtm.
As soon as the breaking change is approved, we can merge.

* Category of use of lenient Boolean parsing.
*/
public enum Category {
public enum UsageCategory {
Copy link
Contributor

Choose a reason for hiding this comment

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

just throwing it out as an option, looking at the latest change DeprecationCategory could also be a field of UsageCategory

@mamazzol mamazzol merged commit aedf9e3 into elastic:main Dec 1, 2025
34 checks passed
@mamazzol mamazzol deleted the lax-boolean branch December 1, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Logging Log management and logging utilities >deprecation Team:Core/Infra Meta label for core/infra team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants