Repository navigation
fix: make account creation idempotent and surface Linear API errors #62
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
Open
russellhaering
wants to merge
3
commits into
main
Choose a base branch
from
russell_h/create-account-existing-user
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f8cd611
fix: make account creation idempotent and surface Linear API errors
russellhaering 675b981
fix: surface GraphQL errors in account lookups and guard invite pagin…
russellhaering 1fe4c2a
fix: return FailedPrecondition for suspended users and fix lint line …
russellhaering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
A suspended account is still a duplicate, and this branch makes a deprovision/reprovision cycle unrecoverable.
Deleteon this same type callsuserSuspend(user.go:229) — Linear has no hard delete — so "suspended" is exactly the state C1's own deprovision leaves behind. The nextCreateAccountfor that email finds it here and fails, and the failure is terminal:pkg/tasks/c1api/create_account.go:53joinsErrTaskNonRetryableto whateverCreateAccountreturns without reading the gRPC code, andpkg/connectorbuilder/accounts.gobuilds no retryer (contrastresource_provisioner.go:83/:129for Grant/Revoke). So theFailedPreconditionwe added in 1fe4c2a improves how the error reads but doesn't make it retryable. There's no in-connector recovery either — we haveSuspendUserbut no unsuspend, and noenable_useraction — so someone has to reactivate in Linear's UI.Suggestion
Drop the status gate so both cases return the existing account:
Why
GetUsersalready syncs disabled users (includeDisabled: true, client.go:172) anduserResourcestamps themRESOURCE_STATUS_DISABLED(user.go:75-78), so the resource we'd return is one C1 has already seen, with accurate status. Nothing is misreported.DEPROVISIONED, justified in the comment as "a login that can never be provisioned". Okta's reversibleSUSPENDEDfalls through toAlreadyExistsResult. Linear has no deprovisioned state —userSuspendis reversible — so every collision here is the Okta-SUSPENDEDcase.userUnsuspendas anenable_useraction, not a failure on create.Separately: the message tells the operator the account "must be reactivated", but we don't expose a way to do that and
docs/connector.mdxdoesn't describe one. Worth rewording whatever happens to the branch.See also
user.goL479-497 — the DEPROVISIONED carve-out and theSUSPENDEDfall-throughinvitation.goL270-275 —AlreadyExistsResultwith no status check at all