app/api/export/route.ts is the machine-readable view of the registry, and it silently truncates:
.eq("status", "approved")
.order("vote_score", { ascending: false })
.limit(1000);
Once the registry passes 1000 approved cases, /api/export returns the 1000 highest-voted ones and says nothing about the rest. A consumer building a dataset has no way to detect that they got a partial answer, and because the ordering is by vote_score the truncation is also biased toward popular cases rather than being a clean prefix.
There are related rough edges in the same handler worth doing at the same time:
- No pagination parameters at all, so there is no way to ask for the remainder.
- No
Content-Disposition header, so the CSV renders in the browser rather than downloading.
- No documented schema. The
headers array in this file is the only description of the columns that exists anywhere.
Suggested shape:
- Accept
?limit= and ?offset= (or a cursor on case_number) with a sane maximum, validated with Zod the way the other routes validate input.
- Return a header or a trailing metadata row indicating the total count so truncation is detectable.
- Add
Content-Disposition: attachment; filename="agentpostmortem-export.csv".
- Document the columns in the README next to the rest of the registry description.
Note that #20 covers CSV formula injection in the same file. Keep the two changes separate so they review independently.
If you would like to take this on, comment here to claim it. Contributors can hold two open claims at a time.
app/api/export/route.tsis the machine-readable view of the registry, and it silently truncates:Once the registry passes 1000 approved cases,
/api/exportreturns the 1000 highest-voted ones and says nothing about the rest. A consumer building a dataset has no way to detect that they got a partial answer, and because the ordering is byvote_scorethe truncation is also biased toward popular cases rather than being a clean prefix.There are related rough edges in the same handler worth doing at the same time:
Content-Dispositionheader, so the CSV renders in the browser rather than downloading.headersarray in this file is the only description of the columns that exists anywhere.Suggested shape:
?limit=and?offset=(or a cursor oncase_number) with a sane maximum, validated with Zod the way the other routes validate input.Content-Disposition: attachment; filename="agentpostmortem-export.csv".Note that #20 covers CSV formula injection in the same file. Keep the two changes separate so they review independently.
If you would like to take this on, comment here to claim it. Contributors can hold two open claims at a time.