Skip to content

Release 0.67.1#3328

Merged
odlbot merged 5 commits into
releasefrom
release-candidate
May 11, 2026
Merged

Release 0.67.1#3328
odlbot merged 5 commits into
releasefrom
release-candidate

Conversation

@odlbot
Copy link
Copy Markdown
Contributor

@odlbot odlbot commented May 11, 2026

Danielle Frappier

Zaman Afzal

Carey P Gumaer

gumaerc and others added 5 commits May 11, 2026 11:09
* add refactor plan document

* add inital adapters and view models,

* add some suggested documentation changes
…#3324)

* feat: added welcome to learner email once he login for the first time
* fix: 404 on product pages when live=false
* fix: prevent metadata generation for non-live product pages
@github-actions
Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Comment thread authentication/views.py
Comment on lines +104 to 106
send_welcome_email.delay(request.user.id)
profile.has_logged_in = True
profile.save()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: A failure during profile.save() after dispatching the send_welcome_email task could cause multiple welcome emails to be sent to a user on subsequent logins.
Severity: MEDIUM

Suggested Fix

Move the send_welcome_email.delay() call to after the profile.save() call has successfully completed. Alternatively, wrap the state change and the task dispatch in a database transaction using transaction.on_commit to ensure the task is only enqueued if the database write is successful. Adding an idempotency check within the send_welcome_email task would also prevent duplicates.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: authentication/views.py#L104-L106

Potential issue: The `send_welcome_email.delay()` Celery task is dispatched before the
database transaction that sets `profile.has_logged_in = True` is committed.
Specifically, the task is queued at line 104, but the `profile.save()` call that
persists the state change is at line 106. If `profile.save()` fails due to a transient
database error, the `has_logged_in` flag remains `False`. However, the welcome email
task has already been enqueued. On every subsequent login attempt, the `if not
profile.has_logged_in` condition will evaluate to true, causing another welcome email to
be dispatched until the save operation finally succeeds. The `send_welcome_email` task
lacks idempotency checks, so it sends an email every time it is invoked.

Did we get this right? 👍 / 👎 to inform future reviews.

@odlbot odlbot merged commit 2ecabc5 into release May 11, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants