-
Notifications
You must be signed in to change notification settings - Fork 128
Migrate people to identities / memberships / profiles #687
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
base: main
Are you sure you want to change the base?
Conversation
acf8280 to
21da97b
Compare
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.
7 issues found across 222 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="pkg/coredata/membership_profile.go">
<violation number="1" location="pkg/coredata/membership_profile.go:454">
P0: SQL column name mismatch: CTE selects non-existent column `signed_by` but the actual database column is `signed_by_profile_id`. This query will fail at runtime.</violation>
</file>
<file name="apps/console/src/pages/iam/organizations/users/_components/MemberList.tsx">
<violation number="1" location="apps/console/src/pages/iam/organizations/users/_components/MemberList.tsx:72">
P3: The empty-state row still uses colSpan={5} even though the table now has 7 columns. Update the colspan so the “No members” cell spans all columns.</violation>
</file>
<file name="pkg/coredata/membership_profile_kind.go">
<violation number="1" location="pkg/coredata/membership_profile_kind.go:77">
P2: Scan only handles string values; database drivers often return []byte for text columns, causing valid MembershipProfileKind values to fail to scan. Handle both string and []byte in Scan.</violation>
</file>
<file name="apps/console/src/pages/iam/organizations/users/UserPageLoader.tsx">
<violation number="1" location="apps/console/src/pages/iam/organizations/users/UserPageLoader.tsx:18">
P2: The query isn't reloaded when `userId` changes because the effect short-circuits once `queryRef` exists. This can leave the page showing the previous user's data after navigating to a different user within the same session.</violation>
</file>
<file name="pkg/coredata/risk.go">
<violation number="1" location="pkg/coredata/risk.go:178">
P2: owner_profile_id now references iam_membership_profiles, so joining it to peoples.id will not match after the migration. This will leave owner_full_name NULL and break ordering/filtering by owner name. Join the membership profile table instead.</violation>
</file>
<file name="pkg/iam/organization_service.go">
<violation number="1" location="pkg/iam/organization_service.go:199">
P2: Validate the profile kind against the MembershipProfileKind enum instead of PeopleKinds to avoid mismatched/legacy validation.</violation>
<violation number="2" location="pkg/iam/organization_service.go:999">
P2: Guard against nil before dereferencing req.Position to avoid a runtime panic when the position field isn’t provided.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
apps/console/src/pages/iam/organizations/users/_components/MemberList.tsx
Show resolved
Hide resolved
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.
4 issues found across 14 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="pkg/coredata/document.go">
<violation number="1" location="pkg/coredata/document.go:716">
P1: The query now joins `iam_membership_profiles`, but the WHERE clause still references `p.primary_email_address`, which is not a column on the profiles table. This will raise a SQL error at runtime. Join to `identities` (or another source of email_address) and filter on `i.email_address` instead.</violation>
</file>
<file name="apps/console/src/pages/iam/organizations/users/UserPageLoader.tsx">
<violation number="1" location="apps/console/src/pages/iam/organizations/users/UserPageLoader.tsx:22">
P2: The effect now runs after every render, so while queryRef is null it will call loadQuery repeatedly. This can trigger redundant network requests and render loops. Restore the dependency array so it only runs when inputs change.</violation>
</file>
<file name="pkg/coredata/document_filter.go">
<violation number="1" location="pkg/coredata/document_filter.go:102">
P1: The new join targets `iam_membership_profiles`, but the query still filters on `p.primary_email_address`. That column doesn’t exist on `iam_membership_profiles`, so this SQL fragment will fail at runtime. Join to `identities` and compare `i.email_address` (or use the correct profile email column) instead.</violation>
</file>
<file name="pkg/coredata/document_version_filter.go">
<violation number="1" location="pkg/coredata/document_version_filter.go:50">
P1: The new join targets iam_membership_profiles, but the filter still uses p.primary_email_address, which doesn’t exist on that table. This will cause the SQL fragment to fail at runtime. Join identities (via p.identity_id) and compare against identities.email_address or another valid column instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Signed-off-by: Émile Ré <emile@getprobo.com>
…resolvers Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
ffedb44 to
821346c
Compare
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
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.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="pkg/server/api/console/v1/v1_resolver.go">
<violation number="1" location="pkg/server/api/console/v1/v1_resolver.go:6463">
P2: `ProfileConnection.totalCount` ignores the active filters, so totalCount reports all profiles even when the client excludes contract-ended members, leading to inconsistent pagination.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| switch obj.Resolver.(type) { | ||
| case *stateOfApplicabilityResolver: | ||
| count, err := r.iam.OrganizationService.CountProfiles(ctx, obj.ParentID) |
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.
P2: ProfileConnection.totalCount ignores the active filters, so totalCount reports all profiles even when the client excludes contract-ended members, leading to inconsistent pagination.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pkg/server/api/console/v1/v1_resolver.go, line 6463:
<comment>`ProfileConnection.totalCount` ignores the active filters, so totalCount reports all profiles even when the client excludes contract-ended members, leading to inconsistent pagination.</comment>
<file context>
@@ -6446,12 +6449,25 @@ func (r *processingActivityConnectionResolver) TotalCount(ctx context.Context, o
+
+ switch obj.Resolver.(type) {
+ case *stateOfApplicabilityResolver:
+ count, err := r.iam.OrganizationService.CountProfiles(ctx, obj.ParentID)
+ if err != nil {
+ panic(fmt.Errorf("cannot count profiles: %w", err))
</file context>
Fixes ENG-133
TODO
Summary by cubic
Migrates the legacy People model to identities → memberships → profiles, rewiring all owner/assignee references to profile IDs and removing People across the stack. Profiles now expose identity emailAddress, and the profiles list/resolvers are implemented and fixed to complete ENG-133.
Migration
Refactors
Written for commit 3418d05. Summary will update on new commits.