Skip to content

fix(storage): keep connection metadata and secrets consistent on OS store failures (#276) - #286

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/276-local-db-secrets-atomicity
Jul 10, 2026
Merged

fix(storage): keep connection metadata and secrets consistent on OS store failures (#276)#286
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/276-local-db-secrets-atomicity

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Fixes #276. Connection metadata in SQLite and secrets in the OS secure store were updated sequentially without rollback, so a Keychain/libsecret failure could leave undeletable connections or desynced passwords.

Changes

  • removeConnection always deletes the SQLite row even if ConnectionSecretsStore.deleteForConnection fails.
  • addConnection rolls back the SQLite insert (and cleans up any partial secrets) when the secure-store write fails.
  • updateConnection restores the previous SQLite row and previous secrets when the secure-store write fails, then rethrows.
  • Added failNextWrite / failNextDelete hooks on the in-memory secrets backend and unit tests for the failure paths.

Test plan

  • flutter test test/core/storage/local_db_secrets_test.dart passes

Closes

Closes #276

…tore failures (#276)

- removeConnection always deletes the SQLite row even if secure-store
  delete fails (e.g. missing key or unavailable libsecret).
- addConnection rolls back the SQLite insert (and any partial secrets)
  when writing to the OS secure store fails.
- updateConnection restores the previous SQLite row and previous secrets
  when a secure-store write fails, then rethrows the original error.
- Extend the in-memory secrets backend with failNextWrite/failNextDelete
  hooks and cover the failure paths with unit tests.
@github-actions github-actions Bot added bug Something isn't working core Core library logic and services labels Jul 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit ecd2f36 into dev Jul 10, 2026
4 checks passed
@ZhuchkaTriplesix ZhuchkaTriplesix self-assigned this Jul 12, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/276-local-db-secrets-atomicity branch July 26, 2026 14:39
ZhuchkaTriplesix added a commit that referenced this pull request Jul 27, 2026
…micity

fix(storage): keep connection metadata and secrets consistent on OS store failures (#276)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core Core library logic and services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant