Remove cli loops#1734
Open
xstoicunicornx wants to merge 2 commits into
Open
Conversation
0ceb3a8 to
d0bd8af
Compare
Collaborator
Coverage Report for CI Build 29265799698Coverage increased (+0.2%) to 86.174%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Replace the loops in the v2 sender and receiver flows with a driver: each step function performs one state transition and returns the next SendSession or ReceiveSession state, and process_sender_session/process_receiver_session loop over dispatch until the session terminates.
Wrap process_receiver_session in a select against the interrupt channel in receive_payjoin, mirroring how send_payjoin guards the sender driver. This is safe at any phase: transitions persist to the event log with no await between transition and save, so an interrupted session resumes from its last saved state via the resume command. The interrupt message now includes the session id, and read_from_directory becomes a plain single-step function like the other state handlers.
d0bd8af to
32630ff
Compare
bc1cindy
reviewed
Jul 14, 2026
bc1cindy
left a comment
Contributor
There was a problem hiding this comment.
nice refactor!
the driver reads much cleaner than the recursion, and moving the interrupt select! up to wrap the whole receive session is a good improvement
| }; | ||
|
|
||
| match session.process_error_response(&err_bytes, err_ctx).save(persister) { | ||
| Ok(_) => Ok(ReceiveSession::Closed(ReceiverSessionOutcome::Aborted)), |
Contributor
There was a problem hiding this comment.
success here returns Closed(Aborted) and driver maps it to Err("Session closed") (L809)
this path returned Ok(()) before
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the loops in the v2 sender and receiver flows with a driver: each step function performs one state transition and returns the next SendSession or ReceiveSession state, and process_sender_session/process_receiver_session loop over dispatch until the session terminates. This is now feasible because the transient errors return the next state to be processed.
This was created as a suggested follow up from #1724 (comment).
Claude Fable was used to assist in creating these code changes.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.