Skip to content

Instantly share code, notes, and snippets.

@Hypro999
Last active February 15, 2020 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypro999/720c8ee92e7d53d662306e84af09a784 to your computer and use it in GitHub Desktop.
Save Hypro999/720c8ee92e7d53d662306e84af09a784 to your computer and use it in GitHub Desktop.
My final submission for GSoC 2019 explaining the work I've done.

Google Summer of Code 2019 with The Zulip Open Source Project


Introduction

Google Summer of Code (GSoC) is a summer internship program arranged by Google to promote open source software development by college students from around the world, and to help them gain new skills and experience by developing real-world open source software. This summer, as part of GSoC, I worked with The Zulip Open Source Project which develops the team communications application Zulip.

My work revolved around developing various aspects of Zulip's backend related components in the Zulip Server repository.


A Summary of the Work I've Completed

The Integrations Developer's Panel

Formerly, to test integrations, we would have had to use the command line tool which was difficult to use when testing multiple integrations and lacked certain functionality which would have been extremely convenient/useful to the developers and reviewers.

To save time and effort, as well as make the process more convenient, and enjoyable, I developed a more powerful and flexible GUI tool - the "Integrations Developer Panel".

Some improvements that this GUI tool offers over the former CLI are:

  1. Ability to select which bot sends the message. This is useful for testing out permissions as well as other parameters which vary bot to bot.
  2. Automatically generate the URL to post to by allowing the user to select options from a dropdown menu.
  3. Ability to modify the body and headers sent with the request.
  4. Ability to send messages for each and every fixture for that integration all at once (to make reviewing easier).

Integrations Developer Panel

Main Pull Requests: 12174, 12341, 12376

Improving the Integrations System to Store and Test Headers

For each integration, we store "fixtures" which are sample payloads for each kind of event that we can expect to receive from the third-party application or service that we are integrating with. One shortcoming of this was that there would be some cases where we needed to know the headers as well. Before this work was done, we used to store headers directly inside the test, but this means that it would we hard to read the headers anywhere else like in the integrations developer panel.
Thus, I implemented a small system where the headers would be generated as a function of the integration and fixture names. This allowed us to pre-load the headers for a particular integration for a particular fixture in the integration developer panel.

Main Pull Requests: 12515, 12622, 12718

Miscellaneous Changes to Various Integrations

Additions and modifications to some of Zulip's integrations.

  1. Add a new Bitbucket Server Integration (note: mostly done just prior to selection). Pull requests: 11992, 11975, 12584, 12873

  2. Stripe: Modify the invoice.updated event handling logic Pull request: 12539

  3. Jira: Support the change from "issue_" to "comment_" type events. Pull request: 13019

Improve the OpenAPI System (Automated Static Code Analysis Tool)

After Tim Abbott created an initial system to ensure that our OpenAPI documentation in zulip.yaml matches up with the arguments declared in the code itself, I further worked on it to add many missing features such as:

  • an automatic type checker to ensure that the types of the declared variables match up with the request parameter types in the documentation (using Python type hints).
  • standardized the url format.
  • Added a regex pattern to convert Django's URL patterns to the format used in the OpenAPI documentation.
  • Removal of some "buggy" endpoints.
  • Removal of some "undocumented" endpoints.

Main Pull requests: 12681, 12751, 12812, 12934, 12957

Add Production Support for Zulip on Debian Buster

Extended the installation scripts, puppet manifests, etc. to support being able to host Zulip on Debian 10 (Buster).

Pull Request: 13002

Automatically Generate Curl Examples

In our documentation, we detected faulty cURL examples. To ensure that this does not happen again, I made a template-tag/function which would automatically generate the appropriate cURL example for a given endpoint using data from zulip.yaml. I have also added a feature to be able to exclude certain parameters if desired.

Main Pull Requests: 12919, 12994

Related Pull Requests: 12875, 12905

Miscellaneous Changes to Zulip's Backend

  • management tools: Don't prepend "HTTP_" to certian headers in parse_headers. Pull request: 12536
  • realm_plan_type: Restrict settings by plan type. Pull request: 12544
  • streams: New stream messages should be auto marked as read by creator. Pull Request: 12828

Miscellaneous Changes to Zulip's Documentation

Pull Requests: 12440, 12443, 12480, 12481, 12687, and quite a few more...

Implement the Backend System for Allowing Users to Configure Incoming Webhook Bots

Going forward, it will be very important to allow users to configure their incoming webhook-style bots with data such as API keys, the root url for where the third party service/application (and hence api) are running, keys to modify behavior, etc. This pull request implements a clean solution for this which does not affect the way we configure embedded bots. An option to validate the key before saving was also added.

Pull Request: 13029


What's in the Pipes [Yet to be Merged]

Allow Incoming Webhook Bots to Make Callback Requests to Third Party API + Simple Phabricator Integration

Some incoming webhook style integrations require being able to make some calls/requests back to a third party API to fetch more data to produce a meaningful message. To do this I've added a formal system (interface around the requests module) to be able to make this process more systematic and convenient for multiple calls. I've also extended the testing system to allow easier setup for tests that need api endpoints to be patched/mocked using httpretty.

Pull Request: 12109


Closing Notes

Google Summer of Code 2019 was a great and enriching experience for me and it will be one that I will continue remember and cherish for years to come. I want to greatly thank both Google for arranging this program and the Zulip Open Source Project for having me. The Zulip Open Source Project has an amazing community filled with wonderful individuals each with their own admirable talents and I am glad to be able to say that I am a part of it. I want to thank everyone who helped me become a better developer and for helping me when I was stuck or confused. In particular I would like to thank the founder of Zulip, Tim Abbott (@tabbott) for his knowledgable insights, patience, and constant support and guidance to keep my work moving. It was truly a privilege to work under his mentorship. I would also really like to thank my personal mentor Eeshan Garg (@eeshangarg) for helping me learn the ropes of the Integrations side of Zulip and for his crucial support and kind words.

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