-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Introduce project event webhook #1113
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
I notice that the
The first task has been completed, and the second task has been worked on #563. but third task is ongoing in PR #718. I'm currently considering when we should publish the Two possible approaches:
|
What this PR does / why we need it:
This PR implements document creation and document removal events for a new project event webhook. Currently, users who uses Yorkie as a SaaS are not always aware of document status changes. By introducing project-level events—rather than relying solely on doc-level events like
attach
orpush-pull
—we can more clearly represent the lifecycle of documents and make those events available to external systems.Which issue(s) this PR fixes: Fixes #1002
Special notes for your reviewer:
DocEvent
, but instead, I'm introducing aProject Event
. We already haveDocEvent
events (DocumentChanged
DocumentWatched
,DocumentUnwatched
,broadcast
), and using the same naming might be confusing.attach
,document-changed
,watched
,unwatched
) don't clearly convey CRUD semantics. For instances:documentAttached
alone doesn't explicitly indicate creation.push-pull
may imply either reading or updating a document, and it's not always obvious which. (AChange
can contain bothpresence
andoperations
; if it only haspresence
, it might not mean a real update of document's content.)removeDocument
function only marks a document as "removed" without fully deleting it. In contrast, theremoveDocumentByAdmin
function permanently deletes the document. When aremoveDocument
action occurs, Yorkie sends webhook events, allowing the customer's server to decide the next steps—such as moving the document to a recycle bin or directly deleting it usingremoveDocumentByAdmin
.X-Signature
header, generated using the project's secret key. The receiving server can verify this signature to ensure the request is from Yorkie.projectKey
in our request attributes.Handling timeouts and unreachable events
[immediately, 5s, 5m, 30m, 2h, 5h, 10h]
, etc.).Add an HTTP client with timeout
http.POST
does not allow specifying a request timeout directly, using an HTTP client with a configurable timeout is more predictable. Although the auth webhook still useshttp.POST
, we may consider migrating it to an HTTP client for consistency.In this PR
This design proposal differs somewhat from the original issue’s requirements. If the idea seems sound, I’ll proceed with the remaining tasks:
event_webhook
testsUpdateProjectRequest
API specpkg/webhook
In a subsequent PR
document-changed
event (with caching)Does this PR introduce a user-facing change?
Additional documentation
There are four configuration options related to timeouts, which can be confusing. Below is a brief explanation:
Checklist