Skip to content

Release 1.166.3 - #3974

Merged
odlbot merged 6 commits into
releasefrom
release-candidate
Sep 16, 2026
Merged

odlbot merged 6 commits into
releasefrom
release-candidate

Conversation

@odlbot

@odlbot odlbot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Chris Chudzicki

Tobias Macey

cp-at-mit

blarghmatey and others added 6 commits September 15, 2026 12:51
…#3936)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…3959)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
2 changes: 0 error, 0 warning, 2 info
info	[endpoint-deprecated] at head/openapi/specs/v0.yaml
	in API GET /api/v0/products/{id}/user_flexible_price/
		endpoint deprecated

info	[endpoint-added] at head/openapi/specs/v0.yaml
	in API GET /api/v0/products/{id}/user_pricing/
		endpoint added



## Changes for v1.yaml:
2 changes: 0 error, 0 warning, 2 info
info	[endpoint-deprecated] at head/openapi/specs/v1.yaml
	in API GET /api/v0/products/{id}/user_flexible_price/
		endpoint deprecated

info	[endpoint-added] at head/openapi/specs/v1.yaml
	in API GET /api/v0/products/{id}/user_pricing/
		endpoint added



## Changes for v2.yaml:
2 changes: 0 error, 0 warning, 2 info
info	[endpoint-deprecated] at head/openapi/specs/v2.yaml
	in API GET /api/v0/products/{id}/user_flexible_price/
		endpoint deprecated

info	[endpoint-added] at head/openapi/specs/v2.yaml
	in API GET /api/v0/products/{id}/user_pricing/
		endpoint added



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

Comment thread ecommerce/api.py
# discount_product resolves a paid-amount-off winner's source to price
# it and discards the line; resolving that one discount a second time
# is cheaper than threading the line out through every pricing caller.
source_line=source_line_for(best, user, [product]) if best else None,

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: A race condition in quote_user_price may cause a paid-amount-off discount to be returned with a null source because the source line is resolved twice without locking.
Severity: MEDIUM

Suggested Fix

Refactor quote_user_price to resolve the discount and its source line in a single step. The discount_product function should return both the calculated price and the source line it used, preventing the need for a second, racy resolution via source_line_for.

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#L1323

Potential issue: A race condition exists in the `quote_user_price` function. The price
for a `paid-amount-off` discount is calculated by resolving an unconsumed source line,
but this result is discarded. The source line is then re-resolved later in the function
to be included in the API response. Between these two resolution steps, a concurrent
request could consume the same source line. This would cause the second resolution to
fail, resulting in the API response correctly showing the discount amount but
incorrectly reporting the `source` as `null`, creating a logical inconsistency for API
clients.

Also affects:

  • discount_sources.py:176-182

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

@odlbot
odlbot merged commit fff916e into release Sep 16, 2026
27 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