-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for manually manipulated DB #410
Comments
I will try to write the tests. |
Currently I have no idea, where i can start. |
It may be good to familiarize yourself with the data model, if you haven't already: https://gothenburgbitfactory.org/taskchampion/ The key is the "Replica Invariant". TaskChampion itself maintains that invariant, but users mucking about manually in The taskdb layer is defined in I see that both of those functions have some interesting error handling. For example: taskchampion/taskchampion/src/taskdb/apply.rs Lines 80 to 84 in c9cbcd0
If a user has used There are integration-style tests such as update-and-delete-sync.rs. These take a bit longer to run, but are a good way to test end-to-end functionality (everything from the storage layer through the taskdb to the Replica type). So, I'd say the overall to-do list for this issue is:
A good place to start is to identify one way the user might violate the invariant, and write a test for that. Let's start with an integration test (maybe in a new |
@koleesch how is this going? |
BTW the invariant mentioned in the first comment is here |
In GothenburgBitFactory/taskwarrior#3530 @snaka224 mentioned they edited the DB. They probably aren't the first or only person to do so!
The result is a "corrupted" DB in the sense that an invariant is invalidated: the cumulative effects of the ops in the
operations
table are not the same as thetasks
table.Let's add some tests for that circumstance to ensure that at least the "blast radius" of this corruption is limited.
This would be a good first task since it just requires writing some tests. If bugs are found, we can file and fix those separately. The resulting tests are probably a mix of unit-style tests (such as for
apply
when an Update operation is applied to a task that has been deleted) and integration tests (for things that involve runningsync
). There are already some example integration tests intaskchampion/tests
.The text was updated successfully, but these errors were encountered: