Page MenuHomePhabricator

[web/native] make `overwrite` param for inbound session mandatory and unify web & native
ClosedPublic

Authored by kamil on Apr 9 2024, 4:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 9:58 AM
Unknown Object (File)
Sun, Nov 24, 9:03 AM
Unknown Object (File)
Sun, Nov 24, 6:05 AM
Unknown Object (File)
Sun, Nov 3, 8:47 AM
Unknown Object (File)
Oct 12 2024, 10:59 PM
Unknown Object (File)
Oct 12 2024, 10:59 PM
Unknown Object (File)
Oct 12 2024, 10:59 PM
Unknown Object (File)
Oct 12 2024, 10:59 PM
Subscribers

Details

Summary

When discovering the race condition we will need to sometimes overwrite the existing session. This diffs makes this param mandatory and unifies usage on native & web.

This changes the functionality of overwrite:

  • when there is no session - create it
  • when there is an existing session with a lower version - overwrite always
  • when there is an existing session with a higher version - throw an error
  • when there is an existing session with the same version - throw error (we allow JS to decide how to handle race condition
  • when there is an existing session and overwrite is set to true - create a new session (even is version is lower)

Depends on D11594

Test Plan

Tested in next diff in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
web/shared-worker/worker/worker-crypto.js
429–433

Should we be using olmSessionErrors here?

This revision is now accepted and ready to land.Apr 11 2024, 12:57 AM

use olmSessionErrors instead of hardcoded string

web/shared-worker/worker/worker-crypto.js
429–433

definitely we should, thanks for catching