Skip to content

linear: cursor pagination + set entry from createdAt#1196

Merged
ryneeverett merged 2 commits intoGothenburgBitFactory:developfrom
lxcode:fix/linear-pagination
Apr 8, 2026
Merged

linear: cursor pagination + set entry from createdAt#1196
ryneeverett merged 2 commits intoGothenburgBitFactory:developfrom
lxcode:fix/linear-pagination

Conversation

@lxcode
Copy link
Copy Markdown
Contributor

@lxcode lxcode commented Apr 7, 2026

Two related fixes for the Linear service.

1. Pagination

The Linear GraphQL service issues a single query without first: or cursor pagination, so Linear's Relay-style issues connection returns only its default page size (50 issues) and any remaining matches are silently dropped. Workspaces with more than 50 matching issues miss the overflow on every pull.

The fix requests first: 250 (Linear's documented maximum) and follows pageInfo.endCursor until hasNextPage is false. get_issues becomes a generator that streams pages, so memory stays flat regardless of total issue count. The issues() caller already iterated lazily, so no caller updates are needed.

A new test (test_issues_paginates) registers two paginated mock responses and asserts both pages' issues are returned and that the second request carries the cursor returned by the first.

2. Set entry from Linear createdAt

Without this, freshly imported Linear issues have entry set to the local pull time, so entry.age and the urgency age coefficient see every imported issue as brand-new regardless of its real upstream age. Mirrors the pattern already used by several other services.

The existing test_to_taskwarrior and test_issues dict-equality assertions are updated to expect the new key.

lxcode added 2 commits April 7, 2026 15:46
The Linear GraphQL service issued a single query without ``first:`` or
cursor pagination, so Linear's Relay-style ``issues`` connection returned
only its default page size (50 issues) and any remaining matches were
silently dropped. Workspaces with more than 50 matching issues had the
overflow missing from taskwarrior on every pull.

Add ``first: 250`` (Linear's documented maximum) and follow
``pageInfo.endCursor`` until ``hasNextPage`` is false. ``get_issues``
becomes a generator that streams pages, so memory stays flat regardless
of total issue count. ``issues()`` already iterated lazily, so no caller
updates are needed.

Add a test that registers two paginated mock responses and asserts both
pages' issues are returned and that the second request carries the
cursor returned by the first.
Without this, freshly imported Linear issues have ``entry`` set to the
local pull time, so ``entry.age`` and the urgency age coefficient see
every imported issue as brand-new regardless of its real upstream age.
Mirrors the pattern already used by several other services.
@lxcode lxcode changed the title linear: paginate issues query to fetch beyond default 50 linear: cursor pagination + set entry from createdAt Apr 7, 2026
@ryneeverett ryneeverett requested a review from djmitche April 7, 2026 15:44
Copy link
Copy Markdown
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@ryneeverett ryneeverett merged commit 50ba401 into GothenburgBitFactory:develop Apr 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants