seongjaelee / nvatom

nvatom (unpublished from atom.io)
MIT License
75 stars 14 forks source link

Upgrade to 0.2.0 removes notes #25

Closed jrs65 closed 9 years ago

jrs65 commented 9 years ago

I'm not quite sure exactly what happened here: I just updated notational-velocity to 0.2.0 while I had a note open in atom, at that point the notes tab disappeared, and the note seems to have been removed from disk. I only started using this a few days ago, so I only had a single note, and so I'm not sure if the bug is removing all notes, or just ones that are open.

Anyway there seems to be some kind of bug where notes get removed upon upgrade. Does the note directory get cleared out when atom updates the package directory?

jonmagic commented 9 years ago

Anyway there seems to be some kind of bug where notes get removed upon upgrade. Does the note directory get cleared out when atom updates the package directory?

This isn't the intended behavior. I tried replicating the issue described by uninstalling the package, then installing version 0.1.0 from the command line with apm install notational-velocity@0.1.0, opening a note in Atom with the notational-velocity package, then upgrading to 0.2.0 using the package update settings page. After upgrading my note was still intact and I checked and my Notes folder and all of its contents were intact as well.

If we can replicate it we can hopefully figure out why that might have happened.

jrs65 commented 9 years ago

Yes, unfortunately it might be one of those bugs that is hard to reproduce. I just managed to recover my note from the serialized state in ~/.atom/storage/, so I can have spend a few minutes trying to reproduce it.

jonmagic commented 9 years ago

I just managed to recover my note from the serialized state in ~/.atom/storage/

Nifty! I had no idea that was possible :zap:

jrs65 commented 9 years ago

Actually, just downgrading to 0.1.0 (using apm) seems to have wiped out the note.

jonmagic commented 9 years ago

Actually, just downgrading to 0.1.0 (using apm) seems to have wiped out the note.

Can you list more details about your system, OS & version, apm -v output, etc? Is your notes folder inside your home directory?

jrs65 commented 9 years ago

And repeating the upgrade has wiped it out again.

Indeed I can give you more details (apologies, should have put them in earlier). I'm on OS X 10.10.5, atom version 1.0.11, apm -v output:

$ apm -v
apm  1.0.4
npm  2.13.3
node 0.10.40
python 2.7.8
git 2.3.2

Probably the most pertinent information is that I left the notebook directory as the default location ~/.atom/packages/notational-velocity/notebook. I imagine it shouldn't wipe out notes from there, but I'll probably move my notes directory out of the .atom tree where I imagine they should be a little safer.

Recovering the note was a combination of a guess, grep and some luck :)

jonmagic commented 9 years ago

Probably the most pertinent information is that I left the notebook directory as the default location ~/.atom/packages/notational-velocity/notebook. I imagine it shouldn't wipe out notes from there, but I'll probably move my notes directory out of the .atom tree where I imagine they should be a little safer.

Oh interesting, I bet it's this. I wonder if the entire package directory gets replaced on upgrade? might be safer to make the default something like ~/.atom/notational-velocity-notes

jonmagic commented 9 years ago

Oh interesting, I bet it's this. I wonder if the entire package directory gets replaced on upgrade? might be safer to make the default something like ~/.atom/notational-velocity-notes

On initialize it will need to check if the notes dir is the default and if it is create the directory if it doesn't already exist and copy the default notes to the new directory.

seongjaelee commented 9 years ago

Oh... this is a terrible, terrible bug...

On initialize it will need to check if the notes dir is the default and if it is create the directory if it doesn't already exist and copy the default notes to the new directory.

I can do this, but I guess there is no way that we can prevent somebody losing their notes after upgrade for v0.1.0...?

seongjaelee commented 9 years ago

If someone have any idea preventing the default note directory overwrite upon version update, please let me know. Thanks!

jonmagic commented 9 years ago

If someone have any idea preventing the default note directory overwrite upon version update, please let me know. Thanks!

One idea I had was to apm unpublish notational-velocity@0.2.0, then change the project name to something like nvatom, kind of like nvalt (which I always used instead of Notational Velocity before I found your atom package).

Add an obvious big headline to the notational-velocity package readme that points people to the new package and explains why you're doing the rename. Also mention that removing the plugin may remove their notes, so they should install the new nvatom package first to make sure their notes make it into a safe place.

Have the first version of the new nvatom package handle all of the notes directory stuff, including porting notes over from an old notational-velocity package.

seongjaelee commented 9 years ago

Thanks for the suggestion. Unpublished it. I'll do the rest later this week. Thanks!

jrs65 commented 9 years ago

Great! Glad you've figured out a path forward.

BTW, thanks for putting the package together! I've been really enjoying using it.

seongjaelee commented 9 years ago

Thanks! nvatom is now published.

https://github.com/seongjaelee/notational-velocity/commit/8384b81a04e3fa251b00e36fdb05fa4053b7d135 https://atom.io/packages/nvatom