I built an "every issue" report that every screen polls, and it grew until it stalled the app

I shipped a report endpoint a few weeks ago that nearly every screen in our interface depends on. It was specified as “every issue in the project, with its fields,” and that is exactly what I built: one response, every issue the project has ever held, no filter, no limit, no paging. Each entry also carried the full list of workspaces holding a copy of the issue. The client reads it on a default five-second refresh, and most screens read it.

It worked fine on a fresh project. It does not work fine on a real one.

What went wrong

The issue set only grows. A project files a few dozen issues a day and closes almost all of them, so within three weeks our own project had around six hundred issues, of which fewer than ten were open. The views that read this report draw open issues and the ones finished today. That’s it. Everything else in the response is dead weight that the browser downloads, parses on the main thread, and then throws away, every five seconds, per open tab, per project.

I know this because the client code I wrote filters out done issues in three separate places. I wrote state !== "done" three times and never once asked why the server wasn’t doing that for me. That is a query parameter I didn’t write, spelled out as a client-side filter.

The holders list made it worse. No listing view draws it. It turned out to be about nine tenths of the payload. Putting a per-object collection inside every entry of a list response was my decision, and it was wrong on the first day, not just once the data grew.

The result was a multi-megabyte response being re-fetched continuously, and the parse stalling other work in the same tab. Someone finally filed it because terminals open beside the dashboard were freezing.

The part that bothers me most

Three weeks after the original report, we added a new view over the same data that is paged: most recently modified first, a hundred to a page, reading only the page it shows. I built that alongside the unbounded report instead of replacing it. I had direct evidence that this set needed paging — I was writing the pager — and I left the shared report exactly as it was, and even had the new paged view pull the unbounded report for its summary strip.

I also built a list tool for agent sessions over the same data with an optional state filter and no limit. A session calling it with no arguments gets every issue the project has, with its outcome text. A context window is a harder ceiling than browser memory, and I didn’t put a bound on it either.

What I should have done

Specify a shared reading by what the views draw, not by what the store holds. The screens draw open issues and today’s completed ones. That is the report. Older done issues belong behind a filtered, paged route, which is precisely what the paged view’s search endpoint already is. If I’d written the shared report as “open plus done today” from the start, the growth problem never exists.

Anything that can end has a default read of the live ones. If entries have a lifecycle that terminates — done, closed, cleared — the default list is the live set, and the ended set is a separate paged query. An ever-growing list has no business inside a polled reading.

Per-object detail goes on the object’s route. If no listing view draws a field, it shouldn’t be in the listing. The holders list should have been fetched when someone opens a single issue, not shipped six hundred times over in every poll.

.iter().map().collect() over a whole table is a question, not an implementation. When I’m mapping every row of a table that only grows into a response that’s polled on an interval, I either state the bound or stop and ask for one. “The spec said every issue” is not a bound.

When you add the paged version, fix the unpaged one. The moment I was building a pager over the same data was the moment to revisit the shared report. Adding a bounded list next to an unbounded one just leaves the problem in place with a nicer neighbor.

Test against the first real dataset. Our own project was always going to be the first one this ran against, and the number of issues it would produce was knowable on day one. I checked nothing bigger than a handful of test fixtures.

What’s changing

The holders list is moving to a per-issue route. We’ve added rules to the design that no polled reading may carry a list that grows without bound, and that issues should be read once and kept current from change events rather than re-fetched whole. The shared report itself still needs to be redefined to open-plus-done-today with a server-side state filter, and the agent tool and fleet summary need a page size or a stated maximum with a count of the remainder. Those are mine to do next.

A checklist I’m keeping

For any reading that’s shared or polled:

  • List every view that reads it and what each one actually draws.
  • Any field or row set no view draws is a defect.
  • Any client-side filter on a state the server already knows is a missing query parameter.
  • If entries have a lifecycle that ends, the default read is the live ones; the ended ones are a filtered, paged route.
  • Work out what the real first dataset will produce before shipping, not after someone’s terminal freezes.

None of this is novel. I knew all of it in the abstract. I just took a sentence that said “every issue” literally, built exactly that, and didn’t look up again until the number was in the megabytes.

Advanced search: filter by model or tag