Skip to content
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

Detect inconsistent initial steps in yjs and require page reload #5724

Open
5 tasks
max-nextcloud opened this issue Apr 23, 2024 · 0 comments
Open
5 tasks
Assignees
Labels
enhancement New feature or request

Comments

@max-nextcloud
Copy link
Collaborator

max-nextcloud commented Apr 23, 2024

Is your feature request related to a problem? Please describe.
In case two users start a new yjs session at the same time they need to initialize it with the initial ydoc content to create a consistent world view. #5589 tackles this. If for some reason the two clients come up with a different initial doc state we end up with a "split brain" situation - where both work on a similar yet different document and fail to sync fully.

Planned solution

  • Push the doc state as soon as we have it to reduce the timespan in which conflicts may occure.
    • Use a new endpoint to save the document state only without the autosave content.
    • Use a separate wrapper in the SessionApi on the client side.
    • Store documentState but no autosaveContent to avoid writing unchanged documents.
  • In case a conflicting documentState already exist:
    • Log the information this happened.
    • On the client handle the error response with an appropriate message and ask the user to reload the page.
  • backport to stable28 - as that's how far Always initialize with the same yjs document if no state is present #5589 was backported.

Tasks

  • New API endpoint that only stores the initial document state.
  • Wrapper in SessionApi for that endpoint.
  • Test the API endpoint from cypress api tests.
  • Send the initial document state to the server as soon as we have it.
  • Handle errors on the client side.

Acceptance Criteria

  • If one client connects a following client will receive an initial yjs document state shortly after (< 5sec.)
  • If two clients connect within the same timeframe and the initial yjs document state matches they continue without interruption.
  • If two clients connect within the same timeframe and the initial yjs document state differs one gets to continue - the other one displays an error message that instructs the user to reload the page.

Open questions

  • Does this interfere in somehow with
    • read only sessions
    • reconnecting
    • reconnecting after a session cleanup
@max-nextcloud max-nextcloud added the enhancement New feature or request label Apr 23, 2024
@max-nextcloud max-nextcloud self-assigned this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🏗️ In progress
Development

No branches or pull requests

1 participant