-
Notifications
You must be signed in to change notification settings - Fork 260
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
refactor collect_session_recipients in advance of some behavioural changes #3884
refactor collect_session_recipients in advance of some behavioural changes #3884
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3884 +/- ##
==========================================
+ Coverage 84.10% 84.14% +0.03%
==========================================
Files 266 266
Lines 27724 27738 +14
==========================================
+ Hits 23318 23339 +21
+ Misses 4406 4399 -7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit odd because now recipient_devices.unsigned_of_verified_user
etc are completely unused in the IdentityBasedStrategy case. We should probably use a different return type for split_recipients_withhelds_for_user_based_on_identity
if we're going to do this.
I'd previously seen another PR from Valere making this change, and at the time dismissed it, because it felt like it was adding duplication (eg, we have to do the should_rotate logic twice) without a clear benefit. I appreciate I'm lacking the context from the later PR, so could you give me a one-liner on why you feel that duplicating that logic is a worthwhile tradeoff?
withheld_devices.extend(withheld_recipients); | ||
} | ||
let recipients = recipient_devices.allowed_devices; | ||
let withheld_recipients = recipient_devices.denied_devices_with_code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider inlining withheld_recipients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this was done in #3662 (along with inlining recipients
) so I've added that here now.
Initially, I was just trying to make #3662 easier to review, so I wasn't looking much into why the refactor was made, but IMHO, it isn't much duplication, and the code looks easier to follow. For example, in this version, it's clearer that |
Actually, looking at #3662 again, it basically also adds the |
And, having mostly re-implemented #3662 on top of this PR, another reason for the refactor is that identity-based collection needs to ensure that the user has cross-signing set up, so we already need to have a check for the collection strategy outside of the
Which leads to the somewhat awkward result that I need to move some things such as variable definitions back out to their original positions. So I'm somewhat torn as to whether it's better to actually move those things here, with the rationale that the moves make sense for what this PR does, or if it's better to leave those in place, with the rationale that it makes more sense for the end result, even though this PR gets more "trust me, it'll make sense later" thrown into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me, so if you're happy that this is progress in the right general direction, suggest you go ahead and land it.
I'm happy with this, but I don't have permissions to merge. Can you hit the button for me? BTW, the next bit that builds on top of this PR is #3896 I have some compilation issues to fix and a changelog to write, but it should be ready for review soon. |
This is part of #3662, pulled out to into a separate PR. Recent changes in
main
made it pretty much impossible to merge this section of code frommain
into that PR, and Rich wanted to see the refactoring bits separate from the behavioural changes. So I've re-written the refactoring.Pulls the
match
onsharing_strategy
outside of thefor
loop, and moves any code that is specific to one strategy into the appropriate branch.