mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 18:19:05 +02:00
The /companies/:companyId/live-runs route was inflating its response by
padding with up to 50 recent (non-live) heartbeat runs whenever a caller
didn't pass `minCount`. The Sidebar's "Dashboard NN live" badge reads
the array length from this endpoint, so every company saw "50 live" even
when only a handful of runs were actually queued or running.
Regression introduced by 6445bef9 ("Harden issue recovery reliability"),
which capped both `minCount` and `limit` at 50 with a fallback of 50
including for omitted values. The cap is correct for `limit` (a real
unboundedness guard); for `minCount` it conflates "no padding" with
"pad to the cap" and is what produced the bogus counts.
- Default `minCount` to 0 so callers asking for "live runs" only get
actually-live runs unless they explicitly request padding.
- Keep `limit` capped at 50 by default to preserve the bound on response
size.
- Add tests for the no-pad default and for explicit padding behavior so
the contract stays clear.
Co-Authored-By: Paperclip <noreply@paperclip.ing>