Another account on the same install starts empty; two vault writes no longer crash #188

Merged
paulhitt merged 2 commits from fix/account-switch-and-vault-race into main 2026-10-09 19:30:36 +00:00
paulhitt commented 2026-10-09 18:28:28 +00:00 (Migrated from gitlab.com)

Two Android fixes found on the iPhone-to-Android pair against a local relay (2026-10-09), both on main today.

  • Another account on the same install inherited the vault. A plain sign-out keeps the vault so the same person can sign back in. A different account then got a new device identity (android#22) and every other record: it saw the previous account's conversations and sent its first message on the previous account's ratchet session, which the far end could not open. AccountSwitch.forgetPreviousAccountIfSwitching empties the vault when another user id or relay signs in, before its device is made. The same account keeps everything.
  • Two writes of one vault record killed the app. Draft saves ran per keystroke on the IO pool and staged into one <name>.tmp; the second rename found nothing and threw on a worker thread. Each write now stages under its own name, and draft saves run one at a time, in order.

Tests first: AnotherAccountStartsWithNothingTest (2 red, then 4/4) and TwoWritesOfOneRecordDoNotCrashTest (400 writes from 8 threads, red, then green).

Local suites on 8842479 (vectors at the pinned be8093f): engine 723, client 480 (30 live tests skipped, no relay), obfs4 75, app debug 381, app release 340, 0 failures.

Not a release: no APK publish.

🤖 Generated with Claude Code

Two Android fixes found on the iPhone-to-Android pair against a local relay (2026-10-09), both on main today. - **Another account on the same install inherited the vault.** A plain sign-out keeps the vault so the same person can sign back in. A different account then got a new device identity (android#22) and every other record: it saw the previous account's conversations and sent its first message on the previous account's ratchet session, which the far end could not open. `AccountSwitch.forgetPreviousAccountIfSwitching` empties the vault when another user id or relay signs in, before its device is made. The same account keeps everything. - **Two writes of one vault record killed the app.** Draft saves ran per keystroke on the IO pool and staged into one `<name>.tmp`; the second rename found nothing and threw on a worker thread. Each write now stages under its own name, and draft saves run one at a time, in order. Tests first: AnotherAccountStartsWithNothingTest (2 red, then 4/4) and TwoWritesOfOneRecordDoNotCrashTest (400 writes from 8 threads, red, then green). Local suites on 8842479 (vectors at the pinned be8093f): engine 723, client 480 (30 live tests skipped, no relay), obfs4 75, app debug 381, app release 340, 0 failures. Not a release: no APK publish. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
paulhitt commented 2026-10-09 19:16:47 +00:00 (Migrated from gitlab.com)

mentioned in merge request !162

mentioned in merge request !162
paulhitt commented 2026-10-09 19:30:37 +00:00 (Migrated from gitlab.com)

mentioned in commit ba9a94a85f

mentioned in commit ba9a94a85f5a545605014542f5bd40c9641c88a0
paulhitt (Migrated from gitlab.com) merged commit ba9a94a85f into main 2026-10-09 19:30:37 +00:00
paulhitt commented 2026-10-09 19:30:57 +00:00 (Migrated from gitlab.com)

mentioned in commit 6eb6b77329

mentioned in commit 6eb6b77329a452d60be13d6b18f6f55e983635fc
Sign in to join this conversation.