Skip to content

feat(api): add Linear tRPC discovery endpoints#1105

Merged
aaight merged 1 commit intodevfrom
feature/linear-trpc-discovery-endpoints
Apr 14, 2026
Merged

feat(api): add Linear tRPC discovery endpoints#1105
aaight merged 1 commit intodevfrom
feature/linear-trpc-discovery-endpoints

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 14, 2026

Summary

  • Adds 5 Linear tRPC discovery endpoints to integrationsDiscoveryRouter following the established Trello/JIRA pattern
  • Implements verifyLinear, linearTeams, linearTeamsByProject, linearTeamDetails, and linearTeamDetailsByProject
  • Adds withLinearCreds helper function consistent with the existing withTrelloCreds / withJiraCreds pattern
  • All endpoints protected, error-handled via wrapIntegrationCall, and covered by unit tests

Trello card: https://trello.com/c/69deb08491c7cec4bca301fe

Endpoints Added

Endpoint Input Description
verifyLinear { apiKey } Calls linearClient.getMe(), returns { id, name, displayName }
linearTeams { apiKey } Calls linearClient.getTeams(), returns team array
linearTeamsByProject { projectId } Resolves API key from stored credentials, returns teams
linearTeamDetails { apiKey, teamId } Calls getTeamWorkflowStates + getTeamLabels, returns { states, labels }
linearTeamDetailsByProject { projectId, teamId } Resolves stored API key, returns { states, labels }

Test plan

  • verifyLinear — success path returns id/name/displayName, API failure → BAD_REQUEST, empty apiKey → validation error, unauthenticated → UNAUTHORIZED
  • linearTeams — success path returns team array, API failure → BAD_REQUEST, unauthenticated → UNAUTHORIZED
  • linearTeamsByProject — success with stored creds, missing credential → NOT_FOUND, org access denied → FORBIDDEN, API failure → BAD_REQUEST, unauthenticated → UNAUTHORIZED
  • linearTeamDetails — success returns { states, labels }, API failure → BAD_REQUEST, empty teamId → validation error, unauthenticated → UNAUTHORIZED
  • linearTeamDetailsByProject — success with stored creds, missing credential → NOT_FOUND, org access denied → FORBIDDEN, empty teamId → validation error, API failure → BAD_REQUEST, unauthenticated → UNAUTHORIZED
  • All 7472 unit tests passing
  • Lint and type checks passing

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

LGTM — Clean addition of 5 Linear discovery endpoints that faithfully follow the established Trello/JIRA pattern in this router.

What I verified:

  • All 5 endpoints use protectedProcedure (auth), wrapIntegrationCall (error handling), and withLinearCredentials (credential scoping) — consistent with the Trello and JIRA counterparts.
  • linearCredsInput validates apiKey with z.string().min(1), matching the LinearCredentials type ({ apiKey: string }) in src/linear/types.ts.
  • The withLinearCreds helper follows the same shape as withTrelloCreds and withJiraCreds.
  • ByProject variants correctly call verifyProjectOrgAccess before credential resolution, throw NOT_FOUND on missing credentials, and wrap the Linear API call in wrapIntegrationCall.
  • linearTeamDetails and linearTeamDetailsByProject correctly use Promise.all for parallel fetching of states and labels (same pattern as trelloBoardDetails fetching lists/labels/customFields).
  • verifyLinear correctly projects only { id, name, displayName } from the getMe() response, matching the LinearUser interface.
  • Test coverage is comprehensive: auth (UNAUTHORIZED), success paths, error wrapping (BAD_REQUEST), input validation (empty strings), org access denial (FORBIDDEN), and missing credentials (NOT_FOUND).
  • All CI checks pass.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit acfa097 into dev Apr 14, 2026
9 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.

2 participants