Skip to content

fix(build): Remove duplicate BasicPrincipal from presto-main-base#27187

Merged
feilong-liu merged 1 commit intoprestodb:masterfrom
vandreykiv:export-D94005053
Feb 23, 2026
Merged

fix(build): Remove duplicate BasicPrincipal from presto-main-base#27187
feilong-liu merged 1 commit intoprestodb:masterfrom
vandreykiv:export-D94005053

Conversation

@vandreykiv
Copy link
Copy Markdown
Contributor

@vandreykiv vandreykiv commented Feb 22, 2026

Description

PR #27165 extracted internal communication authentication into the new presto-internal-communication module. It properly moved InternalCommunicationConfig, RoleType, InternalAuthenticationManager, and
InternalAuthenticationFilter from their old locations but missed removing BasicPrincipal.java from presto-main-base.

This causes com.facebook.presto.security.BasicPrincipal to exist in both presto-main-base and presto-internal-communication, creating duplicate classes on the classpath of any module that transitively depends on
both (e.g., via presto-main).

Motivation and Context

The duplicate-finder-maven-plugin (which is enabled in downstream builds) fails with:
Found duplicate (but equal) classes in [presto-internal-communication:0.297-SNAPSHOT, presto-main-base:0.297-SNAPSHOT]:
com.facebook.presto.security.BasicPrincipal

The OSS build doesn't catch this because the duplicate-finder plugin is skipped for all modules.

Impact

No production or user-facing impact. BasicPrincipal is still available on the classpath from presto-internal-communication. The only usage in presto-main-base is SessionRepresentation.java, which resolves it from
the new dependency.

Test Plan

  • presto-main-base compiles successfully (resolves BasicPrincipal from presto-internal-communication)
  • presto-main compiles successfully
  • presto-spark-base dependency-scope check passes (no scope conflicts)
  • duplicate-finder-maven-plugin passes for downstream modules that depend on both presto-main-base and presto-internal-communication

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

…and presto-internal-communication

Summary:
OSS PR prestodb#27165 extracted internal communication authentication into a new presto-internal-communication module. It properly moved InternalCommunicationConfig, RoleType, InternalAuthenticationManager, and InternalAuthenticationFilter from their old locations, but missed removing BasicPrincipal.java from presto-main-base. This causes duplicate-finder-maven-plugin failures in CI for presto-configerator, presto-metalake-merger, presto-crypto-functions, and presto-facebook-thrift-testing-server, since both presto-main-base and presto-internal-communication contain com.facebook.presto.security.BasicPrincipal.

Fix: Remove BasicPrincipal from presto-main-base and add presto-internal-communication as a dependency (with exclusions for http-server, http-client, jaxrs, jjwt-api, and drift-transport-netty to avoid transitive dependency bloat that would break presto-spark-base's dependency scope check).

Reviewed By: abhinavmuk04

Differential Revision: D94005053
@vandreykiv vandreykiv requested a review from a team as a code owner February 22, 2026 07:31
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Feb 22, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: vandreykiv / name: Vyacheslav Andreykiv (ad0988f)

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 22, 2026

Reviewer's Guide

Removes the duplicate BasicPrincipal definition from presto-main-base and instead depends on the shared presto-internal-communication module, while carefully excluding heavy transitive dependencies to keep the dependency graph lean and compatible with existing scope checks.

Class diagram for BasicPrincipal relocation to presto-internal-communication

classDiagram
    class presto_main_base {
    }

    class presto_internal_communication {
    }

    class BasicPrincipal {
        +String name
        +BasicPrincipal(String name)
        +String getName()
    }

    presto_internal_communication <|-- BasicPrincipal
    presto_main_base ..> BasicPrincipal
Loading

File-Level Changes

Change Details Files
Replace local BasicPrincipal implementation with dependency on presto-internal-communication module.
  • Add presto-internal-communication as a Maven dependency in presto-main-base
  • Exclude http-server, http-client, jaxrs, jjwt-api, and drift-transport-netty from the new dependency to avoid unnecessary transitive dependencies and scope issues
  • Delete the duplicate com.facebook.presto.security.BasicPrincipal class from presto-main-base
presto-main-base/pom.xml
presto-main-base/src/main/java/com/facebook/presto/security/BasicPrincipal.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vandreykiv vandreykiv changed the title [presto] Fix duplicate BasicPrincipal class between presto-main-base and presto-internal-communication [fix] Fix duplicate BasicPrincipal class between presto-main-base and presto-internal-communication Feb 22, 2026
@vandreykiv vandreykiv changed the title [fix] Fix duplicate BasicPrincipal class between presto-main-base and presto-internal-communication Fix duplicate BasicPrincipal class between presto-main-base and presto-internal-communication Feb 22, 2026
@vandreykiv vandreykiv changed the title Fix duplicate BasicPrincipal class between presto-main-base and presto-internal-communication fix: duplicate BasicPrincipal class between presto-main-base and presto-internal-communication Feb 22, 2026
@vandreykiv vandreykiv changed the title fix: duplicate BasicPrincipal class between presto-main-base and presto-internal-communication fix: Duplicate BasicPrincipal class between presto-main-base and presto-internal-communication Feb 22, 2026
@vandreykiv vandreykiv changed the title fix: Duplicate BasicPrincipal class between presto-main-base and presto-internal-communication fix(build): Remove duplicate BasicPrincipal from presto-main-base Feb 23, 2026
@feilong-liu
Copy link
Copy Markdown
Contributor

Thanks for the fix.

The OSS build doesn't catch this because the duplicate-finder plugin is skipped for all modules.

Wondering if it should be enabled (can be in a separate PR though).

@feilong-liu feilong-liu merged commit f98b61d into prestodb:master Feb 23, 2026
88 of 135 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants