AntFleet

Disagreement · 24879b45-openai-0

Potential runtime incompatibility: use of Array.prototype.toSorted in Node.js route

solo GPT-5
repo e24ef98c·PR #10·reviewed 1 week ago

GPT-5 finding

Potential runtime incompatibility: use of Array.prototype.toSorted in Node.js route

mediummaintainabilitymedium
  • apps/web/app/receipts.rss/route.ts:47-49
Array.prototype.toSorted is a relatively new addition (ES2023) and is not available on Node.js 18, which is still common in Next.js deployments unless explicitly set to Node 20+. Next.js does not polyfill built-in prototype methods on the server runtime. If this route executes on a Node < 20 runtime, it will throw TypeError: items.toSorted is not a function, breaking the RSS endpoint.

Recommendation

Replace toSorted with a backward-compatible pattern that does not mutate input: - const items = [...sameRepoItems, ...crossRepoItems].sort((a, b) => b.pubDate.getTime() - a.pubDate.getTime()); This works on all supported Node versions and preserves the non-mutating intent by sorting a copy.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →