swapwallet: project credit operations into the canonical activity log (#774) - #840
Conversation
There was a problem hiding this comment.
Code Review
This pull request ensures that credit-only sends are correctly projected and persisted into the canonical activity store before being emitted. Specifically, it replaces calls to emit with projectAndEmit in both pollCreditOps (using the root context) and sendCreditInvoiceIntent (using a non-cancelable context to prevent write cancellations on client disconnects). Additionally, a new unit test TestCreditProjectorWritesToStore and a helper method ids() have been added to verify this behavior. No review comments were provided, so there is no additional feedback.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
46d8afa to
4477c4f
Compare
12569d3 to
205ca3e
Compare
Route the credit projector loop and the credit-pay pending emit through projectAndEmit so credit-only sends and credit receives are written to the canonical activity store, not only fanned to live subscribers. Without this they reach the feed only at read time, so they would vanish from the store once the read path cuts over to it. The store suppresses no-op re-projections, so the coarse credit re-poll appends no duplicate events. Backfill already covers credit via the read-path collector.
205ca3e to
623c36c
Compare
Closes the producer-coverage gap roasbeef flagged on #776: credit-only sends (#830) reach the wallet feed only at read time (
collectCreditEntries), never throughRuntime.emit. PR #817's projector hooks the swap monitor, cooperative-leave submit, and deadline overlay — but not credit. If the read path were cut over to the store without this, credit-only sends would vanish from the canonical log, exactly the #829 class of bug this epic exists to kill.Change
credit_projector.go,pollCreditOps) and the credit-pay pending emit (router.go,sendCreditInvoiceIntent) now route throughprojectAndEmitinstead ofemit, so credit rows land in the canonical activity store, not only in the live subscriber fan-out.WalletEntryupdates and only fires on a state change; the store'schangesRowsuppression means the coarse re-poll of unchanged rows appends no duplicate events. Backfill already covers credit vialistActivity→collectCreditEntries.Tests
TestCreditProjectorWritesToStore: the projector persists the credit rows it owns (credit-only pay keyed by payment hash, credit receive keyed by op id) into the store, and a re-poll of unchanged state projects nothing further.make build,make lint-changed-local, and theswapwalletunit suite pass.