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

Update and Add OpenProject integration #34028

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

theofficialvedantjoshi
Copy link
Collaborator

Fixes: #29944

Screenshots and screen captures:

image

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@zulipbot
Copy link
Member

Hello @zulip/server-integrations members, this pull request was labeled with the "area: integrations" label, so you may want to check it out!

@theofficialvedantjoshi
Copy link
Collaborator Author

@Niloth-p

This PR fixes the issues pointed out in #29944.

Write a fresh view.py:

  • Created templates for each message to be sent for clarity.
  • Removed the wildvalue type and the initial logic inside the api_openproject_webhook.
  • Fetching the action from the payload and handling each case separately.
  • Improved error handling.

Other changes:

  • Updated the expected_message in tests to the new templates.
  • Updated the screenshot and added a realistic project name.
  • Updated doc.md to improve the punctuation and language for clearer instructions.

Do review this PR and let me know if any changes have to be made.

@Niloth-p
Copy link
Collaborator

Niloth-p commented Mar 17, 2025

Thank you for the updates. They are good improvements.

When I mentioned writing a "fresh" view.py, I didn't want the next contributor taking any inspiration from the previous view.py.
We do use JsonBodyPayload[WildValue], not JsonBodyPayload[dict[str, Any]].
I feel like the different cases in the view function can be optimized a bit further. Could you see if that's possible? For example, instead of assigning the topic manually in each case, it seems to be possible to programmatically generate it in common. We seem to be raising UnsupportedWebhookEventTypeErrors more than usual.

Can you please share the info you gathered or relevant links regarding the default values of parameters like "work package type", "action status", etc.?

Use ./tools/screenshots/generate-integration-docs-screenshot --integration integrationnamefor taking a screenshot.

Reminder: https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html
I think it's fine to have the other contributor's commit separately for the moment, so that the diffs are viewable, but we'll be squashing before merging. Please do squash your own commits.

I'm wondering if we could drop the "successfully" word, given that it's part of all of the message templates.

You also need to ensure coverage - see the failing checks.

Ah, I'm seeing that you've noticed some of these yourself.
This happened in the Google Calendar PR too, where you tagged me asking for reviews and questions on clearing the tests a couple of times, and then ended up solving them yourself in a few hours, and then you deleted some of those PR comments. Please try taking a bit more time to attempt solutions and doing a self-review before tagging reviewers next time.

@theofficialvedantjoshi theofficialvedantjoshi force-pushed the open-project-integration branch 2 times, most recently from cd0d994 to eb29f36 Compare March 17, 2025 13:28
@theofficialvedantjoshi
Copy link
Collaborator Author

I have made the necessary fixes.

Redundant error handling has been removed. The outer try and except is added to check if any django validation error occurs while accessing keys in the WildValue payload and throws an AnomalousWebhookPayloadError error. The "successfully" word has been removed from all messages. topic is now being programmatically generated, do point out any other possible optimizations. The screenshot has been generated using ./tools/screenshots/generate-integration-docs-screenshot --integration integrationname. I have also squashed all my older commits into a single commit.

Sources for EVENTS were found from the Webhooks page inside an OpenProject page.
image

Sources for WORKPACKAGE_TYPES(TASK, MILESTONE, PHASE) were found from the work packages page inside an OpenProject Project.
image

@theofficialvedantjoshi
Copy link
Collaborator Author

@Niloth-p are there any pending issues or is this pr ready to be merged?

@Niloth-p
Copy link
Collaborator

It's not ready to be merged, there are several rounds of review still pending.

@theofficialvedantjoshi
Copy link
Collaborator Author

theofficialvedantjoshi commented Mar 26, 2025

@Niloth-p Any updates on what needs to be added or fixed for this integration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OpenProject integration
4 participants