feat: add linear service emulator#91
Open
mvanhorn wants to merge 1 commit intovercel-labs:mainfrom
Open
Conversation
Contributor
|
@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
c9c4e6f to
b2d856f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Linear service emulator. Linear is GraphQL-only, so this is the project's first GraphQL emulator. It exposes
POST /graphqlwith introspection, read-only Query resolvers forIssue/Project/Team/User/Organization/Label/WorkflowState, Relay-style pagination, and PAT authentication viaAuthorization: <api_key>.The pattern (reference
graphqlexecution library + programmatic schema + store-backed resolvers) is intentionally minimal so future GraphQL services (Shopify Storefront, parts of GitHub's API, Hashnode) can follow it.Why this matters
Linear is the dominant project tracker for modern dev teams. The official
@linear/sdkhas ~50K weekly npm downloads, and Linear-aware integrations are increasingly common — GitHub PR linking, Slack notifications, automation rules, AI agents that file issues. CI tests against Linear today either hit production (rate limits, workspace contamination) or hand-stub each query shape. There's no general-purpose emulator. WireMock can stub HTTP but cannot execute arbitrary GraphQL queries.emulate's
Storelets us back the resolvers with stateful entities; the only new dependency isgraphql@16.13.2(the reference JS execution library — Apollo / Yoga deliberately avoided to keep deps minimal).Demo
A real GraphQL query against the running emulator:
Returns:
{ "data": { "issues": { "nodes": [ { "id": "issue-1", "identifier": "ENG-1", "title": "First issue", "state": { "name": "Todo" }, "team": { "key": "ENG" } } ], "pageInfo": { "hasNextPage": false } } } }Linear API Coverage
POST /graphqlAuthorization: <api_key>headerIssueENG-1), title, description, priority, state, assignee, team, project, labelsProjectTeamUserOrganizationLabelWorkflowStateunstarted,started,completed, etc.), teamfirst,after,last,before,edges,nodes,pageInfoextensions.codeDefault port
4012(appended at the end ofSERVICE_NAME_LISTafterclerk— no other service's port shifts).What's not yet covered
issueCreate,issueUpdate,projectCreate, etc.) — separate PRWebhookDispatcher— separate PRSeed config
Tests
26 Vitest tests covering Query resolvers (organization, user, team, workflowState, label, project, issue), Relay cursor pagination, schema introspection, error envelope shape, and PAT auth validation.