Skip to content

Roll back failed addAccount writes and seed ephemeral account row - #16

Merged
alessioc42 merged 2 commits into
mainfrom
fix/atomic-add-account-and-ephemeral-fk
Nov 22, 2026
Merged

alessioc42 merged 2 commits into
mainfrom
fix/atomic-add-account-and-ephemeral-fk

Conversation

@alessioc42

Copy link
Copy Markdown
Member
  • LanisDatabase.addAccount: If secretStore.write(...) or the follow-up UPDATE fails, delete the newly inserted accounts row directly in SQLite (with best-effort secret cleanup) before rethrowing so transient keychain/keystore failures do not leave an orphan row that permanently blocks re-adding the account.
  • EasyLanisClient.ephemeral: Seed a backing row in the private in-memory accounts table via LanisDatabase.insertEphemeralAccount(...) (without persisting the password) so structured cache writes, account settings, and legacy offline-data writes satisfy SQLite foreign keys while accounts.list() continues returning [].
  • Tests: Add rollback tests in test/database_test.dart and ephemeral cache/settings/offline-data tests in test/easy_lanis_client_test.dart.

@alessioc42
alessioc42 marked this pull request as ready for review November 22, 2026 20:12
@alessioc42
alessioc42 merged commit df56398 into main Nov 22, 2026
2 checks passed
@alessioc42
alessioc42 deleted the fix/atomic-add-account-and-ephemeral-fk branch November 22, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant