taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

donation-statements-button-is-wired-to-nothing.md (5026B)


      1 <!--
      2   This file is part of GNU Taler
      3   (C) 2026 Taler Systems S.A.
      4 
      5   GNU Taler is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 
     13   You should have received a copy of the GNU General Public License along with
     14   GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 -->
     16 
     17 # "Donation statements" does nothing, and its whole screen is unreachable
     18 
     19 The random exploration kept reporting this and it kept being filed as noise:
     20 
     21 ```
     22 [silent-failure] tapping 'Donation statements' changed nothing on screen
     23 ```
     24 
     25 It is not noise. The button is wired to a no-op, and behind it sits a complete
     26 feature that nothing in the app can open.
     27 
     28 **Severity: moderate.** A labelled button on the main balance screen does
     29 nothing when tapped — no navigation, no message, no change. Two composables
     30 (~90 lines), a registered navigation destination and a wallet-core operation
     31 are dead because of it.
     32 
     33 ## What happens
     34 
     35 On the balance screen, the row under the recent transactions has three action
     36 buttons: **Discounts**, **Passes**, **Donation statements**. The first two
     37 open their screens. The third does nothing at all.
     38 
     39 If the wallet holds donau receipts, the balances list also shows a
     40 **Donation statements** section whose rows look tappable. They do nothing
     41 either.
     42 
     43 ## Why
     44 
     45 The three buttons sit in one row, and two of them are wired to navigation
     46 while the third is wired to clearing the balance selection:
     47 
     48 ```kotlin
     49 // wallet/src/main/java/net/taler/wallet/balances/BalancesPagerComposable.kt:283
     50 onShowStatements = { onBalanceSelected(null) },
     51 onShowDiscounts  = { onShowDiscounts(scope) },
     52 onShowPasses     = { onShowPasses(scope) },
     53 ```
     54 
     55 and `onBalanceSelected` only changes which balance is displayed:
     56 
     57 ```kotlin
     58 // wallet/src/main/java/net/taler/wallet/main/MainScreen.kt:171
     59 onBalanceSelected = { model.displayScope(it?.scopeInfo) },
     60 ```
     61 
     62 With `null` that is a no-op from the user's point of view. The statement rows
     63 in the list have the same handler:
     64 
     65 ```kotlin
     66 // wallet/src/main/java/net/taler/wallet/balances/BalancesPagerComposable.kt:257
     67 onStatementClicked = { onBalanceSelected(null) }
     68 ```
     69 
     70 even though `BalancesListComposable` passes a real argument for it —
     71 `onStatementClicked(statement.donauBaseUrl)` — which is exactly the `host` the
     72 statement screen wants.
     73 
     74 ## What is unreachable as a result
     75 
     76 * `WalletDestination.DonauStatement(host)` is declared
     77   (`WalletNavigation.kt:70`) and registered in the nav host
     78   (`WalletNavHost.kt:291`), and **nothing navigates to it**:
     79 
     80   ```bash
     81   $ grep -rn 'WalletDestination.DonauStatement' --include=*.kt wallet/src/main/java
     82   WalletNavHost.kt:291:        composable<WalletDestination.DonauStatement> { backStackEntry ->
     83   WalletNavHost.kt:292:            val dest = backStackEntry.toRoute<WalletDestination.DonauStatement>()
     84   ```
     85 
     86 * `DonauStatementScreen` (35 lines) and `DonauStatementComposable` (55 lines)
     87   therefore never render — they read 0 % in every coverage report of this
     88   campaign.
     89 * `getDonauStatements` is called from exactly one place,
     90   `DonauStatementScreen.kt:51`, so that wallet-core operation has no reachable
     91   caller either. It is one of the operations this campaign could never
     92   exercise from the app.
     93 
     94 The donau *package* sits at 38 % line coverage, the lowest of any feature
     95 package, and this button is why.
     96 
     97 ## Reproduce by hand
     98 
     99 1. Install a debug build and withdraw once, so there is a balance to show.
    100 2. On the balance screen, scroll to the row with **Discounts**, **Passes** and
    101    **Donation statements**.
    102 3. Tap **Discounts** — a screen opens. Go back. Tap **Passes** — a screen
    103    opens. Go back.
    104 4. Tap **Donation statements** — nothing happens. `adb logcat` shows no
    105    navigation and no error.
    106 
    107 ## Reproduce with the simulator
    108 
    109 ```bash
    110 ssh root@tripwire.taler.net
    111 cd /opt/taler-sim/driver
    112 SIM_WORKER=0 python3 -u suite.py donau_receipt
    113 ```
    114 
    115 The scenario taps the button and records the screen before and after; the
    116 silent-failure oracle flags it, which is how it first showed up.
    117 
    118 ## Suggested fix
    119 
    120 Wire it the way its two neighbours are wired:
    121 
    122 ```kotlin
    123 onShowStatements = { onShowStatements(scope) },          // in the pager
    124 onStatementClicked = { host -> onStatementClicked(host) },  // in the list
    125 ```
    126 
    127 with `MainScreen` navigating to `WalletDestination.DonauStatement(host)` — the
    128 screen already fetches its own statements from the host it is given, so nothing
    129 else is needed. The list's rows carry the right `donauBaseUrl` already.
    130 
    131 If the feature is meant to be unfinished, the button should not be on the
    132 balance screen: a control that does nothing is worse than one that is absent.