NWC: the pay and buyer-invoice readouts are zero-size, so no accessibility tree carries them

Open Beginner friendly
#953 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
dart, flutter

Research direction

Read lib/shared/widgets/nwc_payment_widget.dart and lib/shared/widgets/nwc_invoice_widget.dart, then compare the manual invoice readout described in the issue. Add widget tests that inspect the semantics tree and verify each readout has a non-empty rect and the expected bolt11 label; preserve the failed-submission behavior. Done when both NWC readouts appear in the accessibility tree and the tests pass.

Written by the indexing model from the issue text.

Description

area: ui bug priority: high

Context

With an NWC wallet connected, the pay screen (/pay_invoice/:orderId) shows NwcPaymentWidget instead of the QR, and the add-invoice screen shows NwcInvoiceWidget. The automation contract (docs/automation-contract.md) says pay.invoice.text carries the hold invoice "which is otherwise only drawn as a QR code or paid directly by the wallet", and that invoice.nwc.text carries the buyer invoice NWC generated, "for payment correlation". A black-box harness depends on both. It must know the hold invoice's payment hash before the app pays it, so that the wallet behind the app only pays what the run reserved and the payment can be journaled and recovered.

What happens

Both widgets attach the readout to an empty SizedBox.shrink():

  • lib/shared/widgets/nwc_payment_widget.dart:72: const SizedBox.shrink().withAutomationId(id, label: widget.bolt11)
  • lib/shared/widgets/nwc_invoice_widget.dart:127: const SizedBox.shrink().withAutomationId(...)

Flutter drops semantics nodes whose rect is empty, so neither node reaches the accessibility tree, on any platform. In a live Mortsom run on Linux against main at 0293bd44, Alice's pay screen exposed only pay.nwc, pay.order_id, appbar.back and env.marker. There was no pay.invoice.text, although the widget sets it.

Consequences:

  • No automation can read the hold invoice while a wallet is connected. Mortsom's nwc_happy_sell, nwc_happy_buy, nwc_wallet_survives_restart and the funding step of nwc_invoice_fails_then_manual all stop at the same check ("the connected wallet's pay form does not expose pay.invoice.text").
  • invoice.nwc.text is equally invisible. The buyer-side correlation it promises never happens.
  • The manual screen works: there the readout sits on the QR (automationId: AutomationIds.payInvoiceText, automationLabel: invoice, child: _qr(...)), which has a size.

How to fix

Attach each readout to a node that has a size, the way the manual screen does:

  1. In NwcPaymentWidget, wrap the visible content (the amount and the pay button's column) in AutomationId(AutomationIds.payInvoiceText, merge: false, label: widget.bolt11, child: ...) and remove the SizedBox.shrink(). Use merge: false so pay.nwc stays its own node.
  2. Do the same in NwcInvoiceWidget for invoice.nwc.text, on the success content. Keep the current rule that the readout is absent when submitting failed.
  3. Add a widget test for each that walks the semantics tree (tester.getSemantics / find.bySemanticsIdentifier) and asserts the node exists, has a non-empty rect, and carries the bolt11 as its label. A test that only finds the widget would pass today.

This changes no identifier and no label value. It makes the contract true for the NWC path.

Dominant language
Dart
Stars
11
Forks
9
Avg merge
2d 1h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MostroP2P/app

All issues in MostroP2P/app

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.