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: allow listing identities by organization ID #4115

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jonas-jonas
Copy link
Member

Related issue(s)

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    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.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 78.47%. Comparing base (f7c1024) to head (5cfbf66).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
persistence/sql/identity/persister_identity.go 0.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4115   +/-   ##
=======================================
  Coverage   78.46%   78.47%           
=======================================
  Files         376      376           
  Lines       26728    26691   -37     
=======================================
- Hits        20973    20946   -27     
+ Misses       4151     4141   -10     
  Partials     1604     1604           
Flag Coverage Δ
78.47% <16.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@hperl hperl left a 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.

identity/handler.go Show resolved Hide resolved
identity/handler.go Outdated Show resolved Hide resolved
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.

Please add an index if you make this queryable

@jonas-jonas
Copy link
Member Author

@aeneasr added.

@aeneasr
Copy link
Member

aeneasr commented Sep 23, 2024

@jonas-jonas
Copy link
Member Author

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?

   	       ERROR: transaction committed but schema change aborted with error: (23505): failed to ingest index entries during backfill: duplicate key value violates unique constraint "identity_credential_identifiers_identifier_nid_uq_idx" (SQLSTATE XXA00)

@@ -0,0 +1 @@
CREATE INDEX identities_nid_organization_id_idx ON identities (nid, organization_id);
Copy link
Contributor

@alnr alnr Sep 24, 2024

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.

Copy link
Contributor

@alnr alnr Sep 24, 2024

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?

Copy link
Contributor

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.

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.

4 participants