This question belies an existing issue with the Q&A system on Stack Overflow: the self-answer. When this option is checked, you can create a Question and an Answer at the same time, as a way of showcasing the solution to an issue or question you just dealt with, and want to share:
Gajus used this option to create a 'Q&A-style' post, where the meat of the implementation resided only in the answer. This is a little problematic because we're traditionally supposed to judge a question on its merits alone. This means we don't look at the answers during our first pass of deciding whether the question is on-topic or not.
Obviously in this case, that first pass is not enough. The Question and Answer here exist as two parts of a whole. Unfortunately, there's no banner or message in the Stack Overflow Q&A system that notifies readers that "hey, this is a self-answer, please look below for the solution". Also unfortunately, SO has kind of moved in a fragmented way regarding fixing this problem - they've started pushing SO Documentation for what used to be a good case for self-answer Q&A questions.
Regarding this question, once aware that the answer was posted at the same time, it's hard for me to argue that the question doesn't have the MCVE that I thought it needed before. While I think the question would be better with the "before" code (and that code has since been added in), the question's scenario is basic enough.
In summation, the question as it is now should remain open, perhaps with a N.B. by the author that this is a self-answer post. It'd be good, too, if the author could revise the code to match his self-answer markup. Ryan should not have added his own code into the question, when his own code differed so much; as Makyen's answer describes, that goes too far beyond what an edit should do: providing enough detail is the OP's job.
Stack Overflow also needs to include a banner for self-answer posts (perhaps with a quick anchor link to the relevant answer, in the event that other answers are added. Of course, we're sort of at the 'quick-as-molasses' pace with Q&A features/iteration right now.