Repository navigation
feat(jira): connect Jira Data Center and scope issues with JQL - #3390
bgoewert-seiler wants to merge 11 commits into
Conversation
The Jira integration gains a third sign-in option, "Personal access token (Data Center)", taking a site URL and a token. Data Center serves only REST v2, so these accounts verify against the site's own /myself and list and search issues through /rest/api/2/search instead of Cloud's enhanced search. Data Center users have no accountId, so the account is keyed by the user key with the username as its login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each Jira sign-in method gains an optional "Issue filter (JQL)" field, such as `project = WEB`. When set, the issue list shows what the filter matches instead of the last 90 days of activity, and searches are ANDed with it. A filter containing ORDER BY is rejected at connect time, since issues are always sorted by last update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilter Project settings show a "JQL filter" field under the Jira account row, such as `"Epic Link" = WEB-123`. It is ANDed with the account's own filter, so an account scoped to `project = WEB` can be narrowed per repository. A blank filter clears it. Issue plugins opt in by declaring an `issueFilter` field in their issues descriptor; the host stores filters per provider in the project's durable settings and passes the project's filter to list and search as `issueFilter`. Jira is the only provider that declares one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Connecting Jira with an http:// site URL now fails with a message asking for https://, since the API token, OAuth token or personal access token travels as a request header and would cross the network unencrypted. A Jira on localhost is still allowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
[Medium impact] The changes affect Jira connections and issue lists, including existing Cloud users. Fix the failing test types and the Jira account collision before merging. Findings
Fix with agent prompt### Issue 1
apps/emdash-desktop/src/core/features/projects/browser/components/settings-view/sections/integration-accounts-section.browser.test.tsx:126
Both new browser tests pass `projectId` to `IntegrationAccountsSection`, but the component has no such prop. These tests are included in the browser TypeScript program, so they fail typechecking. Remove the extra prop here and in the second case at line 161.
### Issue 2
packages/plugins/src/integrations/impl/jira/client.ts:90-94
If two Data Center instances share a host but use different paths and the same `user.key`, this code gives them the same account identity. For example, `https://jira.example.com/jira-a` and `https://jira.example.com/jira-b` both produce the same `host`, with no separate `scope`. Connecting the second instance replaces the first account's saved credentials, so projects pinned to that account switch sites. For PAT accounts, use the normalized full site URL as `scope`.
### Issue 3
apps/emdash-desktop/src/core/features/projects/browser/components/settings-view/use-project-settings-form.ts:162-165
Saving the new project filter does not refresh cached issue results. `useIssues` keys lists and searches by project and account, but not by `issueFilters`, and saving settings does not refresh those queries. Open the picker, save a narrower filter, then reopen it: the old list can remain for 60 seconds, and repeated searches can reuse old results for 30 seconds. Include the saved filter in the query keys and search context, or refresh the affected queries after saving.
### Issue 4
packages/plugins/src/integrations/impl/jira/types.ts:74-75
`jqlHasOrderBy` also matches text inside quoted values. A valid filter such as `summary ~ "order by"` is rejected even though it contains no sorting clause. This blocks account sign-in with that filter and prevents project issue queries from running. Ignore quoted strings and escaped quotes when checking for `ORDER BY`, and add a test for a quoted value.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds Jira Data Center PAT sign-in and account/project JQL filters.
Acknowledgment: Checks were based on source and configuration; no runtime or visual verification was performed. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Account JQL filter] --> Q[Shared Jira query builder]
P[Project settings] --> D[Stored provider filter]
D --> I[Issue provider adapter]
I --> Q
S[Search text or recent activity] --> Q
Q --> N[Exclude Done and sort]
N --> M{Sign-in method}
M -->|PAT| V2[Jira REST v2]
M -->|Cloud| V3[Jira enhanced search]
Reviews (1) · Last reviewed commit: "fix(unreleased): reject Jira issue filte..." · Reviewed by Greptile |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eir full URL Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… filter Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…hanges Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
I don't know know others preference, but I just thought to include a setting to optionally exclude those instead of forcing it. Let me know if that is preferred and increases the change to merge. Would like to see this on main since I use this daily. |
Description
The Jira integration only signs in to Atlassian Cloud, so self-hosted Jira cannot connect. Data Center serves REST API v2 only, has no
accountId, and uses personal access tokens (8.14+) instead of Cloud API tokens. This adds that sign-in, with two smaller changes for large sites. The commits can be reviewed one at a time:Authorization: Bearer. It verifies against/rest/api/2/myself, lists and searches through/rest/api/2/search, and keys the account by user key with the username as login.http://refusal. A token is never sent to anhttp://site.project = WEB. When set, the issue list shows what it matches instead of the last 90 days of activity, and searches are ANDed with it."Epic Link" = WEB-123, ANDed with the account's. Plugins opt in withissueFilterin their issues descriptor, filters live in a new optionalissueFilterskey in the project's durable settings (no migration), and a filter containingORDER BYis rejected.statusCategory != Done. This is one clause in the shared query builder, so it also applies to Jira Cloud and changes what existing Cloud users see. It is its own commit and easy to drop or limit to Data Center.fix(unreleased)commit and can be squashed into the filter commits.If you would rather review this in pieces, the filters and the Done exclusion split off cleanly from the sign-in.
Related issues
#1744 proposed the same sign-in and was closed unmerged during the v1 launch freeze, with a note that it would be welcome afterward. #1156 asks for bearer tokens on Cloud, which is separate.
Testing
pnpm run format,pnpm run lintandpnpm run typecheckpass.nodeandmain-dbVitest projects pass, plus the@emdash/pluginssuite, with new tests for PAT verification, v2 search, filter composition,ORDER BYand unbalanced-parenthesis rejection, the durable issue-filter patch, the form patch, and the filter reaching the plugin.integration-accounts-sectionbrowser test passes, including new cases for the filter field. The otherbrowserprojects were not run in full.Screenshot/Recording (if applicable)
Checklist
🤖 Generated with Claude Code