Skip to content

fix: fail closed on USDT0 banner dismissal lookup, announce the dialog - #2999

Merged
CassioMG merged 1 commit into
masterfrom
fix/usdt0-banner-fail-closed
Sep 3, 2026
Merged

fix: fail closed on USDT0 banner dismissal lookup, announce the dialog#2999
CassioMG merged 1 commit into
masterfrom
fix/usdt0-banner-fail-closed

Conversation

@CassioMG

@CassioMG CassioMG commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Follow-up to #2990, which merged before its last review comments were addressed. Three small fixes to the USDT0 launch banner:

  • A failed "was this dismissed?" lookup was treated as "not dismissed", so a transient messaging failure could re-show the promo to someone who had already dismissed it. It now fails closed — the same call the Discover welcome modal already makes deliberately.
  • The dismissal write re-read the value it had just written, which only added a second failure point that could report a successful dismissal as failed.
  • The banner's launch button now tells assistive tech that it opens a dialog.

No user-visible change in the normal path.

Implementation details (for agents)

Fail closed on unknown dismissal state (@shared/api/internal.ts, Usdt0LaunchBanner/index.tsx): getUsdt0LaunchBannerDismissed now throws on a structured error instead of returning false, matching getHasSeenDiscoverWelcome; the component's catch sets isDismissed to true and keeps reporting to Sentry, with the same rationale comment useDiscoverWelcome.ts carries. That leaves one place deciding the default, so the helper's branch can't later disagree with the catch. Note the helper's if (error) branch is latent today — popupMessageListener returns { isDismissed } and never a structured { error } — so the live path this fixes is the component's catch when localStore.getItem rejects inside the handler and the rejection propagates out through browser.runtime.sendMessage.

Drop the read-back (handlers/dismissUsdt0LaunchBanner.ts): return { isDismissed: true } immediately after setItem, as dismissDiscoverWelcome does. Previously a successful write followed by a failed read reported false, leaving the banner up for that popup session even though the dismissal had persisted.

Dialog semantics (Usdt0LaunchBanner/index.tsx): aria-haspopup="dialog" + aria-expanded={isSheetOpen} on the launch button. The sheet is opened by local state and its Radix Root is a sibling of the button, so SheetTrigger can't reach it — the same constraint as AddCollectibles/index.tsx:212-226, whose comment and attribute pair this mirrors. aria-controls is omitted because the dialog id is generated inside the portal.

Verification: yarn build:extension clean; yarn test:ci 1772 passed, 1 failed — the failure is remoteConfig.test.ts "defaults use_balances_v2 to true", caused by an unrelated local working-tree edit, not by this change and not part of this PR.

Backport: the same three fixes are applied to #2997 (the v5.48.0 backport of #2990).

🤖 Generated with Claude Code

Addresses the review comments left on #2990 after it merged.

A failed dismissal lookup resolved to "not dismissed", so a transient
messaging failure re-showed the promo to someone who had already
dismissed it. Propagate the error from the shared helper (matching
getHasSeenDiscoverWelcome) and let the component's catch make the
fail-closed choice, as useDiscoverWelcome already documents.

Also drop the redundant read-back after the dismissal write — the
analogous dismissDiscoverWelcome handler returns true straight after
setItem, and re-reading only adds a second failure point — and mark the
banner's launch button with aria-haspopup/aria-expanded so assistive
tech announces that it opens a dialog, mirroring AddCollectibles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 2, 2026 23:48
CassioMG added a commit that referenced this pull request Sep 2, 2026
Backport of #2999 onto the v5.48.0 release branch, addressing the review
comments left on #2990 after it merged. The three touched files match
the master-based fix branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes the USDT0 promotion fail closed on dismissal lookup errors and improves dialog accessibility.

Changes:

  • Hides the banner when dismissal lookup fails.
  • Removes the redundant post-write read.
  • Announces the launch sheet as a dialog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
@shared/api/internal.ts Propagates structured lookup errors.
dismissUsdt0LaunchBanner.ts Returns success after storage completes.
Usdt0LaunchBanner/index.tsx Fails closed and adds dialog ARIA state.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-295b5792cd8c177f0063
Backend: V1 prod + V2 beta (no sandbox configured for @CassioMG). SDF collaborators only — install instructions in the release description.

CassioMG added a commit that referenced this pull request Sep 3, 2026
…rt) (#2997)

* feat: add USDT0 launch banner and promo sheet to Home (v5.48.0)

Backport of #2990 onto the v5.48.0 release branch so the promo can ship
with that release. Applied as a single squashed commit; the tree for the
17 touched files is identical to the master-based branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: fail closed on USDT0 banner dismissal lookup, announce the dialog

Backport of #2999 onto the v5.48.0 release branch, addressing the review
comments left on #2990 after it merged. The three touched files match
the master-based fix branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@CassioMG
CassioMG merged commit 1b408a3 into master Sep 3, 2026
12 checks passed
@CassioMG
CassioMG deleted the fix/usdt0-banner-fail-closed branch September 3, 2026 00:02
CassioMG added a commit that referenced this pull request Sep 3, 2026
* v5.48.0

* fix(icons): show USDT0's icon, for new and existing users (v5.48.0) (#2998)

Backport of #2994 onto the v5.48.0 release branch. Cherry-picked from
bbcd41d; the four touched files are byte-identical to master.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* feat: add USDT0 launch banner and promo sheet to Home (v5.48.0 backport) (#2997)

* feat: add USDT0 launch banner and promo sheet to Home (v5.48.0)

Backport of #2990 onto the v5.48.0 release branch so the promo can ship
with that release. Applied as a single squashed commit; the tree for the
17 touched files is identical to the master-based branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: fail closed on USDT0 banner dismissal lookup, announce the dialog

Backport of #2999 onto the v5.48.0 release branch, addressing the review
comments left on #2990 after it merged. The three touched files match
the master-based fix branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cássio Marcos Goulart <3228151+CassioMG@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <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.

2 participants