Skip to content

fix: usdt over-50% warning names the usdt balance - #1644

Open
ovitrif wants to merge 3 commits into
masterfrom
fix/usdt-over-50-warning-copy
Open

ovitrif wants to merge 3 commits into
masterfrom
fix/usdt-over-50-warning-copy

Conversation

@ovitrif

@ovitrif ovitrif commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Twin: synonymdev/bitkit-ios#1069
Refs: synonymdev/bitkit-ios#1057

Description

  • Fixes the USDT send warning reading "over 50% of your total balance": the check compares the amount with the USDT balance only, so USDT sends now say "It appears you are sending over 50% of your USDT balance. Do you want to continue?".
  • Adds SanityWarning.OVER_HALF_USDT_BALANCE on a new key, wallet__send_dialog2_usdt, with translations in every locale; bitcoin sends keep OVER_HALF_BALANCE and wallet__send_dialog2 unchanged. The dialog keeps the SendDialog2 test tag, so E2E's handleOver50PercentAlert (tag plus "over 50%") still matches.
  • Writes the naming rule into AGENTS.md: rail-specific copy of a shared message gets its own key with the rail as suffix, so later rails follow the same pattern.
  • Adds the case to the manual USDT checklist in docs/usdt-qa.md, since a journey cannot reach it without a funded USDT wallet.
  • The warning keeps showing after the swipe, with Cancel to back out, as decided in bug: swipe to pay snaps back after the high-share warning on usdt sends bitkit-ios#1057 (comment); Android already keeps the knob completed while it shows.

Out of Scope

None.

Design

N/A — no design available.

Preview

The warning is forced open on the USDT screen with a local debug hook, since the check needs a funded USDT wallet; the dialog and its strings are the real ones. Status bar clock masked.

Before After

QA Notes

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • USDT send of more than half the USDT balance → swipe → dialog reads "…over 50% of your USDT balance…" — a funded USDT wallet (local USDT fixture) is not in Capabilities
  • Bitcoin send of more than half the total balance → dialog still reads "…over 50% of your total balance…" — regression check alongside the above

Automated Checks

  • added UsdtViewModelTest.kt — a USDT send over half the USDT balance raises the USDT balance warning

@ovitrif ovitrif added this to the 3.1.0 milestone Oct 21, 2026
@ovitrif ovitrif self-assigned this Oct 21, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T00:44:23.650087Z badffd6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: badffd6c11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src/main/res/values/strings.xml
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

USDT sends over half the USDT balance now name that balance instead of the total balance.

  • USDT sends over half the balance get a warning that names USDT.

No actionable issues found. Tests were inspected, not run.

Reviews (1) · Last reviewed commit: "fix: usdt over-50% warning names the usd..." · Reviewed by Greptile

@talosmachina talosmachina 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.

No findings. Gives USDT sends their own over-50% warning (OVER_HALF_USDT_BALANCE, wallet__send_dialog2_usdt) so the copy names the USDT balance the check actually compares against; bitcoin sends keep OVER_HALF_BALANCE. Reviewed 6b787de, full tier, reasoned from the code (an auto review of bitkit-android does not build the branch here; CI is the gate).

What I checked, and 4 candidates I ruled out

Read: UsdtViewModel.kt (warnings(), confirm(), acceptWarning()), SanityWarning in AppViewModel.kt, both renderers of UsdtSendState.warning (UsdtWalletScreen.kt, PaykitUsdtReview.kt), the new test.
Call sites traced: every SanityWarning.OVER_HALF_BALANCE use; all remaining ones are in the bitcoin send path of AppViewModel, which never sees a USDT quote.
Locales: every values-*/strings.xml that carries wallet__send_dialog2 also carries wallet__send_dialog2_usdt.
CI: build, build-local and lint were still running at review time.

Ruled out

  • Confirmed-warning loop: confirmedWarnings is keyed by the enum value and the USDT path only ever produces the new value, so accepting it once suppresses it on the next confirm().
  • Paykit USDT review path left on the old copy: it reads the same UsdtViewModel state and renders warning.message, so it picks up the new string too.
  • E2E selector breaks: the new entry reuses the SendDialog2 test tag listed in docs/e2e-test-ids.md, so a test waiting on that dialog still finds it.
  • formatted="false" changes rendering: the string has no format arguments and is read with stringResource(id), so the attribute only silences the literal % check.

Merge confidence: 4/5, no findings and the new test covers the change, held below 5 because CI had not finished when this was posted.

@ovitrif
ovitrif requested review from a team, ben-kaufman and coreyphillips and removed request for a team October 21, 2026 00:57
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 26d572e (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@ovitrif

ovitrif commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 26d572e: adds the USDT over-50% warning to the manual checklist in docs/usdt-qa.md, answering the QA-coverage review thread (#1644 (comment)). No code change.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code scan at 26d572e: no issues found.

  • Right balance: the warning compares the quote amount with the USDT wallet balance only, so naming the USDT balance is accurate.
  • No math change: the check uses the amount without the fee, the same as master. Fee checks are separate warnings.
  • Bitcoin path unchanged: it still uses its own total-balance text.
  • Confirmed warnings: accepting once skips the warning on the next confirm, and Cancel behaves as on master.
  • E2E: the alert keeps SendDialog2, and the English text still contains "over 50%".
  • Translations: the new key is in every locale, and the alert wraps with no fixed-width container.
  • Parity: matches synonymdev/bitkit-ios#1069.

Device gate (partial): 26d572e — not run yet. Pending:

  • on the USDT fixture, send more than half the USDT balance and check the alert names the USDT balance;
  • a bitcoin send over half the total, which should keep the total-balance text;
  • one long locale (de or ru).

Device results will follow in a separate review.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Device gate passed on the USDT fixture (emulator, Pixel 9). Approving; my earlier code scan found no issues.

  1. USDT send of $15 out of 25.00 USDT: the alert (SendDialog2) says "over 50% of your USDT balance".
  2. Cancel goes back to Amount with $15 kept. Nothing was sent.
  3. German: the text fits the dialog with no clipping.
  4. Yes, send: the alert didn't show again. One USDT send went through ($15.00), no duplicate.
  5. Bitcoin send of 300,000 out of 499,890 sats: the alert keeps "over 50% of your total balance".

Device gate: 26d572e — 5 checks passed, 0 failed (USDT alert, Cancel, Accept, bitcoin alert, de); l10n: de fits; iOS: pending on synonymdev/bitkit-ios#1069.

This branch has not been deployed

No deployments
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