double-push on CLIENT_WINS during incoming conflict
- Dominant language
- TypeScript
- Stars
- 330
- Forks
- 75
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 4
Description
When we get an incoming conflict using the CLIENT_WINS strategy, we "resolve" the conflict in pullChanges. We push this resolution during the first call to `pushChanges`. This means it has both `published` and `resolved` status after the first `pushChanges`. However, while it is `_status: "synced"` in `published`, it remains `_status: "updated"` in `resolved`. The [second call to pushChanges](https://github.com/Kinto/kinto.js/blob/master/src/collection.js#L1081-L1085) then pushes it a second time.
This doesn't cause any tests to fail because the second push has an `If-Match` header that matches the original conflict, which causes a `Precondition failed` response, which produces another conflict which is resolved again with CLIENT_WINS and deduplicated with the existing one in `resolved`.
Writing a test that demonstrates this behavior will probably be somewhat annoying, but this is tied to #555 so I didn't.
Contributor guide
Research direction
Start in src/collection.js around lines 1081-1085 and trace the first and second pushChanges calls for an incoming conflict using CLIENT_WINS. Inspect how published and resolved statuses change; done means the resolution is not pushed twice, with regression coverage for this conflict path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100