First pass at regression test and fix for SoUD FacilityUser sync conflict #8438
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In Morango, when a model is modified on both sides, it results in a merge conflict, and one copy of the data wins (and the serialized copy of the one that didn't win is stored in case the app wants to resolve the conflict later).
We don't allow FacilityUsers to be synced back across a single-user connection -- they can only be read. That's why we don't allow users to edit their profile on a SoUD -- but that doesn't stop some backend machinery from still writing to the FacilityUser on a SoUD. In particular, we saw a case with Django writing to the
last_login
field on theFacilityUser
that made it "dirty", and then when afull_name
change was synced in from a full-facility device, it conflicted, and the tablet's copy won, so the data with the updatedfull_name
was relegated to theconflicting_serialized_data
field in the Store.This PR
preventsattempts to prevent changes made to a FacilityUser on a SoUD from causing a conflict with incoming changes. The regression tests work as intended, but my hook doesn't currently seem to be getting picked up, so the tests are still failing. Ideas welcome around what I may be missing.Reviewer guidance
I'm running the tests with:
and
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)