fix: detect shared-key notifications (call to_string())#524
Merged
Conversation
The monitor classified notifications with str(self.atsign.to_string) — the bound method, not its result — so the prefix never matched and SHARED_KEY_NOTIFICATION was never emitted; shared-key notifications were mis-typed as UPDATE. Extract the check into a testable _is_shared_key_notification() helper that calls to_string(), matching the correct usage elsewhere in the file. Adds network-free unit tests for both branches.
cpswan
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
at_client/connections/atmonitorconnection.pythe monitor classified incomingnotifications with:
self.atsign.to_stringis a bound method, sostr(...)of it is a method repr(e.g.
<bound method AtSign.to_string of ...>) that never prefixes a real key. As aresult
SHARED_KEY_NOTIFICATIONwas never emitted and shared-key notifications weremis-typed as ordinary
UPDATE_NOTIFICATIONs. (Line 124 in the same file correctlyuses
to_string(), so this is an isolated missing-parentheses bug.)Consequence: the client never caches incoming shared keys via the notification path
and always falls back to lookup-on-demand — which contributes to first-contact decrypt
failures.
Fix: extract the check into a testable static helper
_is_shared_key_notification(atsign, key)that callsto_string().Tests:
test/monitor_shared_key_test.py— network-free, both branches(shared-key key vs. regular update key).