Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: init webhook validation check #117

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

bthari
Copy link
Contributor

@bthari bthari commented Sep 27, 2024

Background

When trying to initiate all async webhook, the webhook validation check throw an error that "at least 1 sync client must have finalResponse set to true". On the other hands, if trying to setup multiple sync & async client, where only async client has finalResponse=true, the validation will pass

Changes

  • Validate there's no duplicate webhook names for all client
  • Only check final response set to true and if a client used response from another webhook, the used webhook must be defined beforehand only for sync client (as response from async client will not be used)
  • Removing this line as useIdx > idx will never be true/reached, because if useIdx > idx then this must have been true then throw an error
  • Adding some testcases

@bthari bthari added the bug Something isn't working label Sep 27, 2024
@bthari bthari self-assigned this Sep 27, 2024
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.75%. Comparing base (9b92012) to head (21523a6).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #117      +/-   ##
==========================================
+ Coverage   56.39%   56.75%   +0.35%     
==========================================
  Files          48       48              
  Lines        2477     2479       +2     
==========================================
+ Hits         1397     1407      +10     
+ Misses        884      878       -6     
+ Partials      196      194       -2     
Flag Coverage Δ
api-test 56.75% <ø> (+0.35%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@tiopramayudi tiopramayudi left a comment

Choose a reason for hiding this comment

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

LGTM !

@bthari
Copy link
Contributor Author

bthari commented Oct 10, 2024

Thank you for the review @tiopramayudi!

@bthari bthari merged commit e057352 into main Oct 10, 2024
9 of 10 checks passed
@bthari bthari deleted the fix_init_webhook_validation branch October 10, 2024 04:50
bthari added a commit to caraml-dev/merlin that referenced this pull request Oct 15, 2024
# Description
Previously on #601 I added webhook for model version endpoint related
event, and in here the event will be expanded into a model, model
endpoint, model version related event, as we also want to have an action
(from other service) to be triggered if these events happen.

# Modifications
<!-- Summarize the key code changes. -->

- created another package for webhook interface 
- add event for:
  - model created
  - model endpoint created/updated/deleted
  - model version created/updated/deleted
- change previous event name of `on-model-version-*` to
`on-version-endpoint-*`


# Tests

# Checklist
- [x] Added PR label
- [x] Added unit test, integration, and/or e2e tests
- [x] Tested locally
- [ ] Updated documentation
- [ ] Update Swagger spec if the PR introduce API changes
- [ ] Regenerated Golang and Python client if the PR introduces API
changes

# Notes for Reviewer
The version of MLP used here has a validation bug (which is updated on
[MLP#117](caraml-dev/mlp#117)). The code could
still work with workaround (e.g. set `FinalResponse: true` in one async
webhook if user use _all_ async webhook, but it will be confusing for
user since async webhook response is expected to not be used anywhere),
~~so preferably to merge this PR after updating the MLP version as
dependencies.~~ (MLP version will be updated with the s3 PR)

# Release Notes
<!--
Does this PR introduce a user-facing change?
If no, just write "NONE" in the release-note block below.
If yes, a release note is required. Enter your extended release note in
the block below.
If the PR requires additional action from users switching to the new
release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note
add webhook event call if there's changes on model, model endpoint, model version
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants