Skip to content

(SR-779) Add search-by-ID and release display to Linear app#85

Open
dsayerdp wants to merge 5 commits into
mainfrom
feature/sr-779-search-by-id-and-releases
Open

(SR-779) Add search-by-ID and release display to Linear app#85
dsayerdp wants to merge 5 commits into
mainfrom
feature/sr-779-search-by-id-and-releases

Conversation

@dsayerdp

@dsayerdp dsayerdp commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Two features split out of the SR-91 working branch because they go beyond that bug's scope (the SR-91 relationship fix itself is in #84):

1. Search issues by ID

  • Replaces the title containsIgnoreCase filter with Linear's searchIssues(term:) GraphQL query, so agents can find issues by identifier (e.g. ABC-123) as well as title text.
  • gql() now omits the variables key from the POST body when empty — Linear rejects an empty variables object.

2. Display releases

  • New ReleaseItem component and a Releases block on the issue view.
  • Releases property on issue list items (home page).
  • releases { id name version url stage { ... } } added to the issue GraphQL selections, with hand-rolled Release/ReleaseStage types (the vendored schema predates Linear's Releases feature).

Notes

Testing

  • tsc --noEmit clean, pnpm lint clean, pnpm test: 41 suites / 151 tests pass.
  • New unit tests: getIssuesService (searchIssues term + id-filter + releases selection), getIssueService (releases selection), gql (empty variables omitted), IssueItem (renders linked releases).

Linear: https://linear.app/deskpro/issue/SR-779/linear-app-search-issues-by-id-and-display-releases

🤖 Generated with Claude Code

Summary by Sourcery

Add issue search by identifier and surface Linear releases on issue views and listings while improving GraphQL request handling.

New Features:

  • Support searching Linear issues by free-text term that matches both identifiers and titles.
  • Display associated releases on individual issue views and issue list items, including release link and stage details.

Enhancements:

  • Extend Linear issue types with Release and ReleaseStage to support the Releases feature not present in the vendored schema.
  • Refine GraphQL query construction to reuse shared issue field selections and omit empty variables from requests.
  • Introduce pnpm workspace configuration and move dependency override configuration from package.json to workspace-level settings.

Build:

  • Bump Linear app manifest version to 1.0.25.

Tests:

  • Add unit tests for getIssuesService and getIssueService covering search-by-term, id filtering, and releases selection in GraphQL queries.
  • Add unit test for gql helper to verify empty variables objects are omitted from payloads.
  • Extend IssueItem tests to verify rendering of linked releases in the UI.

Search: replace the title containsIgnoreCase filter with Linear's
searchIssues(term:) query so issues can be found by identifier
(e.g. ENG-123) as well as title. gql() now omits `variables` from the
POST body when empty, which Linear otherwise rejects.

Releases: request releases { ... } in the issue queries, add
Release/ReleaseStage types, and render releases via a new ReleaseItem
component on issue list items and a Releases block on the issue view.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements search-by-ID for Linear issues by switching list search to use the searchIssues GraphQL API, adds support for fetching and rendering associated releases on issue list and detail views, and hardens the GraphQL helper to omit empty variables objects while adding tests around the new behavior.

Sequence diagram for getIssuesService search and GraphQL variables handling

sequenceDiagram
  actor Agent
  participant IssueListUI
  participant getIssuesService
  participant gql
  participant LinearAPI

  Agent->>IssueListUI: type search query
  IssueListUI->>getIssuesService: getIssuesService(client, { q })
  alt with_q
    getIssuesService->>gql: gql({ term: q })`query SearchIssues($term: String!) { ... }`
    gql-->>getIssuesService: JSON body with query and variables
    getIssuesService->>LinearAPI: POST /graphql searchIssues(term)
    LinearAPI-->>getIssuesService: searchIssues.nodes
  else without_q
    IssueListUI->>getIssuesService: getIssuesService(client, { ids? })
    getIssuesService->>gql: gql(variables)`query Issues($filter: IssueFilter!) { ... }`
    alt no_ids
      gql-->>getIssuesService: JSON { query } (variables omitted)
    else with_ids
      gql-->>getIssuesService: JSON { query, variables: { filter: { id: { in: ids } } } }
    end
    getIssuesService->>LinearAPI: POST /graphql issues(filter)
    LinearAPI-->>getIssuesService: issues.nodes
  end
  getIssuesService-->>IssueListUI: normalized Issue[]
  IssueListUI-->>Agent: render issues
Loading

Entity relationship diagram for Issue releases and stages

erDiagram
  Issue {
    string id
  }

  Release {
    string id
    string name
    string version
    string url
  }

  ReleaseStage {
    string id
    string name
    string type
    string color
  }

  Issue ||--o{ Release : releases
  Release ||--|| ReleaseStage : stage
Loading

File-Level Changes

Change Details Files
Add identifier-aware search for issues using Linear's searchIssues API instead of title substring filtering.
  • Introduce shared issueScalarFields and issueNodeFields snippets reused across issue queries.
  • Update getIssuesService to branch on q: when present, call searchIssues(term: $term) and normalize IssueSearchResult nodes; when absent, fall back to the existing issues(filter: $filter) query.
  • Ensure both search and list queries request the same related fields via the shared issueNodeFields selection, and keep the id list filter path intact.
  • Add unit tests to verify that searchIssues is used for q, that id filters still use issues(filter:), and that releases are requested for both query shapes.
src/services/linear/getIssuesService.ts
src/services/linear/__tests__/getIssuesService.test.ts
Model Linear releases in the client and surface them in both the issue list item and issue detail views.
  • Extend the Issue type to include a releases: Release[] field and define Release/ReleaseStage/ReleaseStageType types to mirror Linear's live schema.
  • Augment getIssueService and getIssuesService GraphQL selections to request releases { nodes { id name version url stage { id name type color } } } for issues.
  • Create a reusable ReleaseItem component to render a single release with name/version, external link, and stage label.
  • Add a Releases block to the ViewIssue page that shows a header with count and either a 'No releases found' message or a list of ReleaseItem components.
  • Render a Releases Property section within IssueItem when an issue has linked releases, and add a unit test asserting the releases UI renders correctly.
src/services/linear/types.ts
src/services/linear/getIssueService.ts
src/services/linear/__tests__/getIssueService.test.ts
src/services/linear/getIssuesService.ts
src/components/ReleaseItem/ReleaseItem.tsx
src/components/ViewIssue/blocks/Releases.tsx
src/components/ViewIssue/ViewIssue.tsx
src/components/IssueItem/IssueItem.tsx
src/components/IssueItem/__tests__/IssueItem.test.tsx
Adjust the GraphQL helper to avoid sending an empty variables object and cover the behavior with tests.
  • Update gql utility to use lodash.isEmpty to decide whether to include the variables key in the serialized request body.
  • Document the Linear API constraint about rejecting empty variables objects in a comment.
  • Add a unit test that asserts variables is omitted from the JSON payload when an empty object is passed to gql.
src/utils/gql.ts
src/utils/__tests__/gql.test.ts
Project configuration and manifest updates related to pnpm and the Linear app version.
  • Move the tmp dependency override and selective dependency build list into a new pnpm-workspace.yaml, simplifying package.json.
  • Bump the Linear app manifest version from 1.0.24 to 1.0.25.
  • Add an empty devcontainer.json scaffold (no functional changes visible in diff).
pnpm-workspace.yaml
package.json
manifest.json
.devcontainer/devcontainer.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@dsayerdp dsayerdp requested a review from AshleyDawson July 2, 2026 08:46
dsayerdp and others added 4 commits July 2, 2026 09:50
Newer pnpm versions fail install with ERR_PNPM_IGNORED_BUILDS instead
of warning when native build scripts aren't explicitly approved. Adds
onlyBuiltDependencies so pnpm install succeeds in CI (devcontainer
pins pnpm to "latest").

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI's pnpm (pinned to "latest" in devcontainer.json) no longer reads
the "pnpm" field in package.json at all, so the onlyBuiltDependencies
fix from the previous commit was silently ignored. pnpm now expects
overrides/onlyBuiltDependencies in pnpm-workspace.yaml instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI still failed after moving config to pnpm-workspace.yaml: the
devcontainer feature installs pnpm "latest" fresh on every run, and
whatever version CI resolved to (with lockfile supply-chain scanning,
newer than local 10.15.0) still hard-failed with
ERR_PNPM_IGNORED_BUILDS despite the onlyBuiltDependencies config.
Pinning to 10.15.0 (verified locally: install/typecheck/lint/tests all
pass, no ignored-builds warning) removes the version-drift root cause
instead of chasing each release's config format.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The devcontainer feature's pnpm-version input is baked into a cached
Docker layer that CI keeps reusing, so pinning "10.15.0" in the
feature config never actually took effect — every run still installed
the same bleeding-edge pnpm (visible via its "supply-chain policies"
lockfile check, present even in the very first failing run before any
of these fixes). Activating the version via corepack in
postCreateCommand runs at container start, not image build time, so
it can't be short-circuited by the cached feature layer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dsayerdp dsayerdp marked this pull request as ready for review July 2, 2026 16:09
@dsayerdp dsayerdp requested a review from a team as a code owner July 2, 2026 16:09

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The releases { nodes { id name version url stage { id name type color } } } selection string is duplicated across getIssuesService, getIssueService, and the tests; consider extracting this into a shared constant or fragment-like helper so the shape stays in sync in one place.
  • In Releases.tsx and ReleaseItem.tsx, the props interfaces share names with the components (interface Releases, interface ReleaseItem), which can be confusing; renaming these to ReleasesProps/ReleaseItemProps (or similar) will make the types easier to understand and avoid name clashes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `releases { nodes { id name version url stage { id name type color } } }` selection string is duplicated across `getIssuesService`, `getIssueService`, and the tests; consider extracting this into a shared constant or fragment-like helper so the shape stays in sync in one place.
- In `Releases.tsx` and `ReleaseItem.tsx`, the props interfaces share names with the components (`interface Releases`, `interface ReleaseItem`), which can be confusing; renaming these to `ReleasesProps`/`ReleaseItemProps` (or similar) will make the types easier to understand and avoid name clashes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant