Sync to file issues

I’ve found myself going crazy over the last several months, finding chunks of my code missing or changes reverted in my main dev branch of a large project I’m working on. Fortunately, I’ve been pretty good with git, and its saved my ass to be able to comb through old commits to find where my stuff got corrupted, but why escaped me for a long time.

I think today i finally figured it out; I have an external effects system that I use to load post processing, and it shares extensions in an externalized preset system with other parts of my code. I realized that anytime I loaded an old tox this way, it was overwriting my externalized newer version of synced files, and corrupting my version history.

I’m not sure how to go about permanenly solving this issue; I’ve traced through all my external toxes i use in this regard and updated them individually, but I’m terrified that loading an older file might break a newer code base that has externalities, and am wondering what might need to be rethunk about sync to file to avoid this kind of thing from happening

My first feeling is, if you modularize your project into toxes, these toxes should be self contained, and certainly not have sync to file enabled to other versions of sourcecode which is currently already in use in your system! They can have sync to file (as sourcecode is nice to have in git) but then each file should be unique to that tox.

So perhaps a safer way for you is if you maintain the main extension in your .toe file (with sync to file), and then give each tox its own unique extension (named something like extension-toxfilename) which can have also sync to file, but each tox extension inherits from your main and most up2date extension. That way you can reuse the latest&greatest extension code in each tox, but are still able to add your own code to each tox, and you only need to maintain code in one location.

See some inheritance examples here, but there’s probably better documentation out there:

1 Like

this is not dissimilar to my workflow; I keep a clone master in my session, with file synced to disk, and the extension lives in each tox, also synced to disk. I guess I would imagine the expected behavior to be when loading an old version, it either gets the file from disk, or the code from the clone master, and not overwrite the file on the disk with an older version.

While I’m totally open to having spend years building a workflow that might not be best practice, i feel like this expected behavior is how it should function, am I mistaken?