Skip to content

Migrate user identity matching off stem user id drupal - #2609

Open
A-Wheeto wants to merge 5 commits into
mainfrom
eng-2264-migrate-user-identity-matching-off-stem_user_id-drupal-id
Open

Migrate user identity matching off stem user id drupal#2609
A-Wheeto wants to merge 5 commits into
mainfrom
eng-2264-migrate-user-identity-matching-off-stem_user_id-drupal-id

Conversation

@A-Wheeto

Copy link
Copy Markdown
Contributor

No description provided.

…stem_user_id

CRUP is permanently removing drupal_id (Auth0's integrationkey claim) stem_user_id was required, unique, and used as the login-matching key in User.from_auth, so every real Auth0 login would start failing once that claim disappears in production.

stem_achiever_contact_no (Dynamics/Achiever contact ID) is the durable identifier instead - lookup now orders by last_sign_in_at so accounts with a pre-existing duplicate achiever_contact_no resolve to whichever was most recently active, and stem_user_id is only overwritten when a login actually supplies one, so it won't get silently wiped for existing users once integrationkey stops being sent

ENG-2264
report_generation.rake writes user.stem_user_id into this NOT NULL column on every scheduled run. Once real users start having no stem_user_id, that scheduled job would hard-fail on every batch containing one

ENG-2264
… API

Forget only accepted stem_user_id as a lookup param, which is going away

ENG-2264
@A-Wheeto
A-Wheeto temporarily deployed to teachcomputing-pr-2609 August 19, 2026 13:24 Inactive
The presence/uniqueness validation on stem_achiever_contact_no only catches conflicts sequentially - two concurrent first-time logins for the same contact number can both pass the Rails-level check before either commits, since it's just a SELECT that can't see the other's uncommitted insert. A DB-level constraint is the only thing that's atomic across concurrent transactions.

ENG-2264
@A-Wheeto
A-Wheeto temporarily deployed to teachcomputing-pr-2609 August 20, 2026 14:41 Inactive
@sonarqubecloud

Copy link
Copy Markdown

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