Skip to content

Mobile Rule Testing UI — Preview Matching Transactions

Mobile Rule Testing UI — Preview Matching Transactions

Status: Delivered
CAS: CAS-3055
Delivered: 2026-05-15
PRs: #840

What’s new

Every rule card on the mobile Rules page now has a Test button. Tapping it runs the rule expression against the transaction database and shows a modal listing how many transactions match — with their names and amounts. This closes the gap from CAS-1015: the rule management UI shipped without the preview capability originally specced.

How to use it

  1. Open Settings → Rules on iOS or the mobile viewport.
  2. Expand any transaction rule (category, group-split, or tag rule whose domain is transaction).
  3. Tap Test — a loader appears briefly.
  4. The result modal shows:
    • Total match count
    • Scrollable list of matching transaction names and amounts
    • “No matching transactions” if the rule matches nothing

Invoice and receipt rules (domain !== "transaction") show “Preview not available for this rule type.” — the expression language supports them but the preview endpoint only queries the transaction store.

What changed under the hood

  • MobileRuleCard.tsx — new Test button rendered alongside Edit/Delete on expanded cards.
  • Calls transactionClient.getMatchingTransactions(rule.expression) (Tauri command get_transactions_matching_rule — already existed, added in an earlier epic).
  • RuleTestModal.tsx — new modal component showing the match count headline and scrollable transaction list.
  • Desktop RuleSettingsPage is untouched; the feature is mobile-only.

Why we built it

A rule like amount > 500 is easy to write but hard to validate without running it. Before this change, users had to save and then manually scan their transaction list to see what got affected. The Test button gives immediate feedback in the authoring flow — no save, no page switch.

Known limitations / follow-on work

  • Preview is limited to the transaction domain; invoice/receipt preview requires a separate query path.
  • No Maestro smoke test for the test-modal flow yet.
  • Desktop RuleSettingsPage does not yet have an equivalent preview.