feat(webhooks): emit page created/deleted webhooks#9401
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughAdds page webhook subscriptions, read-only page payload serialization, webhook task routing, and lifecycle dispatch for page creation, deletion, and duplication, with API and task tests covering the new behavior. ChangesPage Webhook Support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PageViewSet
participant webhook_activity
participant Webhook
participant webhook_send_task
PageViewSet->>webhook_activity: enqueue page lifecycle event
webhook_activity->>Webhook: find active page subscriptions
webhook_activity->>webhook_send_task: enqueue page webhook payload
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds first-class workspace webhook support for page lifecycle events so webhook subscribers can opt into notifications when pages are created or deleted.
Changes:
- Adds a
pagesubscription flag to theWebhookmodel (with migration) and exposes it via the webhook API. - Extends the webhook fan-out task to support
event="page"and serializePagepayloads. - Emits
pagewebhooks from the page create/delete/duplicate endpoints and adds unit + contract tests to lock behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/api/plane/tests/unit/bg_tasks/test_webhook_page_task.py | Unit tests for page event mapping/serialization and fan-out filtering. |
| apps/api/plane/tests/contract/app/test_webhook_app.py | Contract coverage that webhook API accepts/returns the page flag. |
| apps/api/plane/tests/contract/app/test_page_app.py | Contract coverage that page create/delete/duplicate dispatch page webhooks (via mocked task). |
| apps/api/plane/db/models/webhook.py | Adds page boolean subscription flag on the Webhook model. |
| apps/api/plane/db/migrations/0122_webhook_page.py | Migration to add the page field. |
| apps/api/plane/bgtasks/webhook_task.py | Adds page to model/serializer mappers and filters page-subscribed webhooks. |
| apps/api/plane/app/views/webhook/base.py | Exposes page in webhook GET/PATCH field projections. |
| apps/api/plane/app/views/page/base.py | Enqueues page webhook activity on create/delete/duplicate actions. |
| apps/api/plane/api/serializers/page.py | Introduces PageSerializer for webhook payload serialization. |
| apps/api/plane/api/serializers/init.py | Exports PageSerializer for webhook task imports. |
Workspace webhooks could subscribe to project, issue, cycle, module and
issue_comment events but not pages. Add a `page` event so subscribers are
notified when a page is created or deleted.
- db: add `Webhook.page` BooleanField (default False) + migration
0122_webhook_page.
- bgtasks/webhook_task: register `page` in SERIALIZER_MAPPER and
MODEL_MAPPER and route `event="page"` to page-subscribed webhooks. Add a
read-only api PageSerializer for the payload (excludes the Yjs
`description_binary` BinaryField, which has no JSON representation).
- app page viewset: dispatch `webhook_activity.delay(event="page", ...)` on
create ("created"), destroy ("deleted") and duplicate ("created"),
mirroring the project viewset pattern. Duplication is a real create path,
so it fires a created event too.
- app webhook endpoint: add `page` to the GET/PATCH field enumerations so the
new flag is listed alongside its peers (the app WebhookSerializer already
exposes it via fields="__all__").
Out of scope (deliberately): page "updated" webhooks and `page_comment` —
page edits flow through the Yjs/live collab server (not a DRF save) and there
is no PageComment model.
Tests: unit coverage for the page routing + serializer in webhook_activity,
and contract coverage for create/destroy/duplicate dispatch and for
provisioning the `page` flag through the webhook API.
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Description
Workspace webhooks could subscribe to project, issue, cycle, module and issue_comment events but not pages. Add a
pageevent so subscribers are notified when a page is created or deleted.Type of Change
Summary by CodeRabbit
New Features
pagewebhook event support for page creation, duplication, and deletion.pagesubscription flag so webhooks can be configured to receive page events.Bug Fixes
pageflag via list/detail and PATCH.Tests