gauravsharmaGG/mergejudge-free-test #1 Add average helper
free-ai · diff · comment updated 2026-10-23⚖️ MergeJudge
Why this lane? needs review: touches src/math.js: code file (always needs human review); rubric cor.logic failed
Adds an average helper to src/math.js. The loop condition is off-by-one and iterates past the end of the array, adding an undefined value and producing NaN for non-empty inputs.
Overall lane: 🟡 review
Files needing human review
| File | Lane | Source | Reason |
|---|---|---|---|
| src/math.js | 🟡 review | rule + LLM + rubric | code file (always needs human review); rubric cor.logic failed; AI: New helper has an off-by-one loop bug that breaks the average computation |
Rubric: 4 pass · 2 fail/unverified · 1 n/a
- ❌
cor.logichigh (src/math.js:14): The loop runs one past the end of the array, so average returns NaN for non-empty inputs. → raised to review - ❌
cor.testslow 1/5 (src/math.js:11): No tests added for the new average helper.
All criteria
- ✅
sec.no-secrets: No credentials or secrets added. - ✅
sec.no-exfiltration: No network or data transfer code involved. - ✅
sec.no-unsafe-exec: No eval or shell execution present. - ✅
sec.input-handling: No HTML or untrusted string sinks used. - ❌
cor.logic: The loop runs one past the end of the array, so average returns NaN for non-empty inputs. - ➖
cor.errors: No error-handling paths in this simple helper. - ❌
cor.tests1/5: No tests added for the new average helper.
Feedback for MergeJudge
- Correct
- Too lenient
- Too strict
- Wrong reason
- Missed something
Rubric feedback (tick what you checked: wrong = a false alarm, right = a real problem)
- cor.logic: wrong
- cor.logic: right
- cor.tests: wrong
- cor.tests: right
Tick a box (or comment /mergejudge learn <note>) — feedback is stored on the mergejudge-learning branch, never in this PR.
Mode: @cf/deepseek-ai/deepseek-v4.1-flash-1017 · ~1363 tokens (estimate) · tokens system 363/policy 0/rubric 318/diff 215/out 467 · MergeJudge doesn't merge PRs itself.
Free AI review 2 of 10 this month
Line comments (1)
src/math.js:14(opens GitHub in a new tab)⚖️ MergeJudge (LLM): Loop condition should be i < values.length; i <= length reads values[length] (undefined) and makes total NaN
@@ -6,3 +6,11 @@ export function sum(values) { for (const v of values) total += v; return total; } + +/** Returns the average of a list of numbers (0 for an empty list). */ +export function average(values) { + if (values.length === 0) return 0; + let total = 0; + for (let i = 0; i <= values.length; i++) total += values[i];