Skip to content

feat: scoping algorithm#446

Draft
joe0BAB wants to merge 1 commit into
mainfrom
fix/includes-check
Draft

feat: scoping algorithm#446
joe0BAB wants to merge 1 commit into
mainfrom
fix/includes-check

Conversation

@joe0BAB

@joe0BAB joe0BAB commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Benehiko added a commit that referenced this pull request Jun 24, 2026
The real-keyring tests added by this PR fail intermittently in CI with
"Cannot create an item in a locked collection" and a duplicate backlog
that never collapses. Both are the gnome-keyring relock race: the store
dials a fresh D-Bus connection per operation, and a prior op's closing
connection relocks the collection asynchronously — after the unlock but
before the call against the collection runs. IsLocked cannot guard it
because the state changes between the check and the call.

React to the authoritative signal instead. Add withRelockRetry, which
retries an operation with bounded exponential backoff when it fails with
the org.freedesktop.Secret.Error.IsLocked D-Bus error, re-unlocking each
attempt and aborting immediately if Unlock itself fails (e.g. a dismissed
prompt).

Wrap the lock-gated mutations with it:
- Save: the create-when-absent CreateItem, the in-place SetItemSecret,
  and the best-effort duplicate-collapse DeleteItem loop. The collapse
  delete stays best-effort but is now relock-aware: a swallowed locked
  error would otherwise leave the duplicates this feature exists to drain
  (issue #446).
- Delete: DeleteItem.
Reads (Get/Filter GetSecret) are equally race-prone but are left to the
dedicated relock-retry change (#560); this commit covers the write path
the new tests exercise.

Also make the tests' own direct-daemon helpers relock-aware, since they
talk to the daemon outside the store: seedRealDuplicates' CreateItem and
purgeRealItems' DeleteItem now go through withRelockRetry.

Tests: fake-backed TestKeychainSaveRetriesWhenCreateRelocks,
TestKeychainSaveRetriesWhenSetSecretRelocks,
TestKeychainSaveCollapseRetriesWhenDeleteRelocks and
TestKeychainSaveStopsRetryingAfterMaxRelocks. Verified green against real
gnome-keyring on the fedora-43 and ubuntu-24 CI harnesses; lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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