Skip to content

Conversation

@codenem
Copy link
Contributor

@codenem codenem commented Feb 3, 2026

Fixes ENG-133

TODO

  • authz actions
  • mcp
  • add fields to member update / creation requests
  • update profile
  • fix e2e tests
  • member detail page or modal
  • links /people/ to /users/
  • n8n

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

    • Adds profile fields (incl. organization_id) and identity linkage; inserts profiles active/inactive from contract_end_date.
    • Adds profile_id FKs across assets/documents/tasks/vendors and backfills from People.
    • Creates identities, memberships, and profiles from People; converts iam_invitations.email to CITEXT[] and expires replaced invitations.
    • Removes People from n8n and deletes People GQL operations.
  • Refactors

    • Replaces People with Profile in API/UI (owners/assignees/signedBy/meeting attendees); updates resolvers, PDF export, console/MCP schema to MembershipProfile.
    • Adds IAM user page with edit/remove; enables profile updates via new UserForm mutation; links /people to /users; updates authz to iam:membership-profile and iam:membership.
    • Implements ListProfiles resolver and fixes profiles list pagination/filters; updates permissions/queries to profiles and emailAddress.
    • Fixes FK column refs and missing DB tags for signatures; ensures nameless identities get full_name; stabilizes e2e tests.

Written for commit 3418d05. Summary will update on new commits.

@codenem codenem force-pushed the people-to-profiles-migration branch 15 times, most recently from acf8280 to 21da97b Compare February 6, 2026 16:05
@codenem codenem marked this pull request as ready for review February 6, 2026 16:05
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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>
Signed-off-by: Émile Ré <emile@getprobo.com>
@codenem codenem force-pushed the people-to-profiles-migration branch from ffedb44 to 821346c Compare February 9, 2026 06:57
Signed-off-by: Émile Ré <emile@getprobo.com>
Signed-off-by: Émile Ré <emile@getprobo.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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)
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 9, 2026

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>
Fix with Cubic

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.

1 participant