Claude Sonnet 5 vs GLM 5.2 for code review

The verdict

Effectively a dead heat: 8987

Same 12 code review tasks, marked blind by three rival labs. Claude Sonnet 5 took 4 tasks, GLM 5.2 took 2, 6 tied. Tested 18 Aug 2026.

Where they differed most

The task — The pagination that skips page one

Review this function. Context you can rely on: `page` is 1-based — the public API docs promise that page=1 returns the first page; `items` is always an array and may be empty; `perPage` is taken straight from a query string. function pageOf(items, page, perPage) { const start = page * perPage; const rows = items.slice(start, start + perPage); const lastPage = Math.ceil(items.length / perPage); return { rows, total: items.length, lastPage, hasNext: page <= lastPage }; } List the real defects, most damaging first, and for each one say what a user of the API would actually SEE — not what the code does, what they notice. Then give the corrected function. Do not list style preferences as defects.

## Defects, most damaging first

**1. `start = page * perPage` — page=1 doesn't return the first page**
Since `page` is documented as 1-based, `page=1` should map to `start=0`. Instead `start = 1 * perPage`, which skips the entire first page.

**What the user sees:** They call the API with `page=1` (per the docs, "the first page") and get back the *second* page of data. The first `perPage` items are never retrievable through the API at all — no combination of page numbers ever returns them. This silently corrupts every paginated response and vi…
## Real defects, most damaging first

### 1. The first page of data is unreachable (1-based `page` not adjusted)
`start = page * perPage` assumes 0-based paging. Since the API promises `page=1` is the first page, the correct offset is `(page - 1) * perPage`. As written, `page=1` produces `start = perPage`, so the first `perPage` items are skipped entirely — and since `page=0` isn't a valid input, those items can never be returned by any page.

**What the user sees:** They request page 1 and get what should have been page 2. The very first recor…

Task by task

TaskClaude Sonnet 5GLM 5.2
The pagination that skips page one68
Nothing wrong with it88
Three things wrong in six lines89
Two customers, one last item99
Rank by what breaks108
The review, as JSON98
Slow is not the same as wrong1010
Overdue at one in the morning97
Write only the comment1010
The complaint that is not a defect88
Right, and unusable1010
Refuse the rubber stamp109

Full receipts: Claude Sonnet 5, GLM 5.2 · judges gemini-3.1-pro-preview, gpt-5.6-terra, grok-4.5

Questions people ask

Which is better for code review: Claude Sonnet 5 or GLM 5.2?

Effectively a dead heat: Claude Sonnet 5 edged it 89/100 to 87/100 on our code review suite — too close to matter, so pick on price or the product you already use.

How was this tested?

Both models answered the identical published code review tasks. Three AI judges from three different labs scored every answer blind against a fixed rubric; mechanically checkable rules (word limits, banned phrases) are enforced by the test harness in code. The raw outputs and judge verdicts are downloadable.

More code review head-to-heads: Claude Sonnet 5 vs GPT-5.6 Sol · GLM 5.2 vs GPT-5.6 Sol · Claude Sonnet 5 vs GPT-5.5 · GLM 5.2 vs GPT-5.5 · Claude Sonnet 5 vs Grok 4.5 · Claude Sonnet 5 vs Kimi K3

Full ranking: Best AI for code review · model pages: Claude Sonnet 5, GLM 5.2