Skip to content

Commit 8f60500

Browse files
garvinhickinglinawolffroemken
authored
[TASK] Rework chapters on reviewing and contributing patches and issues (#341)
* [TASK] Rework chapters on reviewing and contributing patches and issues --------- Co-authored-by: Lina Wolf <[email protected]> Co-authored-by: Stefan Frömken <[email protected]>
1 parent bc9bc43 commit 8f60500

File tree

12 files changed

+477
-68
lines changed

12 files changed

+477
-68
lines changed

Documentation/BugfixingAZ/Index.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ as described in :ref:`setup <setup>`. Especially the
8080
See :ref:`Testing the core <testing>` in TYPO3 Explained for more information
8181
about writing and running tests.
8282

83+
Once you have finalized your patch, check out the :ref:`common-review-checks`
84+
for a list of what kind of review checks people may perform on your contribution.
85+
Stay ahead of the game and address those yourself first.
86+
8387
#. Commit your changes
8488

8589
Please make sure that you read the :ref:`commitmessage` in the Appendix.
@@ -167,9 +171,10 @@ as described in :ref:`setup <setup>`. Especially the
167171

168172
You can visit the link to https://review.typo3.org to see your patch in Gerrit.
169173

170-
If the automatically starting pre-merge build fails due to an error on Bamboo which
171-
isn't caused by your patch (e.g. time out) you can restart it on
172-
`Intercept <https://intercept.typo3.com/admin/bamboo/core>`__.
174+
The Continuous Integration service, running on GitLab Pipelines, will automatically
175+
be executed in the background and perform checks and tests on your patch.
176+
Failing tests will be linked to that instance, where jobs can also be retried
177+
(given sufficient permissions when being logged in to GitLab).
173178

174179
Advanced users / core team only: See
175180
:ref:`cheat sheet: other branches <cheat-sheet-git-other-branches>`
@@ -193,6 +198,9 @@ dozens of requests each day, so expect a succinct response that is short and to
193198
You will get notified by email, if there is activity on your patch in Gerrit
194199
(e.g. votes, comments, new patchsets, merge etc.).
195200

201+
Check out the section :ref:`reviewPatch` for more about this process, in which you can
202+
also be involved!
203+
196204
It is not unusual for a patch to get comments requesting changes. If that happens,
197205
please respond in a timely fashion and improve your review. If things are unclear,
198206
ask in the **#typo3-cms-coredev** channel on https://typo3.slack.com.

Documentation/CoreMergers/Review.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ Review a patch as a Core Merger
1313
.. include:: /_includes/CoreMergers.rst.txt
1414

1515
Please see :ref:`reviewPatch` for general information on how to review a
16-
patch.
16+
patch, also the :ref:`cheat-sheet on common review issues <common-review-checks>`.
17+
18+
As a Core Merger you have a huge responsibility because your vote (or misvote)
19+
has an impact on dedicated work of contributors or colleagues. This swings
20+
both ways: You can also greatly impact confidence and participation by being
21+
involved in a public voting and commenting process.
22+
23+
Remember that you represent the TYPO3 project as a public-facing "Person with Power".
24+
Please try to always vote by explaining your reasoning, and feel free to
25+
correspond with your fellow Co-Mergers for impactful decisions.
1726

1827
.. figure:: /Images/External/Gerrit/CoreMergers/VoteCoreMerger.png
1928
:class: with-shadow
@@ -69,7 +78,8 @@ Low brainers
6978
-------------
7079

7180
A Core Merger can give a +2 and submit right away in case of "low-brainers"
72-
(what used to be called "FYI").
81+
(what used to be called "FYI" and relates to changes that are highly
82+
unlikely to negatively impact anything).
7383

7484
A Core Merger can give a +2 and wait a bit before submitting
7585
(used to be called "FYI24", "FYI48", ...).

Documentation/HandlingAPatch/ChangeAPatch.rst

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ This chapter handles improving an existing patch. For creating a new patch, see
3636

3737
4. Test your changes (optional)
3838

39-
Run the TYPO3 testsuite locally, as described under :ref:`testing`.
39+
Run the TYPO3 testsuite locally, as described under :ref:`testing`. Otherwise,
40+
don't worry, the automatic CI will do that for every committed patch set on the
41+
TYPO3 infrastructure.
4042

4143
5. Add files and amend to commit
4244

@@ -54,6 +56,12 @@ This chapter handles improving an existing patch. For creating a new patch, see
5456

5557
You can amend as often as you want.
5658

59+
Bear in mind that this kind of Git commit amending is a bit different than
60+
when you do it with GitHub (and using `force-push`). For Gerrit, every push
61+
will be a patch set. Previous patch sets can never be overwritten by amending,
62+
so do not worry.
63+
64+
.. _git-commit-with-message:
5765
6. Push your change to Gerrit
5866

5967
Once you are satisfied, push your improved Patch Set to Gerrit:
@@ -62,3 +70,27 @@ This chapter handles improving an existing patch. For creating a new patch, see
6270
:caption: shell command
6371
6472
git push origin HEAD:refs/for/main
73+
74+
Each pushed set will iterate a new patch set, and all previous patch sets
75+
can always be compared and even checked out later on.
76+
77+
If you want, you can even provide an individual commit message to your push,
78+
so that in gerrit your code change shows up with what usually a
79+
"commit message subject" could do:
80+
81+
.. code-block:: bash
82+
:caption: shell command
83+
84+
git push origin HEAD:refs/for/main%m="Some_String_Without_Whitespace"
85+
86+
The underscore characters will be replaced by whitespace. You can also
87+
use the following bash script or shell alias to interactively do that:
88+
89+
.. code-block:: bash
90+
:caption: push-with-message.sh
91+
92+
#!/bin/bash
93+
94+
read -p "Please enter pseudo-commit message: " answer
95+
answer=$(echo "$answer" | tr -c '[:alnum:]' '_')
96+
git push origin HEAD:refs/for/main%m=$answer

Documentation/HandlingAPatch/FindAReview.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ Gerrit: Search
9191

9292
Or use the search box on `Gerrit <https://review.typo3.org>`__
9393

94+
GitHub: Links to Gerrit
95+
=======================
96+
97+
Each commit to the TYPO3 Git repository comes with some metadata
98+
linking issue and patch reviews, for example:
99+
100+
.. code-block::
101+
102+
[TASK] Provide PSR-7 Request in PolicyMutatedEvent
103+
104+
For additional context does the PolicyMutatedEvent
105+
now provide the current PSR-7 Request.
106+
107+
Resolves: #104141
108+
Releases: main, 12.4
109+
Change-Id: I1817366e77f20f6c43eef0ee209fbb419e7237e2
110+
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84913
111+
Tested-by: Lorem Ipsum <[email protected]>
112+
Reviewed-by: Lorem Ipsum <[email protected]>
113+
Tested-by: core-ci <[email protected]>
114+
115+
The line `Resolves` contains the Forge issue id.
116+
The line `Reviewed-on` contains the link to the gerrit patch.
117+
94118
Forge
95119
=====
96120

Documentation/HandlingAPatch/ResolveMergeConflicts.rst

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ However, git status will show you:
201201
All files shown with "both modified" will need to be attended to.
202202

203203

204-
Resolve the conflicts
205-
---------------------
204+
Resolve the conflicts manually
205+
------------------------------
206206

207-
If you want to do it manually, look for all occurrences of `<<<<<<<`.
207+
If you want to do it manually (instead of using an IDE to do it visually), look for
208+
all occurrences of `<<<<<<<`.
208209

209210
These are markers. They are used as follows (as in example above):
210211

@@ -229,6 +230,33 @@ The merge conflict will show:
229230

230231
There may be more than one conflict in a file!
231232

233+
Special case: JavaScript/CSS merge conflicts
234+
--------------------------------------------
235+
236+
JavaScript and CSS assets are build from sources in the monorepo, with the commands:
237+
238+
.. code-block:: bash
239+
240+
Buid/Scripts/runTests.sh -s buildCss
241+
Buid/Scripts/runTests.sh -s buildJavascript
242+
243+
This "compiles" files with ".scss" and ".ts" extensions to their bundled ".css" and
244+
".js" variants. TYPO3 also versions these files inside the monorepo.
245+
246+
Commiters need to be aware they need to maintain these asset versions, if they change
247+
any of the build source files, and commit them alongside their patch.
248+
249+
Since the compiled files are merged on one single line, a merge conflict in these files
250+
will occur, if your patch works on anything CSS/JS related and other changes
251+
have been introduced meanwhile.
252+
253+
The solution to resolve merge conflicts in these files is actually vers easy. Just
254+
re-perform the commands from above (`...buildCss/buildJavascript`), which will re-create
255+
the assets from your cherry-picked patchset. You may need to resolve conflicts in the
256+
`.ts/.scss` files beforehand, if there are any due to rebasing.
257+
258+
Afterwards, you can include the generated `.css/.js` file your git amend commit like
259+
any other resolved conflict (see below).
232260

233261
Resume command
234262
--------------
@@ -257,3 +285,14 @@ Resume git cherry-pick
257285
.. code-block:: bash
258286
259287
git cherry-pick --continue
288+
289+
Commit changes after rebase/cherry-pick
290+
---------------------------------------
291+
292+
Once your git repository is in sync with `HEAD` and your cherry-picking was
293+
successsful, you can edit/add files, commit and push as usual:
294+
295+
.. code-block:: bash
296+
297+
git commit --amend
298+
git push

Documentation/HandlingAPatch/Review.rst

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Reviewing a patch consists of two steps:
1313

1414
You have the option to contribute to both stages or just a single stage in the review process.
1515

16+
Both steps are free for everyone in the OpenSource community, you are not required to be
17+
a Core merger or Team member.
18+
1619
If you're able to improve the patch yourself, your contribution would be very much appreciated.
1720
Visit :ref:`lifeOfAPatch-improve-patch` to find out more about how you can help improve patches.
1821

@@ -35,6 +38,8 @@ Code Review
3538

3639
A basic code review is possible by using the Gerrit web interface.
3740

41+
For some tips on what to review, check our :ref:`common-review-checks`.
42+
3843
.. rst-class:: bignums-xxl
3944

4045
#. Select the latest patchset
@@ -127,6 +132,9 @@ Vote
127132
In order to comment or vote on a change you can click on the :guilabel:`Reply`
128133
and enter your comment. Here, you can also apply your votes.
129134

135+
Remember, everyone with just a TYPO3 user account is able to vote, you do not
136+
need to be a team member or Core merger.
137+
130138
.. figure:: /Images/External/Gerrit/CoreMergers/VoteUser.png
131139
:class: with-shadow
132140

@@ -158,9 +166,11 @@ Policy for votes
158166

159167
**Verified:** Needs :guilabel:`+1` of two reviewers, one of them being a Core Merger.
160168

161-
Votes from the Bamboo build server (user *TYPO3com*) do not count. This means
169+
Votes from the CI GitLab Pipeline Server (user "Core CI") do not count. This means
162170
that a patch which is fully reviewed usually has at least 3 **Verified** :guilabel:`+1`
163-
votes, two from humans and one from Bamboo.
171+
votes, two from humans and one from "Core CI" ("Core CI is happy" for Verified+1, "Core CI is not happy"
172+
for Verified-1). Each comment by Core CI is linked to the log of the performed job,
173+
so that you can inspect the output.
164174

165175
**Authors should not vote for their own patches**, unless the patch has been changed
166176
substantially by other developers.
@@ -194,7 +204,26 @@ be solved until this or that is fixed". Some hints on using -1 in reviews:
194204
a deeper knowledge of this subsystem, to take a look at it. I do not want
195205
this patch to be merged until this is sorted out and will vote -1 for now
196206
for this reason."
207+
* If you are on the "receiving end" of a "-1" or even a "-2" vote, please do not
208+
be afraid or feel bad. This is done as part of the process to make TYPO3
209+
evolve as best as it can. Try to work out problems or negative feedback,
210+
be kind to each other and remember you are contributing to OpenSource because
211+
the experience of improving things together, and learning from each other
212+
is what drives us.
213+
214+
Vote resets ("Revote")
215+
----------------------
216+
217+
Whenever a new patch is submitted, all votes are reset. So if previously
218+
a patch was voted to be merged, but then a last-minute issue is getting
219+
addressed, after the commit every vote will be back to zero.
197220

221+
Contributors to a patch review will receive notifications about this and
222+
are encouraged to review the patch and re-apply their vote if they
223+
still feel confident.
224+
225+
It is ok if the patch owner pings previous votes to please consider
226+
adding a revote, so that a patch can be pushed forwards.
198227

199228
How to handle [WIP] patches
200229
===========================
@@ -222,3 +251,24 @@ following this solution to its end."
222251
Having too many WIP patches in the review queue is not really helpful. Consider
223252
to fork the project in GitHub or somewhere else and push to gerrit again if
224253
your patches evolved.
254+
255+
Stale reviews / Cleaning up
256+
===========================
257+
258+
Since TYPO3 iterates on many, many patches and issues each day, the list
259+
of Gerrit reviews (as well as Forge issues) may feel intimidating.
260+
261+
Due to this it is vital to "clean up" patches from time to time:
262+
263+
* If you are no longer planning to work on a patch, maybe better abandon
264+
it, or ask other involved people to carry on.
265+
* If your patch is not getting feedback for a long time, ask in the
266+
#typo3-cms-coredev channel of the `TYPO3 slack workspace <https://typo3.slack.com>`__
267+
if people may want to review or give feedback on. Or try to find people
268+
working in a similar area of your patch and see if you can join forces.
269+
* From time to time, check on patches you have voted on, to see if you can
270+
push things forward to either get merged or abandoned.
271+
* Sometimes just check all your own open patches and see if you might catch
272+
interest in picking it up again.
273+
* Please either update older patches in "Merge conflict" mode or state your
274+
intent to abandon the patch.

Documentation/HandlingAPatch/Tips.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,44 @@ Voting
274274

275275
Consider the :ref:`policies and tips for voting patches <gerrit-voting>`.
276276

277+
.. _common-review-checks:
278+
279+
Common code review checks
280+
-------------------------
281+
282+
For reviewing and giving feedback, here's a couple of things that are often addressed. You can
283+
use this list both for checking other people's patches, as well as your own.
284+
285+
* Is the code-flow readable? Does it need more (or less) comments? Any code complexities
286+
("cognitive complexity") that could be easier to read when using different conditions/loops/sub-methods?
287+
* Do breaking changes occur that need to be noticed? This can also apply to:
288+
* Type Hinting
289+
* using PHP features beyond the supported PHP version
290+
* Loss of existing functionality
291+
* Typos
292+
* Are new class, method, function, variable names understandable
293+
* Is there a need to add unit/functional testing for specific changes
294+
* Are regression tests for a bugfix needed?
295+
* Is the "Releases: " scope of a patch spanning the proper TYPO3 versions
296+
(depending on the state of current LTS and priority-bugfix-only releases)
297+
* Are the "final" and "private/protected" and "readonly" scopes of classes, methods and variables used properly?
298+
* Is Dependency Injection used where applicable?
299+
* Are possibilities for early code returns and reduced nesting levels addressed?
300+
* If a change is Breaking or comes with a larger impact: Is a "Breaking.rst" or "Important.rst" document part of the patch?
301+
* If a patch is a new feature: Is a "Feature"-rst part of the patch? Check out the `rst file generator <https://forger.typo3.com/utilities/rst>`
302+
for help on creating files like this.
303+
* Does the licensing of any foreign code introduced match the Core licensing?
304+
* Is the commit message complete, clear and properly mentions all part of a patch?
305+
* If a new Exception is added, is the timestamp-identifier unique and recent?
306+
* When new PHP files are added, do they contain the TYPO3 License and a `declare strict_types` header?
307+
* Is the provided commit message, reST files and the code itself aligned? Sometimes in the process
308+
of reworking a patch multiple times, these three place of documentation can become out of sync.
309+
* If SCSS/TS changes are involved, are the resulting build files included in the patch, and were built with the
310+
right environment?
311+
* Does your patch deprecate anything? If so, have you followed :ref:`deprecations`?
312+
313+
If you feel this section is missing good things to watch out for for, please contribute to the
314+
documentation. This list does not claim to be complete, but should act as a kind of "Cheat-Sheet" for
315+
reviewing.
316+
277317

0 commit comments

Comments
 (0)