#611

linear: share the workspace fetch across panes

Openwiiiimmopened 13d ago

Several linear panes on one machine make one workspace fetch per refresh between them, and each draws its own filtered view of it.

Context / problem

linear fetches the whole workspace each pass (6 to 20 requests) and filters by team afterwards. Every pane repeats it. Linear allows 2,500 requests an hour per user, and four or five panes on a large workspace reach it. A 429 is not honoured: every pane retries each refresh. Part of stealth-factory/opscope#630.

Scope

In:

  • Split one_pass into fetch (trimmed raw nodes, stored as a reading) and derive (the board, filtered by this pane's teams). Every pane derives, including the one that fetched.
  • Two readings: the board (teams, open issues, active cycles, projects) and the flow (issues created and completed since the window start). Panes on different windows still share the board.
  • A rate-limit record: 429 with Retry-After (or X-RateLimit-Requests-Reset) stops every linear pane until then.
  • The cap flags (truncated, cycles_capped) travel with the reading.
  • The freshness row, share_readings setting, regenerated example and docs, including that issue titles are stored for up to 2 hours.

Out:

  • The project detail view (fetch_project).
  • Storing derived totals instead of rows.

Acceptance

  • Two panes with different team filters make one fetch and show different boards.
  • Panes on different windows share the board reading.
  • A 429 is honoured by every pane, and each says when it will ask again.
  • The PR states the stored reading sizes.
Agent notes
  • Fetch: one_pass() main.rs:576-820 through pages() :112 (PAGE 250, PAGE_CAP 12). Team filter applied after the fetch in team_wanted :567. Window start is midnight UTC (:586), so it is the same for every pane on a given day.
  • graphql() :70 needs tc::post_answer to see a refusal's status and headers.
  • Keys: linear.board/1:{fp}, linear.flow/1:{fp}:{days}, rate record linear.gate/1:{fp}.
  • Size (estimate): about 350 bytes per open issue; the 3,000-issue cap is about 1 MB.

Activity

1
linear-code[bot]13d ago