GPT-5 finding
RSS feed may exceed intended item cap by combining two independently limited streams without a final cap
lowmaintainabilitymedium
- apps/web/app/receipts.rss/route.ts
The feed assembles up to 50 same-repo and 20 cross-repo items, sorts them, and emits all without re-capping. This can yield up to 70 items, which might be larger than desired for some RSS consumers and caches. If the intent was a global cap, the current code does not enforce it.
Recommendation
After merge-and-sort, apply a final slice to a unified cap (e.g., FEED_LIMIT), or rename FEED_LIMIT to SAME_REPO_LIMIT and document that the global cap is FEED_LIMIT + CROSS_REPO_LIMIT. If a global cap is intended, implement `const items = [...].sort(...).slice(0, FEED_LIMIT)` and consider interleaving rules to avoid starving cross-repo items.