Skip to content

Rename sender session events. - #1125

Merged
spacebear21 merged 1 commit into
payjoin:masterfrom
zealsham:rename-sender-events
Oct 2, 2025
Merged

spacebear21 merged 1 commit into
payjoin:masterfrom
zealsham:rename-sender-events

Conversation

@zealsham

@zealsham zealsham commented Sep 30, 2025 •

Copy link
Copy Markdown
Collaborator

This renames the sender session events to describe what happened instead of what the event produced .

This is part of #1119

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls

coveralls commented Sep 30, 2025 •

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 18203403187

Details

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 84.562%

Totals Coverage Status
Change from base Build 18202518786: 0.0%
Covered Lines: 8961
Relevant Lines: 10597

💛 - Coveralls

@benalleng benalleng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change, I have a nit that i won't push too hard on if others don't feel too strongly about ti but I think it would be nice to have every SessionEvent be syntactically the same with some object + action, i.e.

  • ReplyKeyGenerated
  • OriginalPsbtSubmitted
  • ProposalReceived
  • SessionInvalid

@DanGould

DanGould commented Sep 30, 2025 •

Copy link
Copy Markdown
Member

On the receiver side we named the event to match the apply function. That'd mean reverting PollingForProposal or changing the apply_polling_for_proposal function to match the new name (PolledForProposal, apply_polled_for_proposal ? Is this state when polling happened past tense or when the original PSBT was POSTed as the new name suggests? If the latter, apply_original_payload_submitted makes the most sense for a name imo)

I don't think these names are going to be reflective of the actual events however, until the SessionEvents hold exclusively primary information.

@spacebear21

Copy link
Copy Markdown
Collaborator

The rule of thumb I used for the receiver events is to name the events after the method action that caused it to happen, e.g. identify_receiver_outputs -> IdentifiedReceiverOutputs. I think we should stick with that pattern here.

@zealsham
zealsham force-pushed the rename-sender-events branch from 8f4005c to 160992b Compare September 30, 2025 23:13
@zealsham

Copy link
Copy Markdown
Collaborator Author

On the receiver side we named the event to match the apply function. That'd mean reverting PollingForProposal or changing the apply_polling_for_proposal function to match the new name (PolledForProposal, apply_polled_for_proposal ? Is this state when polling happened past tense or when the original PSBT was POSTed as the new name suggests? If the latter, apply_original_payload_submitted makes the most sense for a name imo)

I don't think these names are going to be reflective of the actual events however, until the SessionEvents hold exclusively primary information.

If we are sticking with "what happened " and not what the event produced then the correct state is when original PSBT was posted .

@arminsabouri
arminsabouri requested a review from benalleng October 1, 2025 14:54
@benalleng

Copy link
Copy Markdown
Collaborator

I will defer to spacebear's comment here about following the naming pattern by the event after the method action that caused it, I'd just like it to be consistent!

@spacebear21

Copy link
Copy Markdown
Collaborator

For maximum consistency with the Receiver events, ultimately I'd like to see:

pub enum SessionEvent {
    /// Sender was created with a HPKE key pair
    Created(WithReplyKey),
    /// Sender POSTed the Original PSBT, and is waiting to receive a Proposal PSBT
    PostedOriginalPsbt(),
    /// Sender received a Proposal PSBT
    RetrievedProposalPsbt(bitcoin::Psbt),
    /// Closed session
    Closed(SessionOutcome),
}

This is highly correlated with #1114 and #1128 and #1119 (comment), so the order in which those get merged matters.

@spacebear21 spacebear21 mentioned this pull request Oct 1, 2025
3 tasks done
@arminsabouri arminsabouri added this to the payjoin-1.0 milestone Oct 1, 2025
@zealsham
zealsham force-pushed the rename-sender-events branch 2 times, most recently from e5eec21 to ac73e71 Compare October 1, 2025 19:48
@benalleng

Copy link
Copy Markdown
Collaborator

the mutants here are being ignored until we remove terminal_error()

@zealsham

zealsham commented Oct 1, 2025 •

Copy link
Copy Markdown
Collaborator Author

@benalleng looks like #1129 added the same changes for the sender session closing variant . i'll rebase

@zealsham
zealsham force-pushed the rename-sender-events branch 2 times, most recently from a26fd35 to a1e19bd Compare October 1, 2025 23:58
Comment thread payjoin/src/core/send/v2/session.rs Resolved
Comment thread payjoin/src/core/send/v2/session.rs Resolved
Comment thread payjoin/src/core/send/v2/session.rs Resolved
@zealsham
zealsham force-pushed the rename-sender-events branch from a1e19bd to 0ed4a6f Compare October 2, 2025 09:38
@zealsham
zealsham requested a review from spacebear21 October 2, 2025 11:16

@spacebear21 spacebear21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, i noticed some formatting issues that I'm surprised weren't caught in CI.

use ohttp::ClientResponse;
use serde::{Deserialize, Serialize};
pub use session::{replay_event_log, SessionEvent, SessionHistory};
pub use session::{replay_event_log, SessionEvent, SessionHistory, SessionOutcome};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover import

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SessionOutcome isn't a leftover import here as it is needed for the different close sessionEvents variants . The current state of the code-base also refelects this change which i think was added by Ben since he worked on the close variant . i initially did the same thing which is the reason behind this comment #1125 (comment)

Comment thread payjoin/src/core/send/v2/session.rs Resolved
Comment thread payjoin/src/core/send/v2/session.rs Resolved
This renames the sender session events to describe what happened
instead of what the event produced .

Rename sender session events

Rename sender session events

Rename sender session events

Rename sender session events

Rename sender session events

Rename sender session events
@zealsham
zealsham force-pushed the rename-sender-events branch from 0ed4a6f to 5a62fa9 Compare October 2, 2025 19:24

@spacebear21 spacebear21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5a62fa9

@spacebear21
spacebear21 merged commit 5dd341c into payjoin:master Oct 2, 2025
10 checks passed
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.

6 participants