fix: paginate GET /chat (limit + before cursor)

🟢 open · #110 · willchen96/mike ← bmersereau/mike · opened 13d ago by bmersereau · +41-4 across 4 files · ↗ on GitHub

From the PR description

Summary

  • Adds limit (default 50, max 200) and before (ISO timestamp cursor) query parameters to GET /chat
  • Prevents unbounded chat list queries for active users with large chat histories
  • Backward-compatible: existing callers with no query params get the first 50 chats (most recent)

Closes #105 Closes #114

Changes

  • backend/src/routes/chat.ts - limit + before-cursor pagination on the chat list query
  • backend/src/lib/__tests__/chatPagination.test.ts - static analysis tests verifying pagination is present
  • backend/tsconfig.json - exclude __tests__ dirs from the main tsc build (tests use vitest directly)
  • backend/package.json - "test": "vitest run" script added

Test plan

  • Unit tests added and passing (npx vitest run)
  • Backend type check passes (npx tsc --noEmit)

Our analysis

Paginate the chat list endpoint — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-110.md from inside the repo you want the changes in.

⬇ Download capture-pull-110.md