View Issue Details

IDProjectCategoryView StatusLast Update
0011962Talerwallet (iOS App)public2026-11-19 08:47
Reporterbot-cg [agent]  
ImplementerMarcS  
PrioritynormalSeverityminor 
Status implementing 
Summary0011962: Discounts/Passes: the only delete control is unreachable, so a token can never be removed (swipeActions gated on !isValid and attached to a nested HStack)
Description`deleteDiscount` and `deleteSubscription` have exactly one call site in the
UI, and it cannot be reached. Both are therefore dead in practice: a token the
wallet holds can never be removed.

TalerWallet1/Views/Balances/DiscountPasses.swift:69-104, inside
`DiscountsPassesItem`:

    Section {
        VStack(alignment: .leading, spacing: 2) {
            let row = HStack(alignment: .top) { name; Spacer(); ... }
                .padding(.horizontal)
                .padding(.top, 6)
            if isValid {
                row // <-- no swipe action
            } else {
                let swipe = Button {
                    symLog.log("delete \(token.id)")
                    deleteAction(token.id)
                } label: {
                    Label("Delete", systemImage: "trash")
                }.tint(WalletColors().negative)
                row.swipeActions(edge: .trailing) { swipe }
            }
            ...

Two independent problems, either of which alone would be enough:

1. **The swipe action is attached only in the `else` branch of `if isValid`**,
   and `isValid` is `token.validityStart < .now()` (line 55). So it is offered
   only for a token whose validity has *not started yet* -- never for a token
   just earned, and never for anything in the "Expired" segment, where
   `validityEnd <= now` implies `validityStart < now` as well. Those are
   exactly the tokens a user would want to remove.

2. **`.swipeActions` is applied to the wrong view.** `row` is an `HStack`
   nested inside the `VStack(alignment: .leading, spacing: 2)` at line 70,
   which is itself a child of the `Section` at line 69. `.swipeActions` only
   takes effect on a direct row of a `List`; applied to a nested `HStack` it
   is a no-op. So even for a not-yet-valid token the swipe is very likely
   dead.

`deleteAction` is called from nowhere else -- the closure is wired at
lines 152-158 (`DiscountsPassesList.delete` -> `model.deleteSubscription` /
`model.deleteDiscount`) and invoked only at line 97-102, inside that swipe
button. The validity strip's `onTapGesture` at lines 129-133 toggles the
displayed start/end date and is not a delete. There is no other path, no
context menu and no Edit mode.

Confirmed dark by coverage measurement: over 702 instrumented episodes of a
coverage-guided XCUITest explorer, `deleteDiscount` (Model+Balances.swift:182)
and `deleteSubscription` (Model+Balances.swift:194) never executed, while
`acceptPeerPushCredit` on a comparable path did (x5). That is consistent with
the control being unreachable rather than merely rarely used.
Steps To Reproduce1. Pay a v1 contract order whose choice issues a discount or subscription
   token, so the wallet holds one. (A merchant backend token family plus a
   v1 order with `outputs: [{type: token, ...}]` does it.)
2. Balances -> the "Discounts" or "Passes" row (DiscountPasses.swift:276-302).
3. Try to remove the token: swipe the row left, in both the "Active" and
   "Expired" segments.

Observed: no Delete action appears, in either segment. The token cannot be
removed from the wallet by any means in the UI.

Expected: a swipe (or some other control) that removes the token, reaching
`model.deleteDiscount` / `model.deleteSubscription`.
Additional InformationSuggested fix, two small changes in DiscountPasses.swift:

* Move `.swipeActions` off the nested `HStack` and onto the view that is the
  actual `List` row -- i.e. apply it to the `VStack` (or restructure so the
  row content is one view that `.swipeActions` can attach to).
* Drop the `if isValid` gate, or invert it. Deleting a token the user holds
  should not depend on whether its validity window has opened; if anything,
  an expired or used token is the most likely thing to want gone.

A caveat worth stating: I have not been able to exercise the fixed control
yet, so "very likely dead" in point 2 is a reading of the modifier placement
rather than an observation of a failed swipe on a not-yet-valid token -- such
a token is itself hard to obtain (it needs a token family with a future
`start_offset`). Point 1 is unambiguous from the source either way.

Found while building a deterministic scenario suite for the iOS wallet: the
flow "pay an order that issues tokens, then delete them" could not be
expressed, because its last step has no reachable control.
TagsNo tags attached.
Attached Files
11962-token-delete.diff (2,227 bytes)   
diff --git a/TalerWallet1/Views/Balances/DiscountPasses.swift b/TalerWallet1/Views/Balances/DiscountPasses.swift
index 8d25119e..c0661711 100755
--- a/TalerWallet1/Views/Balances/DiscountPasses.swift
+++ b/TalerWallet1/Views/Balances/DiscountPasses.swift
@@ -91,17 +91,7 @@ struct DiscountsPassesItem: View {
                 }
                     .padding(.horizontal)
                     .padding(.top, 6)
-                if isValid {
-                    row
-                } else {
-                    let swipe = Button {
-                        symLog.log("delete \(token.id)")
-                        deleteAction(token.id)
-                    } label: {
-                        Label("Delete", systemImage: "trash")
-                    }.tint(WalletColors().negative)
-                    row.swipeActions(edge: .trailing) { swipe }
-                }
+                row
 //                Divider()
                 desc
                     .padding(.horizontal)
@@ -117,6 +107,23 @@ struct DiscountsPassesItem: View {
                     .padding(.horizontal)
                     .padding(.vertical, 4)
             }
+            // `.swipeActions` only takes effect on a direct row of the List.
+            // It used to be attached to `row`, the HStack *inside* this
+            // VStack, where it did nothing -- and only in the `else` branch of
+            // `if isValid`, i.e. only for a token whose validity had not
+            // started yet, which is never a token the user just earned and
+            // never anything under "Expired".  Between the two, the only call
+            // site of `deleteAction` could not be reached at all: a token
+            // could not be removed from the wallet.  See issue 11962.
+            .swipeActions(edge: .trailing) {
+                Button(role: .destructive) {
+                    symLog.log("delete \(token.id)")
+                    deleteAction(token.id)
+                } label: {
+                    Label("Delete", systemImage: "trash")
+                }
+                .tint(WalletColors().negative)
+            }
 
             ContainerRelativeShape()
                 .fill(isValid ? primaryAccent.opacity(0.1) : .clear)
11962-token-delete.diff (2,227 bytes)   
11962-token-delete-2.diff (2,227 bytes)   
diff --git a/TalerWallet1/Views/Balances/DiscountPasses.swift b/TalerWallet1/Views/Balances/DiscountPasses.swift
index 8d25119e..c0661711 100755
--- a/TalerWallet1/Views/Balances/DiscountPasses.swift
+++ b/TalerWallet1/Views/Balances/DiscountPasses.swift
@@ -91,17 +91,7 @@ struct DiscountsPassesItem: View {
                 }
                     .padding(.horizontal)
                     .padding(.top, 6)
-                if isValid {
-                    row
-                } else {
-                    let swipe = Button {
-                        symLog.log("delete \(token.id)")
-                        deleteAction(token.id)
-                    } label: {
-                        Label("Delete", systemImage: "trash")
-                    }.tint(WalletColors().negative)
-                    row.swipeActions(edge: .trailing) { swipe }
-                }
+                row
 //                Divider()
                 desc
                     .padding(.horizontal)
@@ -117,6 +107,23 @@ struct DiscountsPassesItem: View {
                     .padding(.horizontal)
                     .padding(.vertical, 4)
             }
+            // `.swipeActions` only takes effect on a direct row of the List.
+            // It used to be attached to `row`, the HStack *inside* this
+            // VStack, where it did nothing -- and only in the `else` branch of
+            // `if isValid`, i.e. only for a token whose validity had not
+            // started yet, which is never a token the user just earned and
+            // never anything under "Expired".  Between the two, the only call
+            // site of `deleteAction` could not be reached at all: a token
+            // could not be removed from the wallet.  See issue 11962.
+            .swipeActions(edge: .trailing) {
+                Button(role: .destructive) {
+                    symLog.log("delete \(token.id)")
+                    deleteAction(token.id)
+                } label: {
+                    Label("Delete", systemImage: "trash")
+                }
+                .tint(WalletColors().negative)
+            }
 
             ContainerRelativeShape()
                 .fill(isValid ? primaryAccent.opacity(0.1) : .clear)
11962-token-delete-2.diff (2,227 bytes)   
11962-token-delete-3.diff (2,227 bytes)   
diff --git a/TalerWallet1/Views/Balances/DiscountPasses.swift b/TalerWallet1/Views/Balances/DiscountPasses.swift
index 8d25119e..c0661711 100755
--- a/TalerWallet1/Views/Balances/DiscountPasses.swift
+++ b/TalerWallet1/Views/Balances/DiscountPasses.swift
@@ -91,17 +91,7 @@ struct DiscountsPassesItem: View {
                 }
                     .padding(.horizontal)
                     .padding(.top, 6)
-                if isValid {
-                    row
-                } else {
-                    let swipe = Button {
-                        symLog.log("delete \(token.id)")
-                        deleteAction(token.id)
-                    } label: {
-                        Label("Delete", systemImage: "trash")
-                    }.tint(WalletColors().negative)
-                    row.swipeActions(edge: .trailing) { swipe }
-                }
+                row
 //                Divider()
                 desc
                     .padding(.horizontal)
@@ -117,6 +107,23 @@ struct DiscountsPassesItem: View {
                     .padding(.horizontal)
                     .padding(.vertical, 4)
             }
+            // `.swipeActions` only takes effect on a direct row of the List.
+            // It used to be attached to `row`, the HStack *inside* this
+            // VStack, where it did nothing -- and only in the `else` branch of
+            // `if isValid`, i.e. only for a token whose validity had not
+            // started yet, which is never a token the user just earned and
+            // never anything under "Expired".  Between the two, the only call
+            // site of `deleteAction` could not be reached at all: a token
+            // could not be removed from the wallet.  See issue 11962.
+            .swipeActions(edge: .trailing) {
+                Button(role: .destructive) {
+                    symLog.log("delete \(token.id)")
+                    deleteAction(token.id)
+                } label: {
+                    Label("Delete", systemImage: "trash")
+                }
+                .tint(WalletColors().negative)
+            }
 
             ContainerRelativeShape()
                 .fill(isValid ? primaryAccent.opacity(0.1) : .clear)
11962-token-delete-3.diff (2,227 bytes)   

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-cg [agent]

2026-11-07 22:19

updater   ~0030307

/tmp/claude-1003/-home-claude-taler-ios/1dcaba3f-80f7-464e-935d-b36e8b659bba/scratchpad/note-11962-fix.txt

bot-cg [agent]

2026-11-08 11:14

updater   ~0030318

Measured corroboration for this report, from a 2-hour automated campaign
(22 episodes, iOS 27.2 simulator, GNU_Taler debug build).

The report argues from the source that the discount/pass delete has no
reachable UI path: `.swipeActions` is attached only in the `else` branch of
`if isValid` (DiscountPasses.swift:94-104), so never to a token whose
validity has started, and it sits on `row` -- an HStack nested inside a
VStack inside the Section -- where the modifier has no effect at all.

The campaign gives that a number. Across all 22 episodes:

    listDiscounts wallet-core request logged in 22 of 22 episodes
    listSubscriptions logged in 22 of 22 episodes
    deleteDiscount logged in 0 of 22 episodes
    deleteSubscription logged in 0 of 22 episodes

And in the merged coverage profile of the whole project to date (759
profiles), `deleteDiscount` and `deleteSubscription` are still **dark**,
while `listDiscounts` is covered.

The first two rows are what make the last two meaningful: the discount and
pass screens were not merely present, they were *reached and listed in every
single episode*, by strategies as different as settings-walking,
landscape/OIM exploration and unguided deep walks. So this is not "the fuzzer
never found the screen" -- it found it twenty-two times out of twenty-two and
still never reached the delete.

That is about as strong as a reachability claim gets from the outside, short
of a proof, and it is consistent with the source reading rather than merely
compatible with it.

Two notes on what this does *not* show:

* It does not distinguish the two defects in the report. Either the
  `isValid` gate alone or the misplaced modifier alone would produce this
  result, and the report is right that both need fixing.
* A token whose validity has not yet started is the one case the `else`
  branch does cover, and the campaign may simply never have held one. So the
  measurement bounds the practical reachability, not the theoretical one.

Harness reference: the per-episode logs are `oslog.ndjson` in each episode
directory; the coverage view is `scripts/deadfuncs.py` in the fuzzing
harness, which excludes compiler-synthesised entries and simulator-dead code
so that "dark" means a real function that never executed.

bot-cg [agent]

2026-11-08 18:04

updater   ~0030334

Screenshot attached: the Discounts list with one token in exactly the state
the report is about.

"Fuzz discount pass", x1, Active segment, "Valid until 6 Dec 2026 at 01:24"
-- so `isValid` is true for this row. That is the branch where
DiscountPasses.swift attaches no `.swipeActions` at all, the modifier being
inside the `else` of `if isValid`. There is no delete affordance anywhere on
this screen: no Edit button in the bar, no context menu, nothing behind a
swipe. The Expired segment has the same problem for the opposite reason.

This is the ordinary case, which is the point: a token you have just earned
and can still use is precisely the one you cannot remove.

Captured on iPhone 17 (402x874 pt), iOS 27.2, GNU_Taler debug build, after
paying a v1 choice order that issues a discount token.
11962-discounts-fit.png (78,333 bytes)   
11962-discounts-fit.png (78,333 bytes)   

bot-cg [agent]

2026-11-10 14:05

updater   ~0030374

Correction to note 0030307, which should carry the text below and instead
carries a local filename. The tool I add notes with takes the note on
stdin, and a path given as an argument becomes the note itself -- so the
note reads "/tmp/.../note-11962-fix.txt" and says nothing to anyone. The
patch it describes was attached correctly; only the explanation was lost.
Reposting it verbatim:

Note first: there are three identical copies of this patch attached
(11962-token-delete.diff, -2 and -3, all 2227 bytes, same content).
That is my mistake, not three revisions: the tool I attach with prints
nothing on success, I read the silence as a failure and retried twice.
Please use any one of them; I cannot remove the other two.

Attaching a proposed fix (11962-token-delete.diff), built against
1.6.18 (1.6.49) on the iOS 27.2 simulator SDK.

Two changes in TalerWallet1/Views/Balances/DiscountPasses.swift:

1. `.swipeActions` moves off `row` -- the HStack nested inside the VStack --
   and onto the VStack itself, which is the view the List actually treats as
   a row. Applied to a nested HStack the modifier has no effect.
2. The `if isValid { row } else { row.swipeActions… }` split goes away, so the
   action is offered for every token rather than only for one whose validity
   has not started yet. The `isValid` value is still used, unchanged, for the
   validity strip's fill colour.

The delete button itself is unchanged except for gaining `role: .destructive`
(it already had `.tint(WalletColors().negative)`), and it still calls the same
`deleteAction(token.id)` closure, which routes to `model.deleteSubscription`
for a pass and `model.deleteDiscount` for a discount.

What is verified and what is not, so the diff is not oversold:

* It compiles -- `xcodebuild -scheme GNU_Taler -configuration Debug` for the
  iOS simulator reports BUILD SUCCEEDED with no new warnings in this file.
* I have NOT yet watched the swipe reveal the button in the running app. The
  UI test that would do it exists (harness/scenarios/candidate/
  tokens-delete-fixed.json: pay a v1 choice order that issues a discount
  token, then swipe the token row and tap Delete, asserting the list's empty
  state afterwards and requiring deleteDiscount/deleteSubscription to show a
  non-zero count in the coverage profile). It has not been run against a build
  carrying this patch yet, so treat the diff as reviewed-and-compiling rather
  than as demonstrated.

Its companion scenario, tokens-earn-and-delete.json, asserts the *current*
behaviour -- that no Delete action appears -- so the pair documents both
states and neither needs editing when the fix lands.

Issue History

Date ModifiedUsernameFieldChange
2026-11-07 21:27bot-cgNew Issue
2026-11-07 22:18bot-cgFile Added: 11962-token-delete.diff
2026-11-07 22:18bot-cgFile Added: 11962-token-delete-2.diff
2026-11-07 22:18bot-cgFile Added: 11962-token-delete-3.diff
2026-11-07 22:19bot-cgNote Added: 0030307
2026-11-08 11:14bot-cgNote Added: 0030318
2026-11-08 18:04bot-cgFile Added: 11962-discounts-fit.png
2026-11-08 18:04bot-cgNote Added: 0030334
2026-11-08 18:15Christian GrothoffImplementer => MarcS
2026-11-08 18:15Christian GrothoffReviewer => Bohdan
2026-11-08 18:15Christian GrothoffRelease signed by => MarcS
2026-11-08 18:15Christian GrothoffDeployed by => MarcS
2026-11-08 18:15Christian GrothoffVerifier => Bohdan
2026-11-08 18:15Christian GrothoffStatusnew => planning
2026-11-10 14:05bot-cgNote Added: 0030374
2026-11-19 08:47Christian GrothoffStatusplanning => implementing