Skip to content

feat: account provisioning and deprovisioning for Linear users#51

Merged
russellhaering merged 2 commits into
mainfrom
russell_h/account_provisioning_v2
May 15, 2026
Merged

feat: account provisioning and deprovisioning for Linear users#51
russellhaering merged 2 commits into
mainfrom
russell_h/account_provisioning_v2

Conversation

@russellhaering
Copy link
Copy Markdown
Contributor

Summary

  • Adds CreateAccount on the user resource type via organizationInviteCreate. The invitee must accept the workspace invite before a Linear User record exists, so the call returns ActionRequiredResult with the invite ID in the message.
  • Adds Delete on the user resource type via userSuspend — Linear's deprovisioning primitive (revokes access, invalidates sessions). Linear has no user hard-delete; userUnsuspend reverses it.
  • Role is read from the user_role profile field; valid values match Linear's UserRoleType enum (lowercase: admin, guest, user). Defaults to Linear's server-side default when unset.

Test plan

  • Run a sync, then baton config create-account --login someone@example.com and confirm an invite email is sent + a pending OrganizationInvite shows up in Linear's settings.
  • Confirm --profile user_role=admin produces an admin invite.
  • Invalid email → CreateAccount returns an error.
  • baton config delete-resource user <id> suspends the user; their sessions are invalidated and they can no longer access the workspace.
  • Verify userUnsuspend (via Linear UI) restores the user.

Implements AccountManagerLimited via organizationInviteCreate (invite-based;
returns ActionRequiredResult since the User only exists after the invitee
accepts) and ResourceDeleterLimited via userSuspend (Linear's deprovisioning
primitive — revokes access, invalidates sessions; Linear has no hard-delete).

Role is read from the user_role profile field (admin/guest/user, matching
Linear's lowercase UserRoleType enum); email is read from AccountInfo.Emails
or Login.
@russellhaering russellhaering requested a review from a team May 15, 2026 17:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

Connector PR Review: feat: account provisioning and deprovisioning for Linear users

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: incremental since d17828e
View review run

Review Summary

The new commits add comprehensive test coverage for the CreateAccount and Delete provisioning methods (pkg/connector/user_test.go) and the underlying CreateOrganizationInvite and SuspendUser client methods (pkg/linear/client_test.go). Tests cover email extraction priority, role validation/normalization, error paths (missing email, wrong resource type, API failure), and correct GraphQL variable construction via mock HTTP servers. No new issues found in either the test code or the previously reviewed implementation.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

httptest-based tests for CreateOrganizationInvite and SuspendUser, plus
connector-level coverage of CreateAccount (email/login fallback, role
filtering, ActionRequiredResult shape) and Delete (success, wrong resource
type, success=false).
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

@github-actions
Copy link
Copy Markdown
Contributor

General PR Review: feat: account provisioning and deprovisioning for Linear users

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: full
View review run

Review Summary

This PR adds CreateAccount (via organizationInviteCreate) and Delete (via userSuspend) capabilities to the user resource type. The implementation correctly uses the native Linear user ID from ResourceId.Resource for the suspend call, properly wraps GraphQL responses with the Data envelope (improving on older methods in the same file), validates roles against existing constants while rejecting owner, and returns ActionRequiredResult since the invited user doesn't exist as a Linear resource until they accept. Test coverage is thorough — both client-level and connector-level tests cover happy paths, error paths, and edge cases like role normalization and email fallback logic.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

Copy link
Copy Markdown

@madison-c-evans madison-c-evans left a comment

Choose a reason for hiding this comment

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

fix-ci-checks.md will help with ci issues

@russellhaering russellhaering merged commit 3953c92 into main May 15, 2026
9 of 11 checks passed
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.

2 participants