Skip to content

Conversation

@zooo-code
Copy link

@zooo-code zooo-code commented Jan 17, 2026

Fixes #25128

Motivation

The logic for setting policies.bundles is different between getNamespacePolicies (sync) and getNamespacePoliciesAsync:

  • getNamespacePolicies (sync):

    • bundles source: NamespaceBundleFactory.getBundles().getBundlesData()
    • fallback: bundleData != null ? bundleData : policies.bundles
    • migrated fallback: false when LocalPolicies is absent
  • getNamespacePoliciesAsync:

    • bundles source: LocalPolicies.bundles
    • fallback: none (only sets if localPolicies.isPresent())
    • migrated fallback: none

This inconsistency can cause different results when calling sync vs async methods for the same namespace.

Modifications

Aligned getNamespacePoliciesAsync with the sync method by:

  • Using NamespaceBundleFactory.getBundlesAsync() instead of LocalPolicies.bundles
  • Applying the same fallback logic: bundleData != null ? bundleData : policies.bundles
  • Ensuring migrated field defaults to false when LocalPolicies is absent

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as integration tests that exercise namespace policies retrieval through both sync and async code paths.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: https://github.com/zooo-code/pulsar

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Logic for setting policies.bundle is different in AdminResource#getNamespacePolicies compared to AdminResource#getNamespacePoliciesAsync

1 participant