Skip to content

Release 1.166.7 - #3985

Merged
odlbot merged 3 commits into
releasefrom
release-candidate
Sep 17, 2026
Merged

odlbot merged 3 commits into
releasefrom
release-candidate

Conversation

@odlbot

@odlbot odlbot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Chris Chudzicki

Comment thread ecommerce/api.py
Comment on lines +1454 to 1457
amount=100,
)

if existing_discount_qs.exists():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The new, more restrictive filter for program discounts may fail to find pre-existing, manually-edited discounts, leading to the creation of duplicates.
Severity: LOW

Suggested Fix

To prevent creating duplicates, the lookup for existing program discounts should be less restrictive. Consider only filtering by a unique, immutable identifier for program discounts, such as redemption_type=REDEMPTION_TYPE_INTERNAL. Alternatively, if the discount_type and amount must be fixed, add a data migration to normalize any existing, manually-edited program discounts to match the new expected values.

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: ecommerce/api.py#L1454-L1457

Potential issue: The logic to find an existing program discount was changed to filter on
`redemption_type=INTERNAL`, `discount_type=DISCOUNT_TYPE_PERCENT_OFF`, and `amount=100`.
Previously, the lookup was less restrictive. If a program discount was manually edited
in the admin panel to have a different `discount_type` or `amount` before this change,
the new, more restrictive filter will fail to find it. This will cause the system to
create a duplicate discount for the program, which could cause issues in the critical
enrollment flow.

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

@odlbot
odlbot merged commit 4f3b6c2 into release Sep 17, 2026
25 of 26 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.

2 participants