Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework receive::v2, send::v2 submodule into additive crate::v2 and crate::v1 submodules features #392

Open
6 tasks
DanGould opened this issue Nov 19, 2024 · 2 comments
Milestone

Comments

@DanGould
Copy link
Contributor

DanGould commented Nov 19, 2024

I don't really love how the features are laid out inside receive especially. Send is not as big of a deal because the state machine has been flattened. If there were separate modules for separate features I think they'd be easier to reason about from docs.rs

Consider removing the not(feature = v2) feature since we want to discourage its use and one can replicate v1 soverignty by running both a directory and payjoin client on the same machine. Rust features should be additive.


  • Make payjoin-cli v1 / v2 features additive
@DanGould DanGould changed the title Rework receive::v2 submodule into crate::v2 and crate::v1 submodules feature gated Rework receive::v2 submodule into additive crate::v2 and crate::v1 submodules features Dec 2, 2024
DanGould added a commit that referenced this issue Jan 2, 2025
Expose descriptive, accurate send errors so that we can switch on
them in implementations and mark payjoin sessions in persistent
storage accurately. We only want to spawn sessions that are capable
of making forward progress and drop those that cannot.

Patch overview:
1. housekeeping
2. Introduce specific SenderBuilder errors
3. make CreateRequestError v2 only since v1 can only make have sender
builder errors
4. separate the modules to reduce feature flags

This separation is incomplete because I'm still uncertain what to do
with send::ValidationError's feature gated variants. Do I make a
send::ValidationError and a send::v2::ValidationError separate? How do
those get handled in ResponseError? Does ResponseError get split into
two versions, or do I just leave a feature gated variant? That's left
for the next PR predicated on this design being an appropriate one.

Note this pays back some tech debt but leaves some slop in payjoin-cli.
Rather than making this PR 10 commits to review I left combining FeeRate
parsing to a later PR (#452).

This error puts us on the path to #392 and #403
@DanGould DanGould added this to the payjoin-1.0 milestone Jan 3, 2025
@DanGould DanGould changed the title Rework receive::v2 submodule into additive crate::v2 and crate::v1 submodules features Rework receive::v2, send::v2 submodule into additive crate::v2 and crate::v1 submodules features Jan 4, 2025
@DanGould
Copy link
Contributor Author

DanGould commented Jan 6, 2025

@nothingmuch I believe making PjUriBuilder::new into variants rather than a feature-gated set of arguments with the same method, perhaps v1::PjUriBuilder / v2::PjUriBuilder if it can't be entirely contained in the receiver state machine? is the last remaining TODO item to make the v1/v2 features additive after #464. What's the status of that refactor?

@nothingmuch
Copy link
Collaborator

nothingmuch commented Jan 6, 2025

although i initially started with PjUriBuilder due to #416, i it's way up my "call stack", as it were, feel free to proceed with such changes, at worst it will be a minor disruption for my changes to payjoin-cli

DanGould added a commit that referenced this issue Jan 7, 2025
…bstractions (#464)

This reduces the feature flag coupling toward #392 and works toward
#403.
spacebear21 added a commit that referenced this issue Jan 8, 2025
1. kills the PjUriBuilder pattern which was a feature gating hell
2. make separate receive::{v1,v2} modules to enable error separation and
additive use
3. Pass `supported_versions` from the calling module since that's where
version comes from
4. Explicitly removes non-additive not(feature = "v2") so integration
tests can all run on --all-features

We've got a ways to go to separate modules for readability, and then to
make the features in payjoin-cli additive, but we're getting there.

This is work toward #392 

This can be followed by separating the error variants into distinct
receive, receive::v1, receive::v2 types and making the v1/v2 features in
payjoin-cli additive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants