Skip to content

fix(api): include module and cycle data in issue webhook payloads#9273

Open
ch4og wants to merge 1 commit into
makeplane:previewfrom
ch4og:preview
Open

fix(api): include module and cycle data in issue webhook payloads#9273
ch4og wants to merge 1 commit into
makeplane:previewfrom
ch4og:preview

Conversation

@ch4og

@ch4og ch4og commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Webhooks were missing module and cycle fields from the payload due to a broken source= traversal on reverse foreign key relations in IssueExpandSerializer.

The source="issue_module.module" path tries to resolve issue.issue_module and then access .module on it. Since a queryset has no .module attribute, DRF silently catches the AttributeError via SkipField and the field is dropped from the output entirely. The same issue affected the cycle field.

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

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features
    • API issue responses now conditionally expand cycle and module information based on request parameters.
    • Webhook payloads for issues now include expanded cycle and module details.

@coderabbitai

coderabbitai Bot commented Jun 19, 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: f0fa9054-6158-412a-8019-3bce7f4c1d50

📥 Commits

Reviewing files that changed from the base of the PR and between 53a323d and 5c80843.

📒 Files selected for processing (2)
  • apps/api/plane/api/serializers/issue.py
  • apps/api/plane/bgtasks/webhook_task.py

📝 Walkthrough

Walkthrough

IssueExpandSerializer replaces the static cycle and module nested serializer fields with SerializerMethodFields that conditionally return expanded lite serializer data or fallback id lists based on context["expand"]. The webhook task is updated to prefetch issue_module and issue_cycle relations and to pass "module" and "cycle" in the serializer expansion context.

Cycle/Module Conditional Expansion in Webhook

Layer / File(s) Summary
IssueExpandSerializer conditional cycle/module fields
apps/api/plane/api/serializers/issue.py
cycle and module fields change from CycleLiteSerializer/ModuleLiteSerializer with source= to SerializerMethodField. get_cycle and get_module return serialized lite data when their key is in context["expand"], otherwise return lists of cycle_id/module_id from the related manager.
Webhook task prefetch and expansion context
apps/api/plane/bgtasks/webhook_task.py
get_issue_prefetches adds issue_module__module and issue_cycle__cycle to the prefetch list. get_model_data extends the event == "issue" serializer context from ["labels", "assignees"] to ["labels", "assignees", "module", "cycle"].

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop! The cycle spins, the module gleams,
No longer static—context sets the themes.
Expand the list, prefetch with care,
get_cycle, get_module fill the air.
The webhook hops with payload bright,
All cycles and modules now in sight! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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 accurately describes the main change: fixing an API bug where module and cycle data were missing from issue webhook payloads.
Description check ✅ Passed The description includes a detailed explanation of the bug, identifies the root cause, and specifies which fields are affected. Type of Change is properly selected, though Test Scenarios section is empty.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

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.

1 participant