Repository navigation
Core: Drop redundant getOperation() overrides in AuthorizationIntent records - #5507
Conversation
f620133 to
95db7f7
Compare
95db7f7 to
3c21ce8
Compare
iprithv
left a comment
There was a problem hiding this comment.
This is a complete, behavior-preserving rename (getOperation() → operation()), and the in-tree call sites look covered.
I don't think we need this. The seven record overrides are correct as they are, and this does not fix a bug or change authorization behavior. I'd rather keep the current method name unless there's a stronger reason to churn the PolarAuthorizer input API.
Happy to defer to other reviewers if they want the consistency cleanup.
|
Thanks for reviewing and providing your insights @iprithv! And fair point - this is purely a cleanup, with no bug fix or behavior change. The rationale is consistency plus removing boilerplate: the sibling types in this package already expose their components with canonical record accessors ( On the API-churn concern: That said, I agree it's a judgment call and not essential. Happy to defer to the authz-area reviewers - @flyrain @sungwy, do you see the consistency/boilerplate cleanup as bringing value to land? I think it's a small but real improvement. I'm equally fine adjusting this if the community consensus is that it's not worth the churn as well. |
There was a problem hiding this comment.
+1 to this cleanup 👍
AuthorizationIntent is a new class. It is preferable to do cleanup there sooner rather than later.
This kind of change is in-line with the Polaris Evolution policy. Adjustments in downstream caller code are going to be trivial.
My personal view is that the old getOperation name might be an omission WRT to impl-level operation names rather than a deliberate "intent".
@sungwy : WDYT?
|
FYI: @gracechen09 |
|
Thanks @dimas-b for the review and approval! |
|
+1, I think refactors like this are also valuable. |
|
Thanks @nandorKollar! Appreciate the recognition here. |
|
Thanks for the fix, @ZephyrYWZhou ! I like the cleanup. I understand Evolution policy doesn't enforce binary compatible, but adding a default method now and remove it later doesn't hurt, and it won't break any downstream. WDYT? |
…records Every AuthorizationIntent is a record with an operation component, so its generated accessor is operation() and each record had to add a getOperation() override that just forwarded to it. Renaming the interface method to operation() lets the generated accessor implement it directly, and lines up with the sibling records (AuthorizationRequest, ResolvedIntent) that already use canonical accessors. Pure rename, no behavior change. Fixes apache#5506
4c6965c
3c21ce8 to
4c6965c
Compare
|
Thanks @flyrain! Makes sense - a deprecated default keeps downstream callers of getOperation() working while steering to operation(). Just added that. Feel free to take a look and help merge if everything looks good. |
flyrain
left a comment
There was a problem hiding this comment.
+1 Thanks @ZephyrYWZhou !
|
@iprithv , would you mind taking another look? |
|
I was mainly worried about churning the PolarAuthorizer input API for a consistency cleanup. The deprecated LGTM 🚢 |
That is possible. However, from my POV downstream If we keep |
Per review feedback, add forRemoval = true to the @deprecated getOperation() default so it is clearly slated for removal in a future release.
f3dce87
|
Sounds good @dimas-b, just added |
|
Thanks all for the thoughtful input here! Glad to see we landed on this clean approach eventually🎉! @nandorKollar @dimas-b @iprithv @flyrain. |
Summary
AuthorizationIntent.getOperation()is a bean-style getter, but every implementer is a record with anoperationcomponent whose generated accessor isoperation(). Because the names don't match, each of the seven records has to add agetOperation()override that just returnsoperation.Renaming the interface method to
operation()lets the generated accessor satisfy the interface, so those overrides go away. It also lines up with the sibling records that already use canonical accessors (AuthorizationRequest.principal()/intents(),ResolvedIntent.targets()/secondaries()).Changes
AuthorizationIntent.getOperation()tooperation().getOperation()override from the seven intent records.PolarisAuthorizerImpl,RangerPolarisAuthorizer,OpaPolarisAuthorizer, andIcebergCatalogHandlerTest.Testing
./gradlew :polaris-core:check, plus the Ranger unit tests andintTest, the OPA tests, and the runtime-service catalog handler authz tests. Pure rename, no behavior change.Checklist