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

feat: refactor credentials fetching #3183

Merged
merged 3 commits into from
Mar 26, 2023
Merged

feat: refactor credentials fetching #3183

merged 3 commits into from
Mar 26, 2023

Conversation

alnr
Copy link
Contributor

@alnr alnr commented Mar 22, 2023

This change revamps the way we fetch identity credentials. We no longer need most of the helper fields for gobuffalo/pop inside the Identity and Credentials structures, and we collect all the credentials in one joined query rather than using pop's EagerPreload functionality.

@alnr alnr force-pushed the credentials-join branch 2 times, most recently from 6639d4d to ed9355e Compare March 22, 2023 17:07
@alnr alnr marked this pull request as ready for review March 22, 2023 17:13
@alnr alnr requested review from aeneasr and zepatrik as code owners March 22, 2023 17:13
@alnr alnr self-assigned this Mar 22, 2023
aeneasr
aeneasr previously approved these changes Mar 23, 2023
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Very nice changes, I think this simplifies the code a lot!

@aeneasr
Copy link
Member

aeneasr commented Mar 23, 2023

It looks like you're running into ordering issues: https://github.com/ory/kratos/actions/runs/4492557398/jobs/7902651309?pr=3183#step:15:12872

Every database handles "deafult" sorting differently. Since we don't really want to sort the dataset (as that is slow in RBR tables), my recommendation is to either sort the result set (with Go) around here: https://github.com/ory/kratos/pull/3183/files#diff-41d54e67508bfcb98af6522993d007de47a74ada2cf8426fc871c8a8a8babaeeR561

@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #3183 (9999e7f) into master (a206772) will increase coverage by 0.02%.
The diff coverage is 86.18%.

❗ Current head 9999e7f differs from pull request most recent head 0dad8c2. Consider uploading reports for the commit 0dad8c2 to get more accurate results

@@            Coverage Diff             @@
##           master    #3183      +/-   ##
==========================================
+ Coverage   77.62%   77.65%   +0.02%     
==========================================
  Files         317      317              
  Lines       20046    20089      +43     
==========================================
+ Hits        15561    15600      +39     
- Misses       3292     3295       +3     
- Partials     1193     1194       +1     
Impacted Files Coverage Δ
driver/registry_default.go 86.92% <ø> (ø)
identity/credentials.go 77.77% <ø> (-2.23%) ⬇️
identity/identity.go 91.30% <ø> (+3.24%) ⬆️
identity/identity_verification.go 70.96% <ø> (ø)
identity/test/pool.go 100.00% <ø> (ø)
selfservice/flow/verification/flow.go 92.00% <ø> (ø)
selfservice/flow/settings/flow.go 91.54% <60.00%> (ø)
selfservice/hook/verification.go 72.41% <60.00%> (ø)
persistence/sql/identity/persister_identity.go 78.32% <85.55%> (+1.68%) ⬆️
selfservice/strategy/code/strategy_verification.go 75.49% <86.20%> (ø)
... and 7 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@alnr alnr force-pushed the credentials-join branch from cd2c760 to 4643ef9 Compare March 23, 2023 09:15
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Generally speaking i think this looks really good. One issue though is how we now list identities. We had several complains from e.g. Wikia about list performance before and we were able to resolve those with EagerPreload. This patch will regress on those improvements and reintroduce those issues. See: #1412

@alnr alnr force-pushed the credentials-join branch from 97f0cae to 6bb7029 Compare March 23, 2023 13:45
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Very nice

@aeneasr aeneasr requested a review from hperl March 26, 2023 10:27
@aeneasr aeneasr merged commit 590269f into master Mar 26, 2023
@aeneasr aeneasr deleted the credentials-join branch March 26, 2023 10:27
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.

3 participants