Skip to content

[LWM] feat(notifications): make prompt QA screen readable (LIVE-35955) - #21450

Draft
sarneijim wants to merge 4 commits into
developfrom
feat/notifications-LIVE-35955-prompt-qa-screen
Draft

[LWM] feat(notifications): make prompt QA screen readable (LIVE-35955)#21450
sarneijim wants to merge 4 commits into
developfrom
feat/notifications-LIVE-35955-prompt-qa-screen

Conversation

@sarneijim

@sarneijim sarneijim commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Problem: the LWM notifications prompt debug screen (Settings → Debug → Notifications prompt QA) could not be used by QA without an engineer. Field labels exposed implementation names (isOptIn, dismissedCount, the raw OS permission enum), feature flag params rendered as JSON, actions used engineer verbs, and the screen never stated whether the drawer would show or why.

Solution: the screen is reshaped after the Analytics consent QA screen, and every verdict is computed from notificationsPromptEngine rather than duplicating eligibility rules.

  • Headline card with a plain-English verdict (Show drawer, Skip, Blocked) and the reason behind it.
  • Scenarios tab with named presets grouped by expected outcome: first prompt, already opted in, too soon to ask again, eligible after action, inactive user. Applying a preset sets OS permission, notification settings, onboarding state and stored prompt history deterministically.
  • Inspect tab with human labels and status tags, raw values on a secondary line, including the resolved brazePushNotifications configuration.
  • In-place drawer preview: the drawer content was extracted into NotificationsPromptDrawerView, which the QA screen mounts in its own local drawer so previewing never touches production prompt state.
  • Reset all restores the state captured when the screen was opened and clears the feature flag override.
  • Force open is kept as a secondary action and labelled as a bypass of production rules.

Production behaviour is unchanged. The drawer scheduler is now shared through NotificationsPromptProvider (which also exposes cancelPendingDrawer) so the QA screen reuses the single scheduler instead of instantiating a second one, and skip reasons map to labels the same way analytics consent maps REASON_LABEL.

Before After
Drag & drop screenshot here Drag & drop screenshot here

🔗 Context

✅ Checks

  • pnpm --filter live-mobile exec jest src/screens/Settings/Debug/NotificationsPromptQA → 26 passed, including one case per QA scenario asserting the engine decision matches the advertised outcome.
  • pnpm --filter live-mobile exec oxlint on the changed paths → warnings only, all pre-existing.
  • Suites under src/mvvm/features/NotificationsPrompt that fail on @shared/i18n / @ledgerhq/live-common/families/hedera/... resolution fail the same way on develop (unbuilt workspace packages), unrelated to this change.

🧪 QA focus

  • Apply each scenario and confirm the headline verdict and reason match the scenario name.
  • Preview the drawer from the QA screen and confirm no production drawer is queued afterwards.
  • Trigger by source (onboarding, send, receive, swap, stake, add favourite coin) and inactivity, then confirm the production drawer still appears as before.
  • Reset all, then confirm the inspector returns to the values seen when the screen was opened.
  • Run through both iOS and Android debug builds.

Made with Cursor

sarneijim and others added 2 commits September 2, 2026 14:59
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 13:00
@live-github-bot live-github-bot Bot added the mobile Has changes in LLM label Sep 2, 2026
@live-github-bot live-github-bot Bot changed the title feat(notifications): make prompt QA screen readable (LIVE-35955) [LWM] feat(notifications): make prompt QA screen readable (LIVE-35955) Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ⏭️ Skipped

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.

🟡 Changes recommended

The QA screen introduces at least one misleading action label and an inspector raw-value mismatch that can confuse QA and should be corrected before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the Ledger Live Mobile Notifications Prompt QA/debug screen so QA can reliably understand and reproduce prompt eligibility outcomes (verdict + reason), apply deterministic scenarios, and preview the drawer UI without impacting production prompt state.

Changes:

  • Reworked the Notifications Prompt QA screen UI into “Scenarios” and “Inspect” tabs with plain-English verdicts and readable labels.
  • Added deterministic QA scenarios + utilities to map engine decisions to user-facing expectations and reason labels.
  • Extracted the drawer content into a reusable NotificationsPromptDrawerView and exposed scheduler controls (cancelPendingDrawer, etc.) via NotificationsPromptProvider so the QA screen can safely reuse the single scheduler.
File summaries
File Description
apps/ledger-live-mobile/src/screens/Settings/Debug/NotificationsPromptQA/utils.ts Adds QA scenario definitions, verdict/reason labeling, and helpers to map engine decisions to QA expectations.
apps/ledger-live-mobile/src/screens/Settings/Debug/NotificationsPromptQA/index.tsx Rebuilds the QA screen UX (verdict card, scenarios tab, inspect tab) and adds local drawer preview + reset/apply actions.
apps/ledger-live-mobile/src/screens/Settings/Debug/NotificationsPromptQA/tests/utils.test.ts Adds scenario-based tests ensuring engine outcomes match advertised QA expectations and labels remain readable.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/screens/NotificationsPromptDrawerView.tsx Extracts reusable drawer UI content so it can be mounted both in production and in the QA preview.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/screens/NotificationsPromptDrawer.tsx Refactors production drawer to render NotificationsPromptDrawerView.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/NotificationsPromptProvider.tsx Exposes scheduler functions (open/isPending/cancel) through the notifications prompt context.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/hooks/useNotificationsPromptTriggers.ts Plumbs cancelPendingDrawer (and scheduler helpers) up from the scheduler hook.
apps/ledger-live-mobile/src/mvvm/features/NotificationsPrompt/new/hooks/useNotificationsPromptDrawerScheduler.ts Adds cancelPendingDrawer and reuses it from openDrawer and the cleanup effect.
.changeset/notifications-prompt-qa-screen.md Adds a patch changeset describing the QA-screen improvements.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +701 to +703
<Button appearance="base" onPress={onForceOpenDrawer}>
Force open global drawer — bypass rules
</Button>
Comment on lines +755 to +760
field={{
label: "Drawer target",
value: resolvedPromptTarget,
raw: `dismissedCount: ${decision.dismissedCount}`,
status: { label: "Resolved", tone: "success" },
}}
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
desktop-main 2.5 MB - 0 -
desktop-preloader 7.1 KB - 0 -
desktop-renderer 82.4 MB - 0 -
desktop-webviewDappPreloader 36.9 KB - ❓ 0 -
desktop-webviewPreloader 200.0 B - 0 -
desktop-workers 36.8 KB - 0 -
mobile 129.5 MB - +41.2 KB (0.0%) -
📋 Detailed Reports (Click to expand)

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

📌 Baseline Commit: d80a0e0f653302623aa09406ab8ff0358546386b | PR: #21398

Metric Current Baseline Change
📊 Total Size 129.5 MB 129.5 MB +41.2 KB (0.0%)
🗜️ Gzip Size - - -
📄 JavaScript 114.0 MB 114.0 MB +41.2 KB (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 15.5 MB 15.5 MB 0

📦 Download Diff Report: mobile Bundle Diff

Generated by Rsdoctor GitHub Action

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings September 2, 2026 15:26

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.

🟡 Changes recommended

The new hook test suite mocks the feature-flag hook instead of exercising overrides via the feature-flags store, which conflicts with established repo testing patterns and should be aligned for consistency.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +67 to +69
jest.mock("@features/platform-feature-flags", () => ({
useFeature: () => qaState.brazePushNotifications,
}));
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sonar flagged 5.3% duplication on new code: the QA inspector row was a
verbatim copy of the Analytics Consent QA one, and the scenario list
repeated the same default user state five times. Both QA screens now use
a single QaInspectorRow component, and scenarios only spell out what
makes them different.

Tests drop the feature-flag hook mock in favour of the real store, so
overrides resolve through useFeature as they do in production, and render
the real Lumen and native-ui components instead of stand-ins.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings September 2, 2026 21:07

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.

🟡 Changes recommended

The new QA ViewModel can apply scenarios before the baseline snapshot is captured (permission status starts undefined), which can make “Reset all” restore the wrong state.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +154 to +156
(scenario: NotificationsQaScenario) => {
const now = Date.now();
const userData = buildNotificationsQaScenarioUserData(scenario, {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants