Skip to content

Conversation

cstockton
Copy link
Contributor

This PR implements the after-user-created hook which runs whenever a new user has been successfully created.

Summary:

  • Add triggerAfterUserCreated method to the *API object in internal/api/hooks.go
  • Update user creation paths to call triggerAfterUserCreated after a new user is persisted:
    • internal/api/anonymous.go
    • internal/api/external.go
    • internal/api/invite.go
    • internal/api/mail.go
    • internal/api/signup.go
    • internal/api/samlacs.go
    • internal/api/token_oidc.go
    • internal/api/web3.go
  • Extend createAccountFromExternalIdentity to return an AccountLinkingDecision to detect newly created accounts
  • Add full end-to-end verification of the new hook in internal/api/e2e_test.go

@cstockton cstockton requested a review from a team as a code owner September 17, 2025 20:38
@coveralls
Copy link

coveralls commented Sep 17, 2025

Pull Request Test Coverage Report for Build 17960008964

Details

  • 49 of 102 (48.04%) changed or added relevant lines in 10 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 67.658%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/api/anonymous.go 1 3 33.33%
internal/api/hooks.go 8 10 80.0%
internal/api/invite.go 1 3 33.33%
internal/api/mail.go 7 9 77.78%
internal/api/signup.go 1 3 33.33%
internal/api/web3.go 16 20 80.0%
internal/api/token_oidc.go 0 9 0.0%
internal/api/samlacs.go 0 10 0.0%
internal/api/external.go 10 30 33.33%
Files with Coverage Reduction New Missed Lines %
internal/api/mail.go 1 65.25%
Totals Coverage Status
Change from base Build 17947966352: -0.04%
Covered Lines: 13035
Relevant Lines: 19266

💛 - Coveralls

This PR implements the `after-user-created` hook which runs whenever a
new user has been successfully created.

Summary:
- Add `triggerAfterUserCreated` method to the `*API` object
  in `internal/api/hooks.go`
- Update user creation paths to call `triggerAfterUserCreated` after a
  new user is persisted:
  - internal/api/anonymous.go
  - internal/api/external.go
  - internal/api/invite.go
  - internal/api/mail.go
  - internal/api/signup.go
  - internal/api/samlacs.go
  - internal/api/token_oidc.go
  - internal/api/web3.go
- Extend `createAccountFromExternalIdentity` to return an
  `AccountLinkingDecision` to detect newly created accounts
- Add full end-to-end verification of the new hook in
  `internal/api/e2e_test.go`
@cstockton cstockton force-pushed the cs/feat-add-after-user-created-hook branch from 9ac0ed5 to e0da845 Compare September 17, 2025 21:16
@cstockton cstockton merged commit bd80df8 into master Sep 23, 2025
5 checks passed
@cstockton cstockton deleted the cs/feat-add-after-user-created-hook branch September 23, 2025 21:59
issuedat pushed a commit that referenced this pull request Sep 30, 2025
This PR implements the `after-user-created` hook which runs whenever a
new user has been successfully created.

Summary:
- Add `triggerAfterUserCreated` method to the `*API` object in
`internal/api/hooks.go`
- Update user creation paths to call `triggerAfterUserCreated` after a
new user is persisted:
  - internal/api/anonymous.go
  - internal/api/external.go
  - internal/api/invite.go
  - internal/api/mail.go
  - internal/api/signup.go
  - internal/api/samlacs.go
  - internal/api/token_oidc.go
  - internal/api/web3.go
- Extend `createAccountFromExternalIdentity` to return an
`AccountLinkingDecision` to detect newly created accounts
- Add full end-to-end verification of the new hook in
`internal/api/e2e_test.go`

Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
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.

3 participants