Skip to content

fix(nut17): decode notifications with subscription kind - #2198

Merged
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:nut17_notification
Jul 9, 2026
Merged

fix(nut17): decode notifications with subscription kind#2198
thesimplekid merged 1 commit into
cashubtc:mainfrom
thesimplekid:nut17_notification

Conversation

@thesimplekid

Copy link
Copy Markdown
Collaborator

NUT-17 notification payloads are ambiguous without the subscription kind, since quote response shapes overlap and tolerate unknown fields. Add a kind-aware payload decoder and use it in the wallet subscription client while keeping websocket payloads as raw JSON until the subId can be mapped back to its kind.

This prevents onchain and custom quote notifications from being decoded as the wrong payload variant.

Description


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

  • I followed the code style guidelines
  • I ran just quick-check before committing
  • If the Wallet API was modified (added/removed/changed), I have reflected those changes in the FFI bindings (crates/cdk-ffi)

@github-project-automation github-project-automation Bot moved this to Backlog in CDK Jul 4, 2026
@thesimplekid

Copy link
Copy Markdown
Collaborator Author

@cdk-bot review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.28%. Comparing base (c86a244) to head (dd74c9a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/cashu/src/nuts/nut17/ws.rs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2198      +/-   ##
==========================================
+ Coverage   73.20%   73.28%   +0.07%     
==========================================
  Files         359      359              
  Lines       79996    79976      -20     
==========================================
+ Hits        58558    58607      +49     
+ Misses      21438    21369      -69     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thesimplekid
thesimplekid requested a review from crodas July 4, 2026 14:44
crodas
crodas previously approved these changes Jul 4, 2026
@thesimplekid

thesimplekid commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

@thesimplekid

Copy link
Copy Markdown
Collaborator Author

@cdk-bot review

@thesimplekid
thesimplekid force-pushed the nut17_notification branch 3 times, most recently from b172e6e to acdb8aa Compare July 7, 2026 21:09
@thesimplekid

thesimplekid commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

@thesimplekid thesimplekid added this to the 0.18.0 milestone Jul 7, 2026
@thesimplekid
thesimplekid force-pushed the nut17_notification branch 2 times, most recently from 81e0708 to 8d66175 Compare July 8, 2026 10:10
Notification payloads are not self-describing. Keep websocket
notification payloads as raw JSON until callers can decode them with
subscription-kind context.

Expose raw websocket message aliases and make context-free
NotificationPayload and WsMessageOrResponse deserialization unavailable
to avoid silently selecting the wrong quote payload variant.

BREAKING CHANGE: NotificationPayload and WsMessageOrResponse no longer
deserialize notification payloads without subscription-kind context.
@thesimplekid
thesimplekid merged commit dd74c9a into cashubtc:main Jul 9, 2026
3 of 4 checks passed
@thesimplekid
thesimplekid deleted the nut17_notification branch July 9, 2026 08:10
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CDK Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants