freeCodeCamp / CodeAlly-CodeRoad-freeCodeCamp

10 stars 5 forks source link

Step doesn't always load correctly #43

Closed moT01 closed 2 years ago

moT01 commented 2 years ago

Not sure why, but this step frequently doesn't load correctly. Other steps don't typically have this issue. Strange.

Screen Shot 2022-03-23 at 9 47 48 AM

Any thoughts @ShMcK?

ShMcK commented 2 years ago

It looks like a possible merge conflict when the step loads.

Any idea of the content changes for the step?

moT01 commented 2 years ago

It's these three commits - 670, 680, and 690. 690 is the one it's trying to load. Nothing seems out of place in the commits. The consequence of the problem seems to be that step 670 doesn't get commented out, so the tests don't pass. Not sure if that happens when 680 loads, or 690 tries to load. I would have to open up the tutorial again. Here's a link to the markdown and a forum post with some users who have seen the issue. I'm quite sure the issue doesn't happen every time, I have gotten passed it most of the time without a problem if I recall correctly.

moT01 commented 2 years ago

yea, for some reason this particular step has been problematic with this issue. I tried to reproduce it three more times, couldn't get the problem to happen. Some more details on the result of the problem - it seems to end up loading the 690 commit after the failed attempt, and then deletes the 680 commit or something cause the 680 file says 'D' for deleted, and the 670 commit is no longer commented out - the 680 commit comments it out. So the 680 commit is just missing it seems. So maybe one partial solution would be to handle a failed cherry-pick differently? Not sure how, but it seems like that 680 commit shouldn't go missing after the fail.

This doesn't explain why the commit can't be cherry picked in the first place - or why it only happens sometimes and not others. Perhaps there is a problem in the tutorial - doesn't seem like it, though.

I glanced over some posts about cherry-picking... https://stackoverflow.com/questions/37237637/git-cherry-pick-causes-merge-conflict-while-merging-does-not https://stackoverflow.com/questions/24761745/why-does-cherry-pick-always-result-in-a-merge-conflict https://stackoverflow.com/questions/38864884/why-does-this-cherry-pick-have-a-conflict

So, the 680 commit adds 680.test.js (and a few other things), and then 690 tries to get cherry-picked - which comments out 680.test.js and creates 690.test.js - seems like the only potential conflict would be the commenting out of 680.test.js. I looked at it pretty hard, it looks fine - I didn't see any extra spaces or tabs as spaces in there. I've always just commented out the old tests when moving to a new step, I wonder if deleting the files instead would help here. That's a big adjustment when I can't consistently reproduce the problem, and I feel like the same problem would probably happen. I dunno.

ShMcK commented 2 years ago

@moT01 I was looking into this one tonight, but it seems you may have already found a solution: https://forum.freecodecamp.org/t/bug-in-building-a-mario-database/493206/30

Did you figure out the cause?

moT01 commented 2 years ago

I didn't figure out any more of a cause than is explained above. The cherry-pick gets a conflict - and the result is that the commit before it gets dropped or something. So I end up with two test files running on one step, making it impossible to pass since they ask for conflicting things.

I'm not 100% sure my solution is really a solution or not - I am having a hard time reproducing the problem so I can't say if it will work or not. Here's my new version branch. I changed the structure of what's on each commit - I load all the tests on the initial commit and use mocha config to only run tests on a specific file. Here's one of the commits. I suppose the theory is that if a cherry-pick fails, that config will have it so only one test file ever runs - so there won't be conflicting tests. But I'm not exactly sure what will happen if that cherry-pick fails.

If I don't see any more issues around this for a bit, I plan to convert the other tutorials to behave like this. So if it works, CodeRoad can probably just leave it - although, maybe there's a way to handle those failed cherry-picks better? Perhaps it's a combination of the way those are handled and how the tutorials were designed that is leading to this type of issue. Not sure - but if it works like this, I don't really care.

Edit: I noticed a different issue as well. You can see there's a FINALIZE commit on that new version. Basically, the last commit was failing to load on the tutorials, but only if you used the reset button at some point. The logs looked like this: Screen Shot 2022-03-31 at 8 00 44 AM The cherry-pick step just didn't happen. Adding an additional commit at the end fixed it.

moT01 commented 2 years ago

I ended up converting all the tutorials to the new structure and haven't seen any issues around this for some time. I think we're in the clear for these tutorials - although CodeRoad may want to change it so those failed cherry picks are handled differently or something. Not quite sure if there's an issue there, or maybe it's just how git behaves.