Skip to content

feat(webhooks): emit page created/deleted webhooks#9401

Open
clwluvw wants to merge 1 commit into
makeplane:previewfrom
clwluvw:page-crud
Open

feat(webhooks): emit page created/deleted webhooks#9401
clwluvw wants to merge 1 commit into
makeplane:previewfrom
clwluvw:page-crud

Conversation

@clwluvw

@clwluvw clwluvw commented Jul 11, 2026

Copy link
Copy Markdown

Description

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.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Added page webhook event support for page creation, duplication, and deletion.
    • Webhook payloads now include page details (while excluding non-JSON document content).
    • Added an end-to-end page subscription flag so webhooks can be configured to receive page events.
  • Bug Fixes

    • Webhook endpoints now expose and allow updating the page flag via list/detail and PATCH.
  • Tests

    • Added contract and unit tests covering dispatch behavior, payload contents, filtering, and configuration.

Copilot AI review requested due to automatic review settings July 11, 2026 22:56
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: afdcf56b-c0e1-45f4-a1fe-4ffa45eb38c9

📥 Commits

Reviewing files that changed from the base of the PR and between 54ff7c0 and 3eb7961.

📒 Files selected for processing (10)
  • apps/api/plane/api/serializers/__init__.py
  • apps/api/plane/api/serializers/page.py
  • apps/api/plane/app/views/page/base.py
  • apps/api/plane/app/views/webhook/base.py
  • apps/api/plane/bgtasks/webhook_task.py
  • apps/api/plane/db/migrations/0122_webhook_page.py
  • apps/api/plane/db/models/webhook.py
  • apps/api/plane/tests/contract/app/test_page_app.py
  • apps/api/plane/tests/contract/app/test_webhook_app.py
  • apps/api/plane/tests/unit/bg_tasks/test_webhook_page_task.py
🚧 Files skipped from review as they are similar to previous changes (10)
  • apps/api/plane/api/serializers/init.py
  • apps/api/plane/db/migrations/0122_webhook_page.py
  • apps/api/plane/api/serializers/page.py
  • apps/api/plane/db/models/webhook.py
  • apps/api/plane/tests/contract/app/test_webhook_app.py
  • apps/api/plane/app/views/webhook/base.py
  • apps/api/plane/tests/unit/bg_tasks/test_webhook_page_task.py
  • apps/api/plane/tests/contract/app/test_page_app.py
  • apps/api/plane/bgtasks/webhook_task.py
  • apps/api/plane/app/views/page/base.py

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Page Webhook Support

Layer / File(s) Summary
Webhook subscription and payload contract
apps/api/plane/db/models/webhook.py, apps/api/plane/db/migrations/..., apps/api/plane/api/serializers/*, apps/api/plane/app/views/webhook/base.py, apps/api/plane/tests/contract/app/test_webhook_app.py
Adds the page webhook flag, exposes it through GET/PATCH, and defines a read-only PageSerializer that excludes binary and JSON description fields.
Page webhook routing and payload fan-out
apps/api/plane/bgtasks/webhook_task.py, apps/api/plane/tests/unit/bg_tasks/*
Registers page model and serializer mappings, routes events to active page-subscribed webhooks, and validates serialized create and id-only delete payloads.
Page lifecycle event dispatch
apps/api/plane/app/views/page/base.py, apps/api/plane/tests/contract/app/test_page_app.py
Queues page webhooks for create, delete, and duplicate operations, with tests covering valid, invalid, archived, and non-archived page flows.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding page create/delete webhook events.
Description check ✅ Passed The description covers the feature and type of change, though screenshots, test scenarios, and references are omitted.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 page subscription flag to the Webhook model (with migration) and exposes it via the webhook API.
  • Extends the webhook fan-out task to support event="page" and serialize Page payloads.
  • Emits page webhooks 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.

Comment thread apps/api/plane/app/views/page/base.py
Comment thread apps/api/plane/app/views/page/base.py
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants