-
Notifications
You must be signed in to change notification settings - Fork 159
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
Update conflict logic for offline entities #698
Comments
Even if we can't figure out this part, I personally think it'd be an improvement from the status quo to mark these cases as soft conflicts, not even worrying about calculating the conflicting properties. As long as we mark an offline update that is not contiguous with its trunk version as a conflict, the properties it specified will appear in the conflict summary table. The update will appear as a conflict in the feed. All in all, the user will have a better understanding of what they need to review. |
I glanced through Frontend, and I didn't see anything that obviously needed to change. Mostly the code just looks at the
I may have missed something, but if so, hopefully we'll spot it while testing this issue. |
@getodk/testers, we still need to do some follow-up work related to this issue, so it's not quite ready for testing. I can let you know once that follow-up work is done. |
@matthew-white Hey what's the status with the follow-up work? |
I've filed an issue for that follow-up work: #805. We're not planning to work on that this week, but we'll take a look at it next week. |
@lognaturel wrote on Slack:
I'll go ahead and remove the "needs testing" label. |
Problem description
In #669, I thought that offline entities wouldn't requires us to change much (if anything) about the
conflict
property. Specifically, I thought:However, it's looking like that isn't the ideal behavior after all. Even if the current server version is the previous version from the branch, the update being processed may conflict with a separate update between the trunk version and the previous version. For example:
As things are currently implemented, v3 will be marked as a soft conflict because there was an update between it and its base version. However, v4 is not marked as a conflict because it immediately follows its base version (the previous version from the branch). There are a few issues that stem from the fact that v4 is not marked as a conflict:
allReceived
logic in theEntityConflictTable
component). If v4 is not marked as a conflict, then the only version that is a conflict is v3, and only the one property that v3 updated will be shown in the table. That means that the property that v2 and v4 updated will not be shown in the table. Upon seeing the conflict summary table, the user might double-check all the properties listed in the table. If we don't list the property that v2 and v4 updated, the user might not realize that it also warrants a double-check.Expected behavior
As I wrote on Slack:
In the example above, v3 is not contiguous with the trunk version (v1), because v2 is between the two. The same is true of v4. This rule would cause v4 to be marked as a conflict.
I think this is a good rule, though I am slightly concerned about the ramifications. I would guess that there are places in Backend and/or Frontend where we consider something a conflict if and only if it does not immediately follow its base version (
version !== baseVersion + 1
). If we implement the proposed rule, that logic won't be true anymore. If anything needs to change in this area about Frontend, I think I could do so quickly.I also wrote the following on Slack, but I no longer think that it's always true:
I do think this is true if the updates are processed in order. However, if an update is force-processed out of order, it may be a conflict even if an update that follows it is not a conflict. For example:
In this example, even though v3 and v4 are from the same branch, and v3 is a conflict, we do not expect v4 to be a conflict. v2, v3, and v4 are all contiguous with the trunk version (v1): there's no conflict with some interweaving update from another source, as in the first example above. To summarize: if the versions from an offline branch were force-processed out of order, then even if all the versions are contiguous with their trunk version, it may be the case that an earlier version from the branch is a conflict while a later version is not.
So when evaluating whether an offline update being processed is a conflict, I think the question should be, "Are there any versions after the trunk version that are from outside the branch?" The question should not be, "Was the previous version in the branch a conflict?"
In terms of figuring out whether the conflict is soft or hard (which properties are conflicting, if any), I'm not so sure about the logic. We can't just compare the offline update being processed against its trunk version, because if two updates from the same branch change the same property and are processed in the correct order, there should not be a conflict: in that case, everything happened in sequence, not in parallel. It's only if there was an update from outside the branch that changed the same property as an update from the branch that there should be a hard conflict, as in the first example above.
The text was updated successfully, but these errors were encountered: