karmada icon indicating copy to clipboard operation
karmada copied to clipboard

add verify for customized dependencies response

Open XiShanYongYe-Chang opened this issue 1 year ago • 8 comments

What type of PR is this?

/kind feature

What this PR does / why we need it:

After the user customizes interpretation behavior, the Dependencies returned by the InterpretDependency interpreter are verified to prevent incorrect return values ​​from penetrating into subsequent use logic.

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

XiShanYongYe-Chang avatar May 23 '24 13:05 XiShanYongYe-Chang

/cc @chaunceyjiang @whitewindmills

XiShanYongYe-Chang avatar May 23 '24 13:05 XiShanYongYe-Chang

/assign

whitewindmills avatar May 24 '24 01:05 whitewindmills

/assign

chaunceyjiang avatar May 24 '24 02:05 chaunceyjiang

It's just a question, how did you discover that optimization could be done here?

chaunceyjiang avatar May 24 '24 02:05 chaunceyjiang

I've been working on the #1741 issue recently. I read the code of the dependencies distributor module and found some confusing naming. So I submitted PR #4980.

In the #4980, there is an error info output:

https://github.com/karmada-io/karmada/blob/f414fa04b8e87ccd3fe11f8766a79339dfc8f8a6/pkg/dependenciesdistributor/dependencies_distributor.go#L326

I think this error message should be discovered much earlier, so I submitted this PR

XiShanYongYe-Chang avatar May 24 '24 03:05 XiShanYongYe-Chang

thanks for your quick response. /lgtm

whitewindmills avatar May 24 '24 09:05 whitewindmills

Codecov Report

Attention: Patch coverage is 56.25000% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 53.32%. Comparing base (d676996) to head (8ec02ca).

Files Patch % Lines
pkg/resourceinterpreter/default/native/default.go 0.00% 4 Missing :warning:
...sourceinterpreter/default/thirdparty/thirdparty.go 0.00% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4982   +/-   ##
=======================================
  Coverage   53.31%   53.32%           
=======================================
  Files         252      253    +1     
  Lines       20539    20554   +15     
=======================================
+ Hits        10951    10960    +9     
- Misses       8862     8869    +7     
+ Partials      726      725    -1     
Flag Coverage Δ
unittests 53.32% <56.25%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 24 '24 09:05 codecov-commenter

/cc @RainbowMango

XiShanYongYe-Chang avatar May 27 '24 09:05 XiShanYongYe-Chang

Why not verify the dependencies returned from the default interpreters?

I think that the return body of external requests should be verified. The default interpreter does not involve external requests. It should be determined that the code is normal when it is written.

XiShanYongYe-Chang avatar May 28 '24 02:05 XiShanYongYe-Chang

@chaunceyjiang what's your opinion on this?

RainbowMango avatar May 28 '24 02:05 RainbowMango

Why not verify the dependencies returned from the default interpreters?

Good question! I believe third-party interpreters also need this.

chaunceyjiang avatar May 28 '24 02:05 chaunceyjiang

Yes, that's exactly the reason why I'm asking.

RainbowMango avatar May 28 '24 02:05 RainbowMango

Validation for the InterpretDependency operation has been added for all interpreters.

XiShanYongYe-Chang avatar May 28 '24 08:05 XiShanYongYe-Chang

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

karmada-bot avatar May 28 '24 15:05 karmada-bot