Conversation
Pull Request Test Coverage Report for Build 16004747729Details
💛 - Coveralls |
Are any of the fatal ones being caught? |
|
Yes, all of the mutants are the transient match arms, the fatal arms are all caught. Not sure if these are worthy of skipping as to the purpose of these transient errors. |
I agree. The transient errors should be caught and preferably in unit tests. Ideally we unit test each path a state transition method could take. As a first step we may want to develop some test tooling first for this first. i.e get_statex_from_test_vector(). Currently the way get into a particular state is by progressing through the entire state machine |
8cc726e to
9539e4b
Compare
|
Ok, I have created a test for all levels of the state machine that have these transient errors, except for WithContext. |
e7031ec to
391e057
Compare
We talked about this in discord. The We realized that the |
391e057 to
284873c
Compare
|
Added this note to the commit message so it will be in the history. |
284873c to
91bf47e
Compare
arminsabouri
left a comment
There was a problem hiding this comment.
Approach ACK. Just had a couple nits and I think we should move the unit tests added in persist.rs to the v2::receiver. Thanks for picking this up!
payjoin/src/send/v2/session.rs
Outdated
|
|
||
| let v2_get_context = V2GetContext { | ||
| endpoint, | ||
| endpoint: endpoint.clone(), |
There was a problem hiding this comment.
I dont see other changes that would warrant this clone? Do you remenber why we needed this?
There was a problem hiding this comment.
This was a holdout from something I reverted, I had some tests before you added some tests in #805 it can be removed
payjoin/src/receive/v2/session.rs
Outdated
| let session_context = SHARED_CONTEXT.clone(); | ||
| let events = vec![SessionEvent::Created(session_context.clone())]; | ||
|
|
||
| let uri = SessionHistory { events }.pj_uri().expect("Could not get session history uri"); |
There was a problem hiding this comment.
personal nit: with expects I think its idomatic to explain why we expect a certain condition to be true rather than an error message. i.e expect("session creation event is present")
2b6a662 to
24faaa3
Compare
|
I added a commit to make all of the relevant fields public, do you think that is ok or should they still be limited to the crate level? |
If they can be, they should be pub(crate)'d |
24faaa3 to
7d273da
Compare
A few new mutants were introduced with the push updating our session persistence. These catch the mutants by adding some new test coverage along that new code path.
The WithContext state transition should never throw an implementation error so that transient error branch should not exist and can be safely removed. This also obviously addresses the final missing mutant here as this code is not required.
7d273da to
9bd4193
Compare
arminsabouri
left a comment
There was a problem hiding this comment.
utACK 9bd4193
Just had a small nit. This is good to go as is
| let receiver = Receiver { | ||
| state: UncheckedProposal { | ||
| v1: crate::receive::v1::test::unchecked_proposal_from_test_vector(), | ||
| context: context.clone(), | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Nit: can we use the helper method defined above? (unchecked_proposal_v2_from_test_vector)
There was a problem hiding this comment.
No, the expiry time now was changed in the context above. so we need to build the receiver here.
| ), | ||
| }; | ||
| } | ||
| Err(e) => |
There was a problem hiding this comment.
Just noting this so I don't forget. Removing transient errors from this state transition does make sense right now given that we are implicitly treating all the errors as fatal. However, there are certainly transient errors here that could be resolved based on some external events. e.g changing the ohttp relays, waiting for the dir to be operational again, etc...
Closes #786
@0xBEEFCAF3 curious if you have any initial thoughts on catching all of the
MaybeFatalTransition::transient(e)mutants. Currently all of those match arms are untested at each stage of the receiver.