-
-
Notifications
You must be signed in to change notification settings - Fork 963
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: allow listing identities by organization ID #4115
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4115 +/- ##
==========================================
- Coverage 78.61% 78.59% -0.03%
==========================================
Files 378 379 +1
Lines 26936 27043 +107
==========================================
+ Hits 21177 21254 +77
- Misses 4147 4177 +30
Partials 1612 1612 ☔ 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 makes a lot of sense. I just have one comment regarding parsing the org UUID; and some tests are still missing:
- Org ID set to a valid UUID: filters
- Org ID set to an invalid UUID: 400 Bad Request
Not sure what we want to do if the Org ID points to an org that does not exist; but I think the default behaviour (just an empty list of identitites) is fine.
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.
Please add an index if you make this queryable
@aeneasr added. |
Index name is conflicting: https://github.com/ory/kratos/actions/runs/10992644668/job/30524759829?pr=4115#step:14:7531 |
I checked, and the new index doesn't exist yet, so don't think that's the problem The error also seems unrelated? Any ideas?
|
@@ -0,0 +1 @@ | |||
CREATE INDEX identities_nid_organization_id_idx ON identities (nid, organization_id); |
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 should be ... identities (organization_id,created_at);
organization_id
is sharded by NID anyway, so we can reduce index size here.
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.
Maybe (organization_id,id)
. I thought we sort by created date?
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.
We might need an index hint here, too.
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.
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 underlying query is getting pretty convoluted, and has a bunch of variations through go if statements. How can we manage that? And make sure that there is an index available for each variation?
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.
indices sort their keys anyways, so no need to add id for sorting to the index
Related issue(s)
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments