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

example hook: dataset metadata validation #7752

Merged
merged 7 commits into from
May 20, 2024
Merged

Conversation

ozkatz
Copy link
Collaborator

@ozkatz ozkatz commented May 10, 2024

This PR also adds:

  1. basic stacktraces to lua hooks, which in most cases is just the line numbers of where things fail, as the call stack is pretty shallow. You try writing a >100 line lua script without this!
  2. The ability to separate errors from explicit failures, and present the latter in a friendlier way to the user

@ozkatz ozkatz added area/hooks improvements or additions to the hooks subsystem exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached labels May 10, 2024
@ozkatz ozkatz requested review from itaiad200 and talSofer May 10, 2024 14:41
Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed

Copy link

github-actions bot commented May 10, 2024

♻️ PR Preview 2aea483 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

Copy link
Contributor

@talSofer talSofer left a comment

Choose a reason for hiding this comment

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

The hook definition looks good from a product perspective! I'm approving this aspect of the PR

Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

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

Thanks,
2 comments

@@ -4637,11 +4637,14 @@ func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, bod
swag.StringValue(body.Strategy),
graveler.WithForce(swag.BoolValue(body.Force)))

var v *graveler.HookAbortError
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this logic be in the action execution points in graveler?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think graveler should be aware of what happens in a hook, it should be opaque. The meaning of an execution error vs an explicit failure is (imo) out of scope. I chose to put it here because the main "benefit" of this capability is how the error is exposed, so the API (presentation) layer felt like the natural choice.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks - so why are we doing it only or the Merge flow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I wasn't :) turns out errors are already handled in handleAPIError including HookAbortError - so I went ahead and removed this.

Copy link
Member

Choose a reason for hiding this comment

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

Would love to see unit tests for this lib similar to path

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. Added.

@ozkatz ozkatz requested a review from N-o-Z May 20, 2024 13:13
@ozkatz
Copy link
Collaborator Author

ozkatz commented May 20, 2024

@N-o-Z PTAL :)

Copy link
Member

@N-o-Z N-o-Z left a comment

Choose a reason for hiding this comment

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

LGTM!

@ozkatz ozkatz merged commit 9564812 into master May 20, 2024
36 checks passed
@ozkatz ozkatz deleted the example/dataset-metadata branch May 20, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hooks improvements or additions to the hooks subsystem exclude-changelog PR description should not be included in next release changelog minor-change Used for PRs that don't require issue attached
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants