← All products
KAI-14 Idea high

P1.3 · Linear GraphQL client with backoff + batching

What

Typed GraphQL client for Linear. Do NOT use @linear/sdk — it bloats the bundle. Write a thin fetch-based client with generated types via graphql-codegen or hand-typed.

Queries needed

  • viewer — sanity check on API key
  • team(id: $teamKey) { states, labels, issues } — bulk pull
  • issues(filter: { updatedAt: { gt: $cursor } }) — incremental pull
  • issueUpdate(id, input: { description }) — push
  • issues(filter: { id: { in: $ids } }) — batch fetch

Technical requirements

  • Exponential backoff on 429 and network errors (initial 500ms, max 30s, max 5 retries).
  • DataLoader-style batching for N individual issue(id) fetches → one issues(filter: { id: { in: [...] } }) call.
  • Request timeout: 20s.
  • All errors wrapped in typed LinearApiError classes so the sync engine can route "auth failed" differently from "rate limited".

Acceptance criteria

  • Unit tests cover: backoff logic (fake timers), batching coalesces, auth error surfaces cleanly.
  • Bundle size delta ≤ 15 KB after gzip.
Updated
2026-04-22