How collapsed code helped me to merge broken code into master

Alexander Terehov
terales engineering
2 min readAug 22, 2019

Today I’ve spent a couple of hours on learning a lesson about best practice when working with pull requests in GitHub.

Hotfixes in new PRs were using the same feature branch

We have a feature merged on master and deployed, but in several days there was a bug discovered.

Rafael, the initial developer of the feature, fixed it in pull-request #3405:

I’ve reviewed and tested it and it was working fine for me as an admin of the website, so I’ve merged it without any hesitation.

It turned out the bug was still happening for users! And the reason was here:

the `else` statement was in an outside block

It was my mistake as a reviewer to assume that else is properly placed.

Lesson learned: look inside the collapsed code

at least, if there is a piece which was added to an existing block.

Also, this bug wasn’t apparent during mine manual testing because PhPStorm somehow didn’t upload the file to the remote development server as it configured to do AND I’ve missed the error message.

--

--