A very, very strange bug: the editor rolls back automatically?

I was testing some code, deleting a tab, and then adding some code to the other two tabs, and after a while, as I was typing, suddenly the editor rolls back: the deleted tab reappears, the new code is gone, and the entire editor rolls back to the state it was in before the tab was deleted, it’s like riding in a time machine. It was the first time I rolled back, I was thinking about it, I didn’t pay much attention to it, I deleted the tab again, and I kept writing the code, and after a while, the magic happened again, the editor rolls back again, again to the state it was in before the tab was deleted! Is anyone else in the same situation as me ?

Can you give concrete steps to make it happen?

@RonJeffries It happened unexpectedly, I just added some code to the editor, no special operationIt happened unexpectedly, I just added some code to the editor, no special operation.

The only difference is that I chose a custom template when I created the project, and this template included some unit test-related tabs. By the way, I’ve Been Reading Your D2, D3 blog for the last few days, and it’s a great tutorial, and I wanted to try out the CodeaUnit, so I created a new template that includes the CodeaUnit, and I created a new project using that template.

The asset:

Here is the empty TDD template and my project:

My project is a frame animation: The various movements of the game characters

https://youtu.be/xgBuZBr4sJo

@binaryblues did you have your project in source control or located elsewhere on the file system? Open in a different app as well?

@Simeon Thank your for responding, I only opened and edited the project in Codea, which is stored in the default Documents directory and does not use any other version control tools or any other file system.

The only thing special about it is that it was created with a custom template

This exact thing just happened to me with one weird difference: the project I was making wasn’t a template, but I was planning to make it a template.

The only way I can think this would be relevant is that the project had “Template” in the title.

  1. I used “duplicate” to copy the project I wanted to make a template of.
  2. I emptied out the Main tab.
  3. I deleted most of the other tabs.
  4. I realized I’d deleted a tab I’d wanted to save, so I went to the original project and cut-and-pasted the missing tab into the duplicate.
  5. I created a new tab for some new code.
  6. I typed in new code
  7. At some point it all just reset to the point before I’d left to retrieve the accidentally-deleted tab.
  8. Then I repeated steps 4 - 6 and after a couple minutes the exact same reset occurred a second time

I have seen that. To find it, the boys are going to need a solid way to reproduce it, ideally a fairly short one. I suggest that when this happens, the victim should try to find a repeatable series of steps that always makes it happen. If there is none, or we can’t find it, it’s going to be a bear to find and fix.

@UberGoober Thank you for providing detailed instructions to reproduce the problem?

@RonJeffries @Simeon Based on the scenarios in which @UberGoober and I triggered the problem, one thing we have in common is that we both copy the project, both create a new project by copying, and then edit the new project, so I guess it has something to do with the module of the Codea internal replication project, which looks like Codea copied the original project again at the wrong time, and then overwrote the incremental editing operation, implemented the effect of rollback.

My guess is that if I keep Codea from rebooting, I’ll probably see this type of overwrite again and again in subsequent edits, since I’ve had two overwrite rollbacks in a short time.

I can also add my 2 cents into the mix and say I have only ever experienced that editor reverting my changes when I copied a project.

I copied a project and removed pages from it that were “generic” and reusable. Then I did the same thing but this time removed the specific pages and left the generic ones. Then I would add new pages into them from copied pages of a other project, after switching back and forth between all 3 projects, I noticed the new ones would be missing pages that I know I copied into them. This only ever happened once per new project.

@skar Thank you for your information. It does seem to be a common problem. We all did.