|
| 1 | +- ZAP PR: |
| 2 | + [zulip/zulip-architecture#1](https://github.com/zulip/zulip-architecture/pull/1) |
| 3 | + |
| 4 | +# Summary |
| 5 | + |
| 6 | +The Zulip architecture proposal (ZAP) process gives the Zulip core |
| 7 | +team a moderately more formal way to propose, collaborate on, and |
| 8 | +build consensus for architectural design proposals. |
| 9 | + |
| 10 | +# Motivation |
| 11 | + |
| 12 | +There are several reasons a given proposed change to the Zulip architecture |
| 13 | +can benefit from an explicit design proposal through the ZAP process. |
| 14 | + |
| 15 | +- Some categories of proposed changes to the Zulip architecture pose |
| 16 | + backwards compatibility concerns if we get them wrong. |
| 17 | + |
| 18 | + - We aim to support APIs for as long as reasonably possible, to avoid |
| 19 | + breaking clients using in the wild. We use the [api design |
| 20 | + channel](https://chat.zulip.org/#topics/channel/378-api-design) for |
| 21 | + tactical API design decision-making, but some big decisions that may |
| 22 | + be hard to change later deserve a more deliberative process. |
| 23 | + - We should ensure that data persisted to the database is structured in a way |
| 24 | + that will remain useful forever, to avoid expensive future migrations (which |
| 25 | + themselves need to be maintained forever). |
| 26 | + |
| 27 | + These changes will benefit from a design proposal phase separate from the |
| 28 | + implementation phase, where we work out a good design with an eye toward future |
| 29 | + maintainability before the details are set in stone. |
| 30 | + |
| 31 | +- Some proposed changes may be controversial or involve deciding |
| 32 | + between a number of alternatives with different tradeoffs. These |
| 33 | + changes will benefit from discussion between all stakeholders, and a |
| 34 | + lightweight mechanism to record and collect the consensus decisions |
| 35 | + reached in those discussions, so that implementation can proceed in |
| 36 | + a consistent direction. |
| 37 | + |
| 38 | +- Some proposed changes have a large enough scope that the |
| 39 | + implementation work is expected to be split over many pull requests |
| 40 | + over a long period of time. These changes will benefit from a |
| 41 | + detailed design document that guides the overall implementation plan |
| 42 | + and decreases the likelihood that earlier parts of the work need to |
| 43 | + be redone. |
| 44 | + |
| 45 | +# Detailed design |
| 46 | + |
| 47 | +When proposing a change that falls into the above categories or might otherwise |
| 48 | +benefit from a formalize design process, after preliminary discussion in our |
| 49 | +[development community](https://zulip.com/development-community/), a developer |
| 50 | +may choose to open a Zulip architecture proposal (ZAP). |
| 51 | + |
| 52 | +A ZAP is a pull request in this `zulip-architecture` repository that adds a |
| 53 | +Markdown document named like `text/0000-my-feature.md`. The numerical ID should |
| 54 | +be initialized with the placeholder `0000`, and replaced with the pull request |
| 55 | +number after the pull request is opened. |
| 56 | + |
| 57 | +The pull request description should link to the rendered Markdown document from |
| 58 | +the author's branch. The Markdown document should begin with a link back to the |
| 59 | +GitHub pull request page, and proceed with a suggested organization into |
| 60 | +sections such as “Summary”, “Motivation”, “Detailed design”, “Alternatives”, |
| 61 | +“Security implications”, “Future directions”, and “Previous discussion”, as |
| 62 | +applicable. |
| 63 | + |
| 64 | +Each new ZAP pull request should be posted to an appropriate stream in the |
| 65 | +development community for discussion. Discussion can happen in the development |
| 66 | +community or in comments/reviews on the pull request. Any discussion that |
| 67 | +happens outside the pull request should ideally be linked and summarized on the |
| 68 | +pull request to keep a record of it. The pull request will remain open while |
| 69 | +discussion is ongoing, and may be updated as desired. |
| 70 | + |
| 71 | +If the Zulip team reaches a consensus (via the usual decision-making conventions |
| 72 | +of the Zulip project, which are deliberately left unspecified here) that the |
| 73 | +proposal should be accepted, the pull request will be merged. If consensus is |
| 74 | +that the proposal should be rejected, the pull request will be closed, and if |
| 75 | +consensus is that it needs modifications, the proposal may remain open while |
| 76 | +being edited, or be closed in favor of a different pull request. |
| 77 | + |
| 78 | +The documents in `zulip-architecture` will be maintained to reflect |
| 79 | +the current consensus of the project. Typically this entails: |
| 80 | + |
| 81 | +- We expect to routinely edit ZAPs to link to issues/PRs related to |
| 82 | + the ZAP. When the implementation is complete, we'll edit the |
| 83 | + metadata at the top of the ZAP to say so, and to link to the |
| 84 | + relevant subsystem doc and/or API docs. |
| 85 | +- When we change our mind about something while an accepted ZAP is |
| 86 | + still in the process of being implemented, we'll typically edit the |
| 87 | + ZAP to reflect the design change. (This helps avoid wasting time |
| 88 | + during the implementation phase). |
| 89 | +- Once implementation is complete, we generally won't try to update |
| 90 | + ZAPs to match the current state of the architecture. The ZAP remains |
| 91 | + a record of what we were thinking then; people finding the ZAP and |
| 92 | + interested in the up-to-date API are advised to follow the links to |
| 93 | + current docs. |
| 94 | +- If we subsequently make a major overhaul — roughly, something that |
| 95 | + calls for a ZAP of its own — then we go back and add a link at the |
| 96 | + top of the older ZAP to point to the new one, a bit like the |
| 97 | + references at the top of old RFCs. |
| 98 | + |
| 99 | +# Alternatives |
| 100 | + |
| 101 | +Most design decisions in Zulip have been made in the |
| 102 | +[development community](https://zulip.com/development-community/) or within the |
| 103 | +GitHub pull requests for the implementation of individual Zulip features. We |
| 104 | +expect that most smaller decisions will continue to be made in those ways, and |
| 105 | +the ZAP process will be used in planning more substantial changes that will |
| 106 | +benefit from it. |
| 107 | + |
| 108 | +Some design proposals have been drafted on other platforms such as Dropbox |
| 109 | +Paper, but these are not accessible to our open source contributors outside the |
| 110 | +core team and aren't collected in a useful way. |
| 111 | + |
| 112 | +We considered writing design proposals within the Zulip |
| 113 | +[developer documentation](https://zulip.readthedocs.io/) which lives in the same |
| 114 | +repository as the server code. However, the developer documentation is intended |
| 115 | +to document Zulip as currently implemented; it has different maintenance and |
| 116 | +lifecycle needs from proposals that may pertain to a future or past |
| 117 | +implementation changes. |
| 118 | + |
| 119 | +Where appropriate, content can be copied from a ZAP into the developer |
| 120 | +documentation once the ZAP is implemented; but rarely will it make |
| 121 | +sense for a ZAP document to be copied in its entirely, since the |
| 122 | +audience and goals are different. |
| 123 | + |
| 124 | +The ZAP process is inspired by the |
| 125 | +[Rust RFC process](https://github.com/rust-lang/rfcs), which itself takes |
| 126 | +inspiration from the [Python PEP process](https://peps.python.org/). |
| 127 | + |
| 128 | +# Previous discussion |
| 129 | + |
| 130 | +- [#general > Why use both Memcache and Redis?](https://chat.zulip.org/#narrow/stream/2-general/topic/Why.20use.20both.20Memcache.20and.20Redis.3F/near/1002790), |
| 131 | + 2020-08-28 |
| 132 | +- [#api design > end-to-end encryption protocols](https://chat.zulip.org/#narrow/stream/378-api-design/topic/end-to-end.20encryption.20protocols/near/1611909), |
| 133 | + 2023-07-18 |
| 134 | +- [#api design > ZAP](https://chat.zulip.org/#narrow/stream/378-api-design/topic/ZAP/near/1613274), |
| 135 | + 2023-07-20 |
0 commit comments