Skip to content

Conversation

@gh-yzou
Copy link
Contributor

@gh-yzou gh-yzou commented Jun 3, 2025

This is the last PR to deal with issue #1775.

This PR refactors loadTasks to take RealmContext as a parameter, and completely removes the usage of getConfiguration(@nonnull PolarisCallContext ctx, String configName).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dimas-b I added the change here to address your comment in the other PR #1780 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

thx!

Copy link
Contributor

@dimas-b dimas-b Jun 5, 2025

Choose a reason for hiding this comment

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

This looks functionally correct to me, but it contradicts the @Nonnull annotation on the realm context parameter now 🤷 Let's go back to testRealmContext to be aligned with annotations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sg! added back

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it wouldn't be safer to pass CallContext otherwise you could in theory pass a PolarisCallContext that does not correspond to the passed RealmContext.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I though about this also, then i was thinking about shall we be more consistent with the APIs in the interface, since all other APIs doesn't take CallContext, but PolarisCallContext in. @dimas-b @flyrain are you OK to just pass the whole CallContext in for this API?

Copy link
Contributor

Choose a reason for hiding this comment

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

PolarisCallContext and RealmContext together in the same method call do raise an alarm in my head ;)

This is what I call "API skew" - both parameters are associated with a realm, but there's no guarantee the realm ID is the same. Moreover, there's no clarity what implementations should use for getting the realm ID.

CallContext might be acceptable in the short term if the ripple effects of using it are not too large.

In general, I'd like Polaris code to get all "context" stuff injected via CDI, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear: I'm -1 on using PolarisCallContext and RealmContext together in the same method.

+0 on using CallContext instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also for context: I personally do not have a good understanding of how PolarisCallContext and CallContext were envisioned to be used initially. My comments are based on what exists in code ATM.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on using CallContext. TBH, I'd be fine to replace all of the PolarisCallContext params in this interface with CallContext.

Copy link
Contributor

@flyrain flyrain Jun 3, 2025

Choose a reason for hiding this comment

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

+1 on using CallContext. More broadly, I'd consider consolidating CallContext and PolarisCallContext into one class. Any concerns?

Copy link
Contributor

@dimas-b dimas-b Jun 3, 2025

Choose a reason for hiding this comment

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

I'm fine with consolidating CallContext and PolarisCallContext into one class... but I reserve the right to object when I see the specific change set for that :) Note that ATM the former is an interface, the latter a class 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After @flyrain 's change #1806, we do not need to change the interface anymore, will rebase after couple of follow up PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: my IDE is warning me about nullability issues, since the return types are marked @Nullable :-)

The following change removes the warnings:

    Boolean featureDefaultValue =
        configurationStore.getConfiguration(realmContext, trueByDefaultKey);
    assertThat(featureDefaultValue).isTrue();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, Thanks!

Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

Let's rebase after #1806 merges... I hope it might simplify this PR.

@gh-yzou
Copy link
Contributor Author

gh-yzou commented Jun 4, 2025

@dimas-b Thanks a lot for the heads up! I am aware of that change, and I am currently helping on some of the follow up work to position the whole polaris call context is a cleaner way, once finished will rebase the change.

@gh-yzou gh-yzou force-pushed the yzou-get-configuration-refactor2 branch from 851ccec to 7bdfaaf Compare June 5, 2025 00:35
@gh-yzou
Copy link
Contributor Author

gh-yzou commented Jun 5, 2025

@dimas-b @adutra i rebased the PR based on the recent change for merge PolarisCallContext and CallContext. This PR is now much simple, there is no need to change the interface anymore. Please take one more look of this PR.

adutra
adutra previously approved these changes Jun 5, 2025
@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jun 5, 2025
dimas-b
dimas-b previously approved these changes Jun 5, 2025
Copy link
Contributor

@dimas-b dimas-b Jun 5, 2025

Choose a reason for hiding this comment

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

This looks functionally correct to me, but it contradicts the @Nonnull annotation on the realm context parameter now 🤷 Let's go back to testRealmContext to be aligned with annotations.

@gh-yzou gh-yzou dismissed stale reviews from dimas-b and adutra via ef9ff35 June 5, 2025 16:55
@gh-yzou gh-yzou force-pushed the yzou-get-configuration-refactor2 branch from ef9ff35 to 1179e98 Compare June 5, 2025 17:21
@dimas-b
Copy link
Contributor

dimas-b commented Jun 5, 2025

@flyrain : over to you for review (just to be in sync)

@flyrain flyrain merged commit 3185adf into apache:main Jun 5, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jun 5, 2025
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.

5 participants