Repository navigation
feat(source): Jira issue search (JQL) for POST /api/source/issues - #35659
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check: the change adds a backend search route plus type comments and docs, with no dashboard control or rendered surface. [UX-REVIEWED] dda60ec Description read[DESCRIPTION-READ] de9e2202b18fba13175bf3fae312b484881d528855f6c63751ebd7ba4d9dd4ac That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this backend-only change adds a provider under the existing route contract, and the JQL is always scoped to the project; the website change is type comments only, so no screenshots are needed. Notes
[DESIGN-REVIEWED] dda60ec Description read[DESCRIPTION-READ] e8a69bc2fd44830f828e4e673875e2c9bf88399bc75c012872dc6de20305e394 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Two notes: this is the third check for a Cloud host, and the page walk-forward goes further than the Goal needs. Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: let an app page list and search one Jira project's issues through the gateway's existing issue-search route. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] dda60ec Description read[DESCRIPTION-READ] 47f2506d88ad9320e5118dcb02c8292de33d76535474719d0fca1780824fc249 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
3e5f1cc to
dda60ec
Compare
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 1370 lines, more than the 400 it may approve on its own. Adds Jira (Cloud and Server/DC) as a third provider for POST /api/source/issues. Checked against the code: the JQL always starts with the gateway's project clause. Structured values go in as escaped string literals, and raw JQL is scanned the way Jira reads quotes, refused if it could close the gateway's group, and wrapped in parentheses. Rows from other projects are dropped. Credentials resolve only for hosts with a jira_auth entry, and redirects are not followed. Rows still pass through the existing cache.search_issues redaction, twice and before the excerpt cut, and Cloud page tokens are saved before redaction and never reach the browser. The jira.py refactor keeps the single-issue read's URLs, auth and error mapping, and SourceProviderError is a RuntimeError, so the new except ValueError can't swallow provider errors. Paging and the token store are bounded. The route-level tests are thorough. No regressions found on sibling providers. CI backend, E2E and one frontend test job were still pending at review time. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
bolichen97
left a comment
There was a problem hiding this comment.
Approving. I read every product file in the diff (issue_search.py, jira.py, adf.py, index.sources.ts, the docs) and skimmed the tests.
- Owner auth is unchanged. The PR adds one
IssueProviderentry and does not touchapi_issue_search, so Jira is served behind the same owner-session check as GitHub and GitLab, and app tokens are still refused. - Credentials and host match main.
search_jira_issuesreuses_jira_request_headers, which is the single-issue reader's_get_jira_authpath (jira.py:38on main): vault or.envper host, unchanged. The host must be*.atlassian.net(aslinks.py:401-407already accepts) or adashboard.jira_hostsentry._jira_get_jsonkeepsallow_redirects=Falseand the capped read, so the token only ever goes to that host. - No token or JQL in logs. No logging is added. The no-credentials message is caught and rewritten so the host isn't echoed back to the browser.
- The JQL is a parameter, not part of the path.
jira_paramsreturns("jql", ...)tuples andsearch_jira_issuesencodes them withurlencode(params, quote_via=quote). The path is one of two fixed strings. - Scope can't be widened. The gateway's
project = "<KEY>"clause comes first. Every value goes through_jql_string(backslash and quote escaped). Raw JQL is ANDed in parentheses it can't close (_jira_raw_clausetracks depth outside quotes, refuses a stray\, and refusesORDER BY)._project_jira_issuesdrops any row whose key isn't<KEY>-<n>. - No regex. The key, host label and JQL checks are all charset and string code.
- On main Jira answers
provider_not_supported, so the raw-JQL rules narrow a new capability rather than an existing one. - The page-token map and the Server/DC fill loop are both bounded (512 entries, 30 min TTL, 20-page walk, and each extra request must return a row).
Problem / Motivation
Goal: An app page can list and search one Jira project's issues through
POST /api/source/issues, the same way it already can for a GitHub repository or GitLab project.The issue search route from #34742 names Jira as a planned provider and answers
jirawith 400provider_not_supported. The app SDK'suseIssues/IssueList/IssueCardcomponents therefore cannot show Jira issues, though the gateway already reads single Jira issues for the Issues panel.Why it matters
Teams that track work in Jira (Cloud or Server/Data Center) get nothing from the reusable issue components until the search route serves Jira. Without it an app would have to call Jira itself with its own credentials, outside the gateway's host allowlist, permission check and redaction.
Not a goal
provider_not_supported)./jira(the search buildshttps://<host>/rest/...; noted as ashortcut:injira.py).dashboard.jira_authtoken.What changed (motivation → approach → change)
Goal → reuse the single-issue Jira reader and the route's existing contract → add a third
IssueProvider.jira.py). The header building and the capped, no-redirect GET in_fetch_jira_issueare split into_jira_request_headersand_jira_get_json, and the newsearch_jira_issuescalls both. Cloud searches/rest/api/3/search/jql, Server/DC/rest/api/2/search. The single-issue read keeps its URLs and messages.issue_search.py). The JQL always starts with the gateway's ownproject = "<KEY>"clause, ANDed with every filter. Every value (person, label, text) goes in as one escaped JQL string literal;assignee: 'me'becomescurrentUser(). Free text loses JQL's operator characters.rawJQL is wrapped in parentheses and refused if, outside quoted values, a parenthesis closes one it did not open, a quote or parenthesis is unbalanced, a backslash appears, or it usesORDER BY. Rows whose key is not in the project are dropped. The host must be a*.atlassian.netsite or adashboard.jira_hostsentry. All of this is plain string code, no regex.startAtand reportstotal; when an instance capsmaxResultsbelowlimit, the gateway fills the page with follow-up requests from where the answer stopped, so the next page'sstartAtskips nothing. Cloud's/search/jqlpages only by an opaquenextPageTokenand has no total, so the gateway keeps each token server-side (30 min, 512 entries) keyed by the normalized query, and the cursor stays the same page number the other providers use. A page whose token is no longer held is reached by walking forward from the nearest held one (at most 20 pages), else 400. The endpoint and the paging use the same Cloud test (jira._jira_is_cloud).IssueSummary(statusCategorydone →closed, priority filled,commentCount0 because search returns no count, CloudaccountId/ Servernameas the login). Cloud's ADF description is rendered to one plain string by the newadf._adf_plain_linesbeforecache.search_issuesredacts the rows, so a token or PEM key split across ADF nodes is redacted whole. That string is used as written, with no markdown strip, so literal text such as<!-- ... -->orsnake__casein a code block stays in the excerpt; Server/DC's wiki text keeps the markdown strip. Redaction, the payload cap and the 30 s cache are the existingcache.search_issuespath;cache.pyis unchanged.docs/app-kit/api-reference.md, the feature map row and theIssueSearchRequestcomments inwebsite/src/types/index.sources.tsnow describe Jira (host required, account ID vs username, JQL limits, no total on Cloud).No Sensitive Change Review watched file is touched.
Backwards compatibility
Compatible: a
jirarequest that answered 400provider_not_supportednow gets results; GitHub, GitLab, Linear and the single-issue Jira read behave as before.Removes nothing: Jira leaves the planned-provider set because it is now served; the only test change for it is the one parametrize case that asserted the old 400.
Tests
test/test_source_issue_search_jira.py(new, through the real route with fake Jira responses):",\, parentheses,OR/ANDandORDER BYstay one literal;rawJQL that could leave the project group (unbalanced or closing parens, stray quotes, backslashes,ORDER BY) is refused before any request; validrawis ANDed inside the group.*.atlassian.netsubdomain paging as Cloud; Server againsttotal, and a Server that caps page size still returning every issue across pages; per-page cache andrefresh._adf_plain_linesline breaking.test/test_source_issue_search.py: the planned-provider case now coverslinearonly.Local: the prepush gate passed, and the issue search test files passed 5 parallel repeats and shuffled-order serial repeats.
Manual verification
N/A — unit coverage sufficient: no live Jira site is configured on this machine, so both editions are covered with fake responses through the real route.
Related Issues
Follows #34742 (GitHub and GitLab issue search).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)