Skip to content

fix(cli)(#24): invoice-status and invoice-list use 'full' sync mode#26

Merged
vrogojin merged 1 commit into
integration/all-fixesfrom
fix/issue-24-invoice-status-sync-mode
May 23, 2026
Merged

fix(cli)(#24): invoice-status and invoice-list use 'full' sync mode#26
vrogojin merged 1 commit into
integration/all-fixesfrom
fix/issue-24-invoice-status-sync-mode

Conversation

@vrogojin
Copy link
Copy Markdown
Contributor

Summary

  • case 'invoice-status' now calls ensureSync(sphere, 'full') instead of 'nostr' — per-target balance is computed from on-chain payment attribution, which needs the IPFS / Profile pointer pull, not just the Nostr inbox.
  • case 'invoice-list' gets the same treatment — without it, invoices minted on another peer that propagate via Profile sync don't surface in invoice list until they happen to ride a Nostr DM.

Both changes carry an inline comment explaining the why so the next reader doesn't quietly flip it back to 'nostr' thinking the inbox pull is sufficient.

What this fixes (and what it doesn't)

This is half of the §C.4 cross-device fix. The other half is sphere-sdk #230 — even with 'full' sync, AccountingModule.invoiceTermsCache doesn't refresh on sync:completed, so a peer that received the invoice via Profile sync still gets "No invoice found matching prefix" until the cache is rebuilt. That fix lands separately; this PR is the CLI-side prerequisite.

Acceptance (from the issue)

  • invoice-status calls ensureSync(sphere, 'full')
  • invoice-list audited — same mismatch, also flipped to 'full'
  • Verify manual-test-full-recovery.sh §C.4 progresses past the "No invoice found" error → blocked on sphere-sdk #230

Tests

  • All 114 unit tests still pass (npm test).
  • npm run typecheck clean.
  • npm run lint clean (warnings unchanged from main; no new ones).
  • No new test added — the existing cli-invoice.integration.test.ts shape tests don't pin sync-mode, and the failure mode only repros against a multi-device testnet setup, which is the scope of #230's integration test once that lands.

Closes #24.

Both commands need the IPFS / Profile pointer pull, not just the Nostr
inbox. 'nostr' mode skipped that pull, so on a fresh device or after a
wipe `invoice-status` reported "No invoice found matching prefix" and
`invoice-list` returned an empty set — even when the invoice had been
minted by another peer and was reachable on-chain.

The other invoice commands (deliver, close, cancel, pay, return,
receipts, notices, auto-return, transfers, export) already used 'full'.
This aligns the two read-side commands with the rest.

Companion sphere-sdk fix is #230 — once that lands, the receiver-side
AccountingModule.invoiceTermsCache will also refresh on sync:completed
and the full cross-device §C.4 flow will work end-to-end.

Refs sphere-cli#24, sphere-sdk#230, sphere-sdk#223
@vrogojin vrogojin merged commit 05d1157 into integration/all-fixes May 23, 2026
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.

1 participant