niri
Clone
https://git.tahinli.com/Tahinli/niri.git
0 watching·0 forks·Rust·GPL-3.0·12.1 MiB·9d8f4f8·Ivan Molodetskikh·1 month ago·2997 commits
| 1 | # Contributing to niri |
| 2 | |
| 3 | Thanks for your interest in niri! |
| 4 | The project has grown quite a bit, and we could use all help that we can. |
| 5 | |
| 6 | Make sure to join our Matrix chat if you have any questions or want to discuss anything: https://matrix.to/#/#niri:matrix.org |
| 7 | |
| 8 | ## LLM policy |
| 9 | |
| 10 | You're not allowed to use LLMs to *create*. |
| 11 | All pull request code (including tests), issue descriptions, comments, public reviews, etc. must be human-written. |
| 12 | You can use LLMs privately (not like I can check or control that), but not to write from scratch. |
| 13 | You may use LLMs for *translating* your human-written text; in this case you must also provide the original text to reduce the chance of miscommunication. |
| 14 | |
| 15 | This policy is motivated by several observations: |
| 16 | |
| 17 | - LLM writing is always long and excessive, and wastes time of the reader. |
| 18 | - LLM issue analysis is not only overly long and excessive, but also frequently wrong. |
| 19 | - LLM-assisted PRs are usually a bigger chore to review, and the developer frequently struggles to adequately address comments. |
| 20 | - For code contributions, our goal is to grow contributors with understanding of the niri codebase. |
| 21 | Using LLMs to write code sidesteps this learning process. |
| 22 | - LLMs remove an important *effort barrier* for writing code, even if the result reads fine. |
| 23 | The code ends up overly complex to solve non-existing or impractical problems. |
| 24 | Such code would not get written in the first place since the effort-benefit ratio is too high. |
| 25 | It increases maintenance burden and takes time away from more important PRs. |
| 26 | |
| 27 | This reasoning applies to test code too. |
| 28 | LLM-written tests tend to be overly verbose and hard to understand. |
| 29 | Since it's *effortless* to generate test code with LLMs, the tests frequently end up repeating themselves, testing things that are trivially true, or testing internal states of the system rather than the outcomes. |
| 30 | Such tests may be helpful for initial verification of a new feature, but they are a chore to review and disproportionately increase maintenance burden. |
| 31 | - Nobody wants to read AI slop. |
| 32 | |
| 33 | ## Issues and discussions |
| 34 | |
| 35 | This is a good way to help many new and existing users without programming knowledge. |
| 36 | |
| 37 | - Answer and help people in GitHub issues and discussions. |
| 38 | - Check and point out duplicate issues. |
| 39 | - Check for issues that are likely application bugs (and not niri bugs). |
| 40 | - Ask or try to reproduce on another non-Smithay-based compositor (sway, KDE/KWin, GNOME/Mutter). If the issue reproduces, it's likely an application bug. |
| 41 | - Ask or try to reproduce on another *Smithay-based* compositor ([cosmic-comp], [anvil]). If the issue reproduces only on Smithay compositors, it may be a Smithay bug. |
| 42 | - Make sure you're testing the Wayland version of the app on all compositors. Apps may silently use X11 when an X11 `$DISPLAY` is available. |
| 43 | - Problems with X11 apps should be reported to [xwayland-satellite]. When testing xwayland-satellite on different compositors, make sure you use xwayland-satellite's `$DISPLAY` (rather than another compositor's built-in Xwayland `$DISPLAY`). |
| 44 | - After testing, mention where you could and couldn't reproduce, as well as the exact steps to reproduce if the issue is missing them. |
| 45 | - Try to reproduce the issue on your own system and write if you could or couldn't reproduce it. |
| 46 | - Upvote issues with a thumbs up reaction as you like. |
| 47 | - Ideas and feature requests from new users should go to Discussions. |
| 48 | |
| 49 | If your issue is a duplicate, or not a niri issue (application bug, hardware problem, configuration problem), then please close it. |
| 50 | |
| 51 | ## Reviewing and testing pull requests |
| 52 | |
| 53 | With the growing popularity, the volume of pull requests is honestly more than I can manage myself in my free time. |
| 54 | I would really appreciate help with testing and reviewing them. |
| 55 | |
| 56 | ### Testing |
| 57 | |
| 58 | Pick a pull request you like, then build it and give it a go. |
| 59 | The [Developing niri wiki page](https://niri-wm.github.io/niri/Development:-Developing-niri) has guidance on running niri test builds. |
| 60 | |
| 61 | Be really thorough with your testing. |
| 62 | We're striving for polished features in niri, so point out any issues and bugs, even small ones like animation jank. |
| 63 | |
| 64 | - Think of weird edge cases or unexpected interactions and try them to see that they work reasonably. |
| 65 | - Try to break the feature and check that it behaves well. |
| 66 | - Where applicable, try different input devices: keyboard, mouse, trackpad, tablet, touchscreen. |
| 67 | - Watch out for any new performance drops. |
| 68 | |
| 69 | For bug fixes, first make sure you can reproduce the bug, then do the same steps in the PR test build, and verify that the bug is fixed. |
| 70 | Be similarly thorough: test any similar or related edge cases to verify that the fix doesn't introduce any new problems. |
| 71 | |
| 72 | Write your findings in the pull request: any issues you found, or if everything worked well. |
| 73 | Re-test after the author updates the code to see that your issues were fixed. |
| 74 | |
| 75 | Don't hesitate to test even if someone else already did; very frequently different people will stumble upon different problems. |
| 76 | |
| 77 | ### Reviewing |
| 78 | |
| 79 | Reviewing pull requests is something I need the most help with since there are a lot of them, and it's quite time-consuming. |
| 80 | Anyone with code accepted into niri is welcome, but this is not a requirement; even if you aren't familiar with Rust you may find some logic problems. |
| 81 | |
| 82 | Pick a pull request, then review its code. |
| 83 | |
| 84 | - Check that everything looks good, check various conditions for edge cases. |
| 85 | - See if there are any scenarios the author forgot to handle. |
| 86 | - Check that the code fits well into the rest of niri, follows its design and code style. |
| 87 | - I understand this is vague. The idea is: look at the surrounding code and at similar modules (e.g. when implementing a new protocol, check other protocol implementations), and try to follow the style and structure. |
| 88 | - Check for unrelated changes that may be better split into their own pull request. |
| 89 | - Check that the wiki had been updated if necessary (for example, new config options were documented with examples, and have a correct Since annotation). |
| 90 | |
| 91 | Point out everything you find as review comments (don't forget to submit the review). |
| 92 | Be constructive and respectful; some people may be new to programming and Rust. |
| 93 | As the author addresses the comments and issues, check the code again to see that the problems were fixed. |
| 94 | If everything looks good, say that, so I know someone has reviewed the PR. |
| 95 | |
| 96 | As with testing, don't hesitate to look through and comment even if someone else already had. |
| 97 | Extra pairs of eyes catch more problems. |
| 98 | |
| 99 | ## Writing pull requests |
| 100 | |
| 101 | When creating pull requests, please keep the following in mind. |
| 102 | |
| 103 | - Make sure new features align with niri's design directions. Ideally, there should be an existing issue or discussion where we settled on that solution. |
| 104 | - Keep pull requests focused on a single feature or bug fix with no unrelated changes. |
| 105 | - Document unobvious design and architecture decisions. Why you chose one way over the other, which alternatives you tried. This helps to evaluate the code. |
| 106 | - Try to split your changes into small, self-contained commits. Every commit should build and pass tests. This makes it much easier to review your PR, and bisect for regressions in the future. |
| 107 | - When addressing PR comments, try to squash the changes straight into the relevant commits. |
| 108 | - In some cases when the requested changes are big/unclear, you can leave them as separate commits on top, but please squash and otherwise clean up the history when the changes are finalized. |
| 109 | - To update the main branch, please rebase instead of merging. Try to force-push the main update rebase separately from other changes, this way it's easy to skip during review since it's usually not interesting. |
| 110 | - When working on bigger features, I usually start with a big messy commit, then gradually split out smaller self-contained changes from it as the code gets into shape. |
| 111 | - [git-rebase.io](https://git-rebase.io/) is a helpful guide for splitting commits and cleaning up history in git. |
| 112 | - When you address a review comment, mark it as resolved. |
| 113 | - Remember to [run tests](https://niri-wm.github.io/niri/Development:-Developing-niri#tests) and format the code with `cargo +nightly fmt --all`. |
| 114 | - For new layout actions, remember to add them to the randomized tests. For weird Wayland handling, adding client-server tests in `src/tests/` could be very useful. |
| 115 | - Test your changes by hand thoroughly, including for edge cases and weird interactions. See the Testing section above for some tips. |
| 116 | - Remember to document new config options on the wiki. |
| 117 | - When opening a pull request, ensure "Allow edits from maintainers" is enabled, so I can make final tweaks before merging. |
| 118 | |
| 119 | ### How to get your pull request reviewed more quickly |
| 120 | |
| 121 | - Make it small and self-contained. Avoid mixing several unrelated changes in one PR. |
| 122 | - Split the PR into small and self-contained commits. This makes it much easier to review. |
| 123 | - Discuss new features, options, or behavior changes beforehand; make sure there's consensus about the design. |
| 124 | - When creating the pull request, clearly write what it does, what problem it solves, how to test it. |
| 125 | - Follow the rest of the advice from this document. |
| 126 | |
| 127 | |
| 128 | [cosmic-comp]: https://github.com/pop-os/cosmic-comp |
| 129 | [anvil]: https://github.com/Smithay/smithay/tree/master/anvil |
| 130 | [xwayland-satellite]: https://github.com/Supreeeme/xwayland-satellite |