GothenburgBitFactory / GothenburgBitFactory/taskchampion

Make `commit_reversed_operations` more capable.

Open
#427 0 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Rust
Stars
184
Forks
41
Avg merge
1d 1h
Merged PRs (30d)
7

Description

Right now, this method (known as `commit_undo_ops` before #372) just checks that the latest set of un-synchronized operations in the replica match the operations to undo. If that's the case, it removes them from the list of un-synchronized operations, reverses their effect on the tasks, and declares success. Otherwise, it fails.

This could be more robust -- if an operation does not precisely match the most recently recorded local operation, there's enough data to create a _new_, reversed operation (switch Create <--> Delete, swap `value` and `old_value` in Update) and commit that. Adding such support would be a big step on the way to allowing "undo" _after_ a sync has occurred.

I think we should fail the `commit_reversed_operations` if the reversed operation doesn't apply cleanly. So:
- A reversed Create is a Delete, but if the task doesn't exist, that should fail.
- A reversed Delete is a Create, but if the task still exists, that should fail.
- A reversed Update specifies the `old_value` it expects to find, but if the value is different, it should fail.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.