Skip to content

test: native stacked OCR review — upper layer before parent merge - #17

Open
zehongye-gaga wants to merge 1 commit into
test/stacked-20261101-afrom
test/stacked-20261101-b
Open

zehongye-gaga wants to merge 1 commit into
test/stacked-20261101-afrom
test/stacked-20261101-b

Conversation

@zehongye-gaga

Copy link
Copy Markdown
Collaborator

Dependent layer above #16, intentionally kept unmerged. Verify native GitHub stack membership and automatic OCR review after ready_for_review while #16 is still open. The weighted-average fixture intentionally contradicts its zero-weight contract so the review can demonstrate an inline finding on this layer. Test only; do not merge.

AI disclosure: prepared by OpenAI Codex (GPT-6).

@zehongye-gaga
zehongye-gaga added this pull request to stack #18 November 1, 2026 12:32
@zehongye-gaga
zehongye-gaga marked this pull request as ready for review November 1, 2026 12:32

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Review complete · b7873f9

This review found 1 issue(s), including 1 blocking issue(s).

return average(values)
if len(values) != len(weights):
raise ValueError("values and weights must have the same length")
return sum(value * weight for value, weight in zip(values, weights)) / sum(weights)

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 · medium
A zero total weight raises ZeroDivisionError instead of returning the promised 0. For example, weighted_average([10], [0]) and weighted_average([], []) both reach this division with a zero denominator. Compute the total weight first and return 0 when it is zero, preserving the existing None fallback and length validation.

Suggestion:

Suggested change
return sum(value * weight for value, weight in zip(values, weights)) / sum(weights)
total_weight = sum(weights)
if total_weight == 0:
return 0
return sum(value * weight for value, weight in zip(values, weights)) / total_weight

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