Skip to content

fix: sync conflict w.r.t. username#188

Open
uwwint wants to merge 1 commit intomainfrom
fix/sync
Open

fix: sync conflict w.r.t. username#188
uwwint wants to merge 1 commit intomainfrom
fix/sync

Conversation

@uwwint
Copy link
Collaborator

@uwwint uwwint commented Mar 2, 2026

Description

Improve the resilience of scheduled Auth0-to-database sync jobs so a single bad user record no longer breaks the entire sync run.

Changes

  • Added guardrails in user sync to detect duplicate username/email conflicts before database flush.
  • Changed sync flow to skip only the conflicting user and continue processing everyone else.
  • Improved scheduler error logging so failures show real exception details and traceback.
  • Added test coverage for the conflict scenario to prevent regression.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)
  • For any new secrets, I have updated the shared spreadsheet and the GitHub Secrets.

How to Test Manually (if necessary)

  1. Trigger scheduled sync jobs (platform/group role sync).
  2. Include a known conflicting Auth0 user (same username/email already used in DB by another user).
  3. Confirm the job logs a warning for that user, skips it, and still completes successfully for others.
  4. Confirm scheduler error logs print readable exception details (no placeholder text).

@amandazhuyilan
Copy link
Contributor

Good looks to me but will leave @marius-mather to take a final lookie.

Copy link
Collaborator

@marius-mather marius-mather left a comment

Choose a reason for hiding this comment

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

all looks good to me

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