Skip to content

fix: include exception detail in shared-key decrypt error#525

Merged
cconstab merged 2 commits into
trunkfrom
fix/decrypt-error-detail
Jul 3, 2026
Merged

fix: include exception detail in shared-key decrypt error#525
cconstab merged 2 commits into
trunkfrom
fix/decrypt-error-detail

Conversation

@cconstab

@cconstab cconstab commented Jul 2, 2026

Copy link
Copy Markdown
Member

In at_client/atclient.py, get_encryption_key_shared_by_me() raised:

raise AtDecryptionException(f"Failed to decrypt {to_lookup} - e")

The e is a literal character, not the interpolated exception, so shared-key decrypt
failures printed ... - e with no detail — making the underlying problem impossible
to diagnose. The sibling handlers (same file, ~L169 and ~L310) correctly use {e}.

Fix: interpolate the exception (- {e}).

Tests: test/decrypt_error_test.py — network-free; forces a decrypt failure via a
mocked connection and asserts the raised message includes the real exception (not the
literal e).

Small, isolated, and unblocks diagnosis of an intermittent "Failed to decrypt
shared_key…" seen on long-lived clients.

get_encryption_key_shared_by_me raised AtDecryptionException with the literal
string 'e' instead of the interpolated {e}, so the actual decryption error was
hidden (messages read '... - e'). Interpolate the exception like the sibling
handlers do.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an error-message formatting bug in AtClient.get_encryption_key_shared_by_me() where decrypt failures appended the literal e instead of the caught exception, improving diagnostics for shared-key decrypt issues.

Changes:

  • Interpolate the caught exception in the shared-key decrypt failure message (- {e}).
  • Add a network-free unit test to exercise the decrypt-failure path and validate the error message.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
at_client/atclient.py Fixes the decrypt failure message to include the real exception detail.
test/decrypt_error_test.py Adds a unit test covering the shared-key decrypt error-message formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/decrypt_error_test.py
@cconstab cconstab requested a review from cpswan July 3, 2026 02:56
@cconstab cconstab merged commit 1e625ec into trunk Jul 3, 2026
15 of 19 checks passed
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.

3 participants