fix(jira): support user-picker fields in create-issue dialog (Fixes #4643)
Impact & ELI5
1) What's broken today. Anyone who connects Jira with an API key and tries to create a Jira issue from Orca can hit a hard stop: Jira rejects the create request with "Reporter is required" even though the dialog shows a Reporter field. The field behaved like free text, but Jira Cloud v3 requires a selected user accountId object, not a typed display name or pasted string.
2) What this PR does. The create-issue dialog now treats Jira user fields as people-pickers. Typing in the picker searches Jira users for the target project, choosing a person stores their Jira accountId, and create submission sends Jira the { id: accountId } shape it accepts. Required single-user Reporter fields are prefilled with the connected API-token owner, so the common Reporter case submits without extra work while still allowing the user to change it before creating the issue.
3) Tradeoffs / regressions. No known user-facing regression remains from the retry pass. The default is now scoped to the safe case only: required single-user reporter. Custom people fields, Assignee, and multi-user fields stay explicit, so Orca no longer silently fills ambiguous reviewer/approver-style fields. The picker also no longer performs a blank search just because it opens; it waits for a non-empty query, debounces typing, caches repeated searches for the same site/project/query, caps Jira responses at 50 users, and preserves the selected accountId label from known users.
Summary
Fixes #4643
The Jira "create new issue" dialog rendered user-picker fields (Reporter, and any field whose Jira schema type is user) as a plain text Input, and the value-builder forwarded the raw display-name/accountId string verbatim. Jira Cloud's v3 API requires the { id: accountId } object shape for users (display names and usernames were removed in the 2019 GDPR change), so a required Reporter always failed with "Reporter is required." There was no picker at all — just a text box that could never bind an accountId.
This adds schema-driven user-picker support end to end:
- Detect user-picker fields generically via the Jira schema (
type: 'user',type: 'array' + items: 'user', or user-pickercustomtypes like:userpicker/:people/:multiuserpicker). No hardcodedreporterkey for detection, so assignee and custom user-pickers render as pickers too. - Submit the correct shape:
buildJiraCreateFieldValuereturns{ id: accountId }for a single user field and[{ id }, ...]for a multi-user array. This logic was extracted intojira-create-field-value.tsso it is directly unit-testable. - Searchable picker UI:
JiraCreateUserPickerreplaces the text input for user fields, waits for a real search query before calling Jira, debounces typing, caches repeated site/project/query searches, and stores selectedaccountIdvalues in the existingRecord<string,string>draft. - New project-scoped search:
listAssignableUsersForCreatecalls/rest/api/3/user/assignable/multiProjectSearch?projectKeys=<key>(the create-time variant, since there is no issue key yet) with a/rest/api/3/user/searchfallback for deployments that 404 on multiProjectSearch. This is wired through IPC, the runtime RPC registry (jira.listAssignableUsersForCreate), the preload surface, and the runtime wrapper, so local and SSH/remote runtime paths stay covered. - Safe Reporter default only: required single-user
reporterfields prefill with the connected site's token-owner accountId. Other user-picker fields remain empty until explicitly chosen.
Screenshots
No screenshot of the rendered picker. A live click-through repro was not feasible in this validation environment: the dev "Demo Jira" fixture exposes no projects/create-metadata, and Electron's contextBridge freezes window.api (Object.isFrozen(window.api.jira) === true), so the create-fields IPC cannot be stubbed from the renderer to force a required user field to appear. The fix is proven by unit tests that exercise the load-bearing logic: schema detection, { id } payload shaping, safe Reporter-only defaulting, blank-search avoidance/cache keying, project-scoped search fallback, and runtime wrapper routing.
Testing
- [x]
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/jira-create-field-value.test.ts src/renderer/src/components/jira-create-user-picker.test.ts src/renderer/src/runtime/runtime-jira-client.test.ts src/main/jira/issues.test.ts src/main/runtime/rpc/methods/jira.test.ts— 5 files, 41 tests passed. - [x]
pnpm exec oxlint <touched files>— clean. - [x]
pnpm exec tsgo --noEmit -p config/tsconfig.tc.web.json— clean. - [x]
pnpm exec tsgo --noEmit -p config/tsconfig.node.json— clean. - [x]
pnpm run verify:localization-catalog— locale parity clean. - [x]
pnpm run verify:localization-coverage— clean. - [ ]
pnpm build
New/updated tests:
src/renderer/src/components/jira-create-field-value.test.ts— detection +{ id }/[{ id }]/undefinedmapping, custom-field shaping, and the Reporter-only prefill predicate.src/renderer/src/components/jira-create-user-picker.test.ts— search gate requires a non-empty query and project key, and cache keys normalize repeated site/project/query searches.src/renderer/src/runtime/runtime-jira-client.test.ts—jiraListCreateAssignableUserslocal-IPC vs environment-RPC routing and the oversized-query guard.src/main/jira/issues.test.ts—listAssignableUsersForCreatemultiProjectSearch happy path, 404 fallback to/user/search, and auth-error token clearing.src/main/runtime/rpc/methods/jira.test.ts— the newjira.listAssignableUsersForCreateRPC routes to the runtime.
AI Review Report
Reviewed the diff adversarially for correctness, edge cases, cross-platform behavior, and security.
- Cross-platform (macOS/Linux/Windows): changes are in Jira data/IPC/RPC and the combobox; no keyboard shortcut, path separator, or shell behavior touched.
- SSH/remote runtime: user search routes through the same runtime RPC selection as existing Jira operations, preserving local and environment-backed paths.
- Git provider scope: Jira-only; no GitHub/GitLab review concepts touched.
- Edge cases checked: multi-user (
array+items:user) detection runs before the generic array path; empty draft values are omitted; explicit user choices are preserved; Reporter prefill does not apply to custom/assignee/multi-user fields; blank picker opens do not hit Jira;projectKeysuses the project key as Jira expects. - Extracted create-field value logic into a focused module rather than adding any new
max-linesdisable.
Security Audit
- IPC/RPC inputs: the new
jira:listAssignableUsersForCreatehandler validatesprojectKeyOrIdis a non-empty string and normalizessiteId; the RPC schema requiresprojectKeyOrIdand treatsqueryas an optional string. The runtime wrapper keeps the existingisRuntimeProviderSearchQueryWithinLimitguard before IPC/RPC. - No secrets/exfiltration/eval/path traversal/command execution introduced. Query/project values are URL-encoded via
URLSearchParams. No new dependencies.
Notes
- Reporter defaulting uses the accountId already present on
JiraSite; no extra/myselfround-trip is needed. - The
/user/search404 fallback is intentionally a compatibility fallback for deployments withoutmultiProjectSearch; the primary path remains project-scoped.
[!WARNING]
Review limit reached
@nwparker, you've reached your PR review limit, so we couldn't start this review.Next review available in: 3 minutes
Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. You're only billed for reviews past your plan's rate limits ($0.25/file).
How can I continue?
After more reviews become available, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.
How do review limits work?
CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.
For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.
Please refer docs for additional details.
Review details
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
0b5860c2-3fc4-4641-b914-678fef0d9421📥 Commits
Reviewing files that changed from the base of the PR and between e51b2dfe3d5bcdd4b9c16fc37a0d1372e94d0532 and 31757cf40678b63d470fef4f94e64e4735e01b6c.
📒 Files selected for processing (20)
src/main/ipc/jira.tssrc/main/jira/issues.test.tssrc/main/jira/issues.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/jira.test.tssrc/main/runtime/rpc/methods/jira.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/TaskPage.tsxsrc/renderer/src/components/jira-create-field-value.test.tssrc/renderer/src/components/jira-create-field-value.tssrc/renderer/src/components/jira-create-user-picker.test.tssrc/renderer/src/components/jira-create-user-picker.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/runtime/runtime-jira-client.test.tssrc/renderer/src/runtime/runtime-jira-client.ts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Test & verification evidence
Why no live screenshot
A click-through repro of the rendered Reporter picker was attempted in the Electron dev build but is not feasible in this environment:
- The dev "Demo Jira" connection (a local mock at
127.0.0.1) returns no projects and no create-metadata, so the create-issue dialog never reaches a required user field. - Electron's
contextBridgefreezes the preload surface —Object.isFrozen(window.api.jira) === true— so thelistCreateFieldsIPC cannot be stubbed from the renderer to force a required user field. (Verified live over CDP attached to this exact worktree,nwparker/fix-4643.)
So the fix is validated by unit tests that exercise the exact load-bearing logic: schema-driven detection, the { id: accountId } / [{ id }] payload shaping, the new project-scoped search (multiProjectSearch + /user/search fallback), and the runtime wrapper's local-vs-environment routing for SSH/remote.
Before vs after (root cause)
- Before: a
userfield with noallowedValuesfell through to a plain textInput;buildJiraCreateFieldValuereturned the raw trimmed string;createIssuespread it intofields→ Jira v3 rejected it ("Reporter is required"). - After: the field renders a searchable picker storing an
accountId;buildJiraCreateFieldValuereturns{ id: accountId }(or[{ id }, …]for multi-user); required user fields prefill the token owner so create succeeds with no interaction.
Commands run
$ ./node_modules/.bin/vitest run --config config/vitest.config.ts \
src/renderer/src/components/jira-create-field-value.test.ts \
src/renderer/src/runtime/runtime-jira-client.test.ts \
src/main/jira/issues.test.ts \
src/main/runtime/rpc/methods/jira.test.ts
Test Files 4 passed (4)
Tests 36 passed (36)
Key cases (verbose):
✓ src/renderer/src/components/jira-create-field-value.test.ts > isJiraUserPickerField > detects schema.type "user" 1ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > isJiraUserPickerField > detects array of users as a user picker 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > isJiraUserPickerField > detects user-picker custom types 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > isJiraUserPickerField > is false for non-user fields 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > isMultiJiraUserPickerField > is true only for array user pickers 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateFieldValue user pickers > returns { id: accountId } for a single user-picker field 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateFieldValue user pickers > trims surrounding whitespace before wrapping the accountId 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateFieldValue user pickers > returns an array of { id } for a multi-user-picker field 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateFieldValue user pickers > returns undefined when the user-picker draft is empty 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateFieldValue user pickers > does not regress plain string fields 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateCustomFields > shapes a required Reporter user-picker as { reporter: { id } } 0ms
✓ src/renderer/src/components/jira-create-field-value.test.ts > buildJiraCreateCustomFields > omits empty user-picker fields 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > maps create-metadata issue types from the Jira issueTypes page key 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > maps required Jira create fields from create field metadata 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > includes custom create fields when creating Jira issues 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > lists project-scoped assignable users for create via multiProjectSearch 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > falls back to /user/search when multiProjectSearch is unavailable (404) 0ms
✓ src/main/jira/issues.test.ts > Jira issue operations > clears the token and rethrows when create assignable search hits an auth error 0ms
✓ src/renderer/src/runtime/runtime-jira-client.test.ts > runtime Jira client search bounds > rejects oversized local Jira search before IPC 2ms
✓ src/renderer/src/runtime/runtime-jira-client.test.ts > runtime Jira client search bounds > rejects oversized runtime Jira assignee search before RPC 0ms
✓ src/renderer/src/runtime/runtime-jira-client.test.ts > jiraListCreateAssignableUsers > rejects oversized queries before any IPC/RPC 0ms
✓ src/renderer/src/runtime/runtime-jira-client.test.ts > jiraListCreateAssignableUsers > calls the local IPC target with the project key when no runtime env is set 1ms
✓ src/renderer/src/runtime/runtime-jira-client.test.ts > jiraListCreateAssignableUsers > routes through the runtime environment RPC when one is active 0ms
✓ src/main/runtime/rpc/methods/jira.test.ts > jira RPC methods > routes Jira metadata requests to the runtime server 0ms
Lint / typecheck (scoped to changed files)
$ ./node_modules/.bin/oxlint <changed files> # clean, no warnings/errors
$ ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.node.json # clean
$ ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.web.json # clean
Superseded by the merged Jira user-field implementation in #17456 (with remote-host compatibility completed in #17532). Closing this duplicate while preserving your original contribution and discussion. Thanks @nwparker.