GPT-5 finding
Use of Array.prototype.toSorted may break on Node runtimes without ES2023 features
mediumbuild-releasehigh
- apps/web/app/receipts.rss/route.ts
- apps/web/scripts/backfill-benchmark-flag.ts
Array.prototype.toSorted is only available in newer Node versions (Node 20.5+). The RSS route runs in a server Node runtime, and the admin script runs under the developer’s local Node via tsx. In environments pinned to Node 18 or early Node 20, these calls will throw TypeError: toSorted is not a function, breaking the route or script execution.
Recommendation
Replace toSorted with a portable alternative: for example, `[...arr].sort(comparator)` or `arr.slice().sort(comparator)`. Alternatively, enforce Node >= 20.5 in package.json engines and CI, and document this requirement for local scripts.