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

fix: issue #2434: Change DIDExchange States to Match rfc160 #2461

Conversation

anwalker293
Copy link
Contributor

@anwalker293 anwalker293 commented Sep 5, 2023

Includes fixes to #2434. Changes all ConnRecord.States to match that of rfc160.

For additional information, here's the identical PR with some feedback from @dbluhm ~
Indicio-tech#151

@dbluhm dbluhm force-pushed the fix/didexchange-responder-terminal-state-to-active branch from 31dad46 to 70f59cc Compare September 5, 2023 19:00
dbluhm
dbluhm previously approved these changes Sep 5, 2023
@dbluhm
Copy link
Member

dbluhm commented Sep 5, 2023

@swcurran @usingtechnology @Jsyro Alex is on my team so, in the interest of transparency, a review from one of you guys would be appreciated. To be explicit, this technically constitutes a breaking change if your controller was dependent on the incorrect state showing up on the final webhook for DID exchange. If your implementation was using the rfc23_state, there should be no change.

@dbluhm
Copy link
Member

dbluhm commented Sep 5, 2023

Relevant comment from the original issue: #2434 (comment)

@anwalker293 spotted the issue; in the DID Exchange protocol manager, the conn_record.state is getting set to ConnRecord.State.COMPLETED.rfc23 which is equal to the string completed. This follows the pattern used elsewhere in the manager but since the states happen to align (i.e. request for rfc160 is also request for rfc23), it wasn't obvious that this was incorrect.

conn_record.state should ALWAYS be set to the string for rfc160, whether it's getting set in the connections or did exchange protocols. I think we probably should have handled the state management for these protocols differently but we're here so this is the right fix for now.

@dbluhm dbluhm linked an issue Sep 5, 2023 that may be closed by this pull request
swcurran
swcurran previously approved these changes Sep 6, 2023
Copy link
Member

@swcurran swcurran left a comment

Choose a reason for hiding this comment

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

An interesting change. Looking through “blame” — this goes back to the initial implementation of DID Exchange and then was updated later. I’m slightly concerned with the long history, but leave that to those that know more about the impact. The change itself seems right.

Copy link
Contributor

@usingtechnology usingtechnology left a comment

Choose a reason for hiding this comment

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

can we confirm if there are updates needed for abandoned?

ConnRecord.abandoned

and

routes.connections_sort_key

@dbluhm
Copy link
Member

dbluhm commented Sep 6, 2023

@usingtechnology good question and good catch -- I believe the abandoned method ought to use the rfc160 value as well (@anwalker293, one more spot to change here). I believe the routes.connections_sort_key is fine though; it's turning the string into the Enum and then checks against that, which is a good methodology.

@anwalker293 anwalker293 dismissed stale reviews from swcurran and dbluhm via c592733 September 6, 2023 19:23
@anwalker293
Copy link
Contributor Author

I think this is the only place to update! But please let me know if you spot any others! :)

Copy link
Contributor

@usingtechnology usingtechnology left a comment

Choose a reason for hiding this comment

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

Great catch, diagnosis and work by all on this issue!

@usingtechnology
Copy link
Contributor

I think this is the only place to update! But please let me know if you spot any others! :)

Those were the only 2 places that I found, and the sorting one makes sense to leave alone.

@dbluhm
Copy link
Member

dbluhm commented Sep 6, 2023

Before we merge, I'm going to check in with some other members of our team at Indicio about the impact of this change on controller work. I'll report back with their input.

@dbluhm
Copy link
Member

dbluhm commented Sep 6, 2023

Heard back from them: as it happens, because of this inconsistency between the connections and DID Exchange webhooks, our controller work has treated active and completed the same way. So this change will not be breaking for us and it seems likely that those who have walked a similar path as us may have a similar equivalency in their controllers. Do we have any other controller authors on hand that we can ping for input? @swcurran

@swcurran
Copy link
Member

swcurran commented Sep 6, 2023

As I understand this, the impact on Controllers will be that the state of a connection as reported in webhooks will be different than previously. We have one controller in the BC Gov world (@marcos-carretero) that I suspect might break. Most controllers use —auto-accept and so will not see it, but that one is not using —auto… so is explicitly watching for state changes.

Questions:

  • From what I read, the only difference is completed will become active. Will any other state changes be seen?
  • What release/PR did this regression occur?

Thanks!

@dbluhm
Copy link
Member

dbluhm commented Sep 6, 2023

Questions:

  • From what I read, the only difference is completed will become active. Will any other state changes be seen?
  • What release/PR did this regression occur?

Correct, no other state changes, just completed -> active and only when doing DID Exchange. The connections protocol webhooks are correct.

This was introduced at the same time DID Exchange was introduced. At least according to your previous message investigating the blame 😄 Given that the webhooks existed previous to that and had the correct states associated with it for the connections protocol, I'm still inclined to call this a regression.

Signed-off-by: Alex Walker <alex.walker@indicio.tech>
Signed-off-by: Alex Walker <alex.walker@indicio.tech>
Signed-off-by: Alex Walker <alex.walker@indicio.tech>
Signed-off-by: Alex Walker <alex.walker@indicio.tech>
Signed-off-by: Alex Walker <alex.walker@indicio.tech>
@dbluhm dbluhm force-pushed the fix/didexchange-responder-terminal-state-to-active branch from c592733 to b8b043e Compare September 6, 2023 21:11
@sonarcloud
Copy link

sonarcloud bot commented Sep 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@dbluhm dbluhm merged commit 85d68b1 into hyperledger:main Sep 6, 2023
8 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.

Regression: DID Exchange webhook state with "completed"
4 participants