fission
fission copied to clipboard
Server WNFS Conflict Detection
NB: Feature requests will only be considered if they solve a pain
Summary
Problem
Updates may drop data:
- Dropping history (overwriting revisions)
- Forgetting files in the latest generation when reconciling with new data
There is a client-side conflict resolution portion of this, which must be shipped first: https://github.com/fission-suite/webnative/issues/163
Impact
Losing files is a terrible experience
Solution
Enforce that data is persistent, and can only be accreted, not overwritten (unless the UCAN is set as SUPER_USER
).
This is a simplified version of what the front-end does (spec). The server needs to check that the incoming changes do not overwrite existing data, and if it does diverge, refuse the update.
On update, make sure that the new version strictly contains the public and private sides On collision, reject with all of the following:
- HTTP 428
- The latest "head" CID (i.e. existing DNSLink)
- The divergent CIDs (one public & potentially many private)
428 Precondition Required (RFC 6585) The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.[59]