Skip to content

fix(notifications): click payload in wire shape, no legacy context - #58

Merged
pavlo-flamingo merged 1 commit into
mainfrom
fix/notification-click-payload-in-wire-shape
Sep 14, 2026
Merged

pavlo-flamingo merged 1 commit into
mainfrom
fix/notification-click-payload-in-wire-shape

Conversation

@pavlo-flamingo

Copy link
Copy Markdown
Contributor

Problem

The shell projects an envelope's routing fields into a { context: { type, ticketId, dialogId, approvalRequestId } } click payload, read field by field from the type + attributes pair with a fallback onto the typed context union. The backend has retired that union, and the frontend's resolveNatsNotificationRoute (flamingo-stack/openframe-oss-frontend#404) now reads type + attributes only — a { context } payload resolves to nothing, so every OS-toast click would land on the notifications page instead of the ticket or dialog.

Fix

  • click_payload emits the envelope narrowed to its routing fields, in the envelope's own shape: top-level type plus attributes with ticketId, dialogId, approvalRequestId. The legacy context on an envelope is ignored.
  • notification_actions reads the same shape: approval_request_id / dialog_id off type + attributes.*; APPROVAL_TYPES is the catalog pair (TICKET_APPROVAL_REQUEST, MINGO_APPROVAL_REQUEST), ADMIN_APPROVAL_REQUEST is gone; note_resolution takes the envelope's attributes only.
  • Windows transports carry the payload as payload= (activation URI, button arguments) instead of context=; payload_from_context_json becomes payload_from_json. macOS userInfo already carried the payload verbatim.
  • Tests rewritten for the single shape, plus a_legacy_context_on_the_envelope_is_ignored and ids_outside_attributes_earn_no_buttons. Docs updated.

Caveats

  • Lockstep with the frontend: this shell must be released with a bundle that includes openframe-oss-frontend#404. An older bundle reads context off the click payload and will not route from a toast; a newer bundle with an older shell has the same problem the other way round.
  • A Windows toast left in the Action Center by a previous build carries context=, which this build no longer parses: clicking it opens the window without navigating. Transient.

Verification

  • cargo test: 80 passed (Windows toast codec paths are compiled under the macOS test cfg).
  • cargo clippy --all-targets -- -D warnings and cargo fmt --all -- --check clean.
  • Not exercised on a real macOS or Windows toast.

The shell projected an envelope's routing fields into a `{ context: {…} }`
click payload, read field by field from the `type` + `attributes` pair with a
fallback onto the typed `context` the backend no longer writes. The frontend's
`resolveNatsNotificationRoute` now reads `type` + `attributes` only, so a
`{ context }` payload resolved to nothing and every OS-toast click would land
on the notifications page.

The click payload is now the envelope narrowed to its routing fields, in the
envelope's own shape: top-level `type` plus `attributes` with `ticketId`,
`dialogId` and `approvalRequestId`. The action buttons read the same shape,
and `note_resolution` takes the envelope's `attributes` only. The Windows
activation URI and the button arguments carry the payload as `payload=`
instead of `context=`; a toast left in the Action Center by a previous build
opens the window without navigating.
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

🦩 Flamingo Code Review

2 finding(s) — 0 action required · 2 recommended · 0 informational

Mode: advisory · 2 defect(s) outside any rule

Inline comments: 2 new


Need another pass? Commits pushed after this review are not reviewed automatically.

  • Review the new commits — the commits added since this review
  • Review the whole diff again — ignoring what was already reviewed

Prefer typing? Comment @flamingo-review, or @flamingo-review full. To review every push on this pull request, add the flamingo-review-always label.

React 👍/👎 on inline comments to teach the reviewer.

Started 2026-09-14 18:29 UTC · updated 2026-09-14 18:29 UTC · workflow run

Comment thread src-tauri/src/notifications.rs
Comment thread src-tauri/src/notifications.rs
@pavlo-flamingo
pavlo-flamingo merged commit 6e3285f into main Sep 14, 2026
8 checks passed
@pavlo-flamingo
pavlo-flamingo deleted the fix/notification-click-payload-in-wire-shape branch September 14, 2026 18:51
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.

2 participants