Skip to content

Conversation

@prdoyle
Copy link
Contributor

@prdoyle prdoyle commented May 20, 2025

Background

To avoid emitting an unnecessary error for the entitlement self-test, we specifically avoided logging when the caller class was EntitlementSelfTester.

Since #127877, we no longer ignore frames for method references, and so the caller class for an entitlement check is the class of the method reference itself, rather than the class in which that method reference was written.

As a consequence, the caller class for the self test is no longer EntitlementSelfTester, but rather the class of the method reference.

Fix

Suppress based on Package instead of Class. This suppresses entitlement warnings for the org.elasticsearch.bootstrap package.

Alternatives

We could suppress this warning as we do for other warnings, by configuring log levels. That might be what we want to do for the long term. For the time being, this is a simple PR that allows us to remove our logging workarounds.

We could attempt to determine the enclosing class from the method reference object, but I haven't yet found any way to do so. getDeclaringClass and getEnclosingClass both return null.

@prdoyle prdoyle self-assigned this May 20, 2025
@prdoyle prdoyle requested a review from a team as a code owner May 20, 2025 21:07
@prdoyle prdoyle added auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 :Core/Infra/Entitlements Entitlements infrastructure v8.18.2 v9.0.2 labels May 20, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label May 20, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

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

LGTM
I agree, in the long run we should have a single mechanism for log suppression, but for now this fixes the immediate issue (it's not worse than what we have today and it works).

@prdoyle prdoyle merged commit 8d79de5 into elastic:main May 21, 2025
17 checks passed
@prdoyle prdoyle deleted the better-suppression branch May 21, 2025 12:59
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19
8.18 Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 128223

elasticsearchmachine pushed a commit that referenced this pull request May 21, 2025
…128248)

* Use package to suppress warning for entitlement self-test

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>
@prdoyle
Copy link
Contributor Author

prdoyle commented May 21, 2025

Not backporting to 8.18 and 9.0.

(We're backporting it after all, in #128304.)

prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request May 22, 2025
…8223)

* Use package to suppress warning for entitlement self-test

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request May 22, 2025
…128304)

* Use package to suppress warning for entitlement self-test

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request May 22, 2025
…128304) (#128313)

* Use package to suppress warning for entitlement self-test

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Entitlements Entitlements infrastructure >non-issue Team:Core/Infra Meta label for core/infra team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants