Skip to content

core: rename Resolvable.CATALOG_ROLES to Resolvable.CALLER_CATALOG_ROLES#3916

Merged
sungwy merged 2 commits intoapache:mainfrom
sungwy:resolvable-rename-main2
Mar 2, 2026
Merged

core: rename Resolvable.CATALOG_ROLES to Resolvable.CALLER_CATALOG_ROLES#3916
sungwy merged 2 commits intoapache:mainfrom
sungwy:resolvable-rename-main2

Conversation

@sungwy
Copy link
Contributor

@sungwy sungwy commented Mar 1, 2026

Resolvable enum was recently introduced to enable the caller to select specific entities for resolution rather than resolving everything. See PR: #3760

This PR renames CATALOG_ROLES to CALLER_CATALOG_ROLES instead to make it obvious whether we are resolving the principal's activated catalog roles vs the catalog roles that are requested as the target of the action (like creating a CATALOG_ROLE).

Also added a private helper to detect if CATALOG_ROLE is requested as a part of the top level entities and would require referenced catalog resolution.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Copilot AI review requested due to automatic review settings March 1, 2026 18:50
@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Mar 1, 2026
* catalog.
*
* <p>Note: this currently also covers requested {@code CATALOG_ROLE} names because they share the
* same {@link PolarisResolutionManifest} registration surface ({@code addTopLevelName}). Although
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative is to introduce a larger scope change to add REQUESTED_CATALOG_ROLES as a separate enum, and also to add a different registration surface to the PolarisResolutionManifest for requested catalog roles

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the latest javadoc does not mention this at all... Has the problem been resolved? 😅

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies resolver selection semantics by renaming the Resolvable option for resolving caller-activated catalog roles, and updates resolver planning so that requesting CATALOG_ROLE as a top-level entity triggers reference catalog resolution when needed.

Changes:

  • Renamed Resolvable.CATALOG_ROLES to Resolvable.CALLER_CATALOG_ROLES and updated related comments.
  • Updated Resolver.ResolvePlan planning to treat requested CATALOG_ROLE name resolution as reference-catalog-dependent.
  • Updated/added unit tests around selection-based resolution behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
polaris-core/src/main/java/org/apache/polaris/core/persistence/resolver/Resolvable.java Renames the resolvable constant and clarifies selection semantics in Javadoc.
polaris-core/src/main/java/org/apache/polaris/core/persistence/resolver/Resolver.java Extends selection planning to resolve the reference catalog when requested top-level entities include CATALOG_ROLE.
polaris-core/src/test/java/org/apache/polaris/core/persistence/ResolverTest.java Updates existing test for the rename and adds coverage for the new catalog-role/top-level selection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sungwy sungwy changed the title core: rename Resolvable.CALLER_CATALOG_ROLES and add special handling for requested CATALOG_ROLES core: rename Resolvable.CATALOG_ROLES to Resolvable.CALLER_CATALOG_ROLES Mar 1, 2026
@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Mar 2, 2026
CALLER_PRINCIPAL_ROLES,
/** Resolve catalog-role entities (e.g., roles attached in the reference catalog). */
CATALOG_ROLES,
/** Resolve caller-activated catalog-role entities in the reference catalog. */
Copy link
Contributor

Choose a reason for hiding this comment

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

nit "caller-activated" is understandable, but still a bit cryptic IMHO 😅 How about "Catalog Role entities referenced by the active PolarisPrincipal"?

The "activated" part is generally handled during request authentication, so by the time the request reaches AuthZ, the Principal already has a fixed set of role names in it, IIRC. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's exactly what I meant by that - caller-activated as in, the catalog-roles that were activated by the caller...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since this is a nit, and it would be nice to get this in before the release, I will proceed to merge the change in for now

Copy link
Contributor

Choose a reason for hiding this comment

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

This distinction between "activated" vs "granted" comes from the very initial stages of Polaris, afaik.

@sungwy sungwy merged commit 2ae08b8 into apache:main Mar 2, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Mar 2, 2026
@sungwy sungwy deleted the resolvable-rename-main2 branch March 2, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants