Skip to content

fix(jira): shape user-typed create fields and seed reporter with viewer - #17456

Merged
OrcaWin merged 2 commits into
stablyai:mainfrom
NiZZioN:fix/jira-create-reporter-user-field
Aug 31, 2026
Merged

OrcaWin merged 2 commits into
stablyai:mainfrom
NiZZioN:fix/jira-create-reporter-user-field

Conversation

@NiZZioN

@NiZZioN NiZZioN commented Aug 30, 2026 •

Copy link
Copy Markdown

ELI5

If a Jira project required a Reporter (or any other person-type field) on the create screen, creating the issue from Orca failed — Jira replied that the field was missing even though a value had been typed in. Jira does not accept a plain string for person fields; it wants a user object. This PR sends the right shape, pre-fills those fields with your own account the way Jira's own create screen does, and replaces the free-text box with a searchable user picker so you choose a real person instead of guessing at a name.

What Changed

Host (src/main/jira/)

  • jira-issue-mutations.ts: added userFieldRef() and toUserFieldValue(). Values for user-typed fields are shaped into { accountId } on Cloud and { name } on Server/DC before they reach the create body; arrays are mapped member-wise. Only keys the caller flags via the new userFieldKeys argument are shaped, so ordinary custom fields pass through untouched.
  • updateIssue()'s existing assignee branch now reuses userFieldRef() instead of repeating the Cloud/Server conditional inline.
  • jira-issue-create-metadata.ts: added searchUsers() against /user/search. Cloud filters with query, Server/DC with username; because Server rejects an empty username, it falls back to the . wildcard it does accept. Auth errors clear the token and rethrow; anything else (typically a missing browse-users permission) warns and returns [].
  • Neither /user/assignable/search variant fits here: reporter and user-picker fields are not restricted to assignable users, and no issue key exists yet at create time.

Wire / shared

  • JiraCreateIssueArgs.userFieldKeys?: string[] — optional, so a client that omits it keeps exactly the current behavior.
  • New jira.searchUsers RPC method plus the jira:searchUsers IPC channel, preload binding, and runtime-jira-client wrapper (reusing the existing search-query length guard and 30s RPC timeout).

Renderer

  • task-page-jira-create-fields.ts: isJiraUserCreateField() identifies user fields by schema (type === 'user', or an array of user) — they carry no allowedValues, so without this they fell through to the free-text branch. getJiraUserCreateFieldKeys() collects the keys the host needs.
  • New jira-user-picker.tsx: popover + input combobox with a 250 ms debounce, backed by jira.searchUsers.
  • use-task-page-jira-create-dialog.tsx: seeds single-value user fields with the authenticated viewer once create-fields load, mirroring Jira's own default-reporter behavior, and keeps a parallel jiraUserFieldSelections map so the trigger renders a display name rather than a raw accountId. Existing user edits win over the seed, and the map resets when the dialog closes or the target project changes.

Why

Jira's create API rejects "reporter": "<string>" and surfaces it as a missing field error, which made the failure hard to read — the field was visibly filled in. Shaping the value host-side keeps the Cloud/Server difference in one place (userFieldRef), which is also why the pre-existing assignee logic was folded into it rather than duplicated a third time.

The shaping is opt-in per key rather than value-sniffed: the host cannot tell a user id from any other string, so the renderer — which has the field schema — declares which keys are user fields. Seeding the viewer means the common case (a required reporter that should just be you) needs no interaction at all, and the picker exists so the uncommon case does not require typing an opaque accountId.

Linked Issue

Fixes #17465

Visual Proof

BEFORE: (Freetext reporter field)
image

AFTER: (selectbox of x user)
image

Testing

Commands run locally on macOS against this branch:

Check Result
pnpm lint pass
pnpm typecheck pass
pnpm test (changed areas: jira-issue-mutations, issues, task-page-jira-create-fields) pass — 3 files, 65 tests
pnpm build not run locally

New tests in src/main/jira/jira-issue-mutations.test.ts (189 lines) cover the create-body shaping: Cloud {accountId} vs Server {name}, array-valued user fields, keys not listed in userFieldKeys passing through unshaped, and empty/null values being dropped. task-page-jira-create-fields.test.ts covers user-field detection by schema, including the array-of-user case. The assignee-shaping assertions removed from issues.test.ts moved into the new file alongside the helper they now share.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude Code (Claude Opus 5) was used while preparing this contribution. The author should state here how much of the implementation itself was AI-assisted.

Review

Agent review summary (Claude Opus 5), against the areas CONTRIBUTING asks contributors to check:

  • Cross-platform (macOS / Linux / Windows): no risk identified. The diff adds no path handling, shell invocation, child process, or platform API, and introduces no keyboard shortcut or accelerator. It is TypeScript over an HTTP API plus React UI.
  • Remote / SSH / local: worth a reviewer's attention. userFieldKeys is an optional field, so an older host simply ignores it and behaves as it does today — no crash, and the pre-existing bug remains until the host updates. jira.searchUsers, however, is a new RPC method: a newer client against an older host will get an unknown-method error. The picker catches the rejection and renders an empty list, so it degrades without breaking the dialog, but the user is then left with a picker that finds nobody. Per docs/reference/remote-wire-compatibility.md a maintainer should confirm whether this needs capability negotiation, or whether the empty-list fallback is considered acceptable.
  • Jira deployment compatibility: Cloud and Server/DC are handled explicitly in both the shaping (accountId vs name) and the search (query vs username, with the . wildcard for Server's rejection of an empty username). The Server path relies on mapUser storing the username in the accountId slot, which is the existing convention in this module.
  • Git provider: not applicable — this is the Jira integration and touches no source-control provider code.
  • Performance: the search fires only while the popover is open, debounced at 250 ms, capped at maxResults=50, and goes through the existing acquire/release request queue, so it cannot bypass Jira rate limiting. Seeding runs once per create-fields load. In-flight requests are cancelled via the cancelled flag on unmount and on query change.
  • UI quality: built from the existing shadcn Popover/Input primitives and design tokens (hover:bg-accent, text-[12px], size-5 rounded-full); the avatar markup matches the established pattern in pr-reviewers-picker-row.tsx. New strings are routed through translate() and added to en.json; other locales fall back to English, consistent with how new strings land in this repo (pnpm lint's localization coverage check passes).
  • Security: no new credential handling, token storage, or logging of secrets. Auth failures reuse the existing isAuthError → clearToken path. The only new external content is avatarUrl rendered into an <img src>, which matches existing Jira/GitHub/Linear avatar usage elsewhere in the renderer.

Caveat: this review is static analysis of the diff. It was not exercised against a live Jira instance in the session that produced it.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

See the Review section above for cross-platform, remote/SSH, performance, UI, and security notes. The one item a maintainer should actively rule on is the new jira.searchUsers RPC method against older remote hosts.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

No need to shout me out, just mention @NiZZioN, i will be more than tankful 😄

Performance Measurement

No speed-up is claimed or measured; this adds correct Jira user-field handling. The picker waits 250 ms after the last query, cancels superseded timers, sends at most one search for each settled query, and requests at most 50 results. Payload shaping is one O(F) pass over custom fields, and issue creation remains one Jira request; no extra lookup occurs until the picker opens. No wall-clock benchmark was run.

User-Facing Trade-offs

User search now depends on Jira network access and browse-users permission; a denied or failed search yields no suggestions, and a required user field may block creation until a user can be selected. A newer client paired with an older host may receive an unknown jira.searchUsers method and show an empty picker; the optional userFieldKeys field otherwise preserves old-host behavior. Array-of-user fields intentionally remain text input until multi-select exists.

- Jira rejects a bare string for reporter/user-picker fields on issue
  create, so shape customFields values into {accountId}/{name} objects
  for keys the caller flags via userFieldKeys.
- Seed required user fields with the authenticated viewer by default
  and add a searchable user picker (jira.searchUsers) so users aren't
  forced into free text for reporter/custom user fields.
@NiZZioN
NiZZioN marked this pull request as ready for review August 30, 2026 21:30
@NiZZioN
NiZZioN requested a review from brennanb2025 as a code owner August 30, 2026 21:30
@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR shapes Jira create-screen user fields into deployment-specific user references, adds user search across local and remote runtime boundaries, and renders scalar user fields with a searchable picker. The follow-up changes also restrict automatic viewer seeding to the reporter field and prevent seeding when the target project belongs to another known site.

  • Adds Cloud and Server/DC user-reference shaping for issue creation.
  • Adds Jira user-search IPC, preload, runtime RPC, and renderer-client support.
  • Adds a searchable user picker and associated selection state.
  • Narrows viewer prefill to reporter and checks target-site identity.
  • Adds coverage for user-field detection and payload shaping.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/renderer/src/components/task-page/hooks/use-task-page-jira-create-dialog.tsx Restricts viewer seeding to the reporter field, checks site identity, and resets user selection state across dialog targets.
src/main/jira/jira-issue-mutations.ts Shapes explicitly identified scalar and array user-field values for Cloud or Server/DC before issue creation.
src/main/jira/jira-issue-create-metadata.ts Adds deployment-aware Jira user search with authentication handling and request-queue cleanup.
src/renderer/src/components/jira-user-picker.tsx Adds a debounced searchable single-user picker with stale-result suppression.
src/main/runtime/rpc/methods/jira.ts Extends the runtime contract with optional user-field keys and the Jira user-search method.
src/shared/jira-types.ts Adds the optional cross-boundary declaration identifying custom fields that contain Jira user IDs.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant UI as Jira create dialog
  participant C as Runtime Jira client
  participant H as Local or remote host
  participant J as Jira API
  U->>UI: Open user picker
  UI->>C: searchUsers(query, siteId)
  C->>H: IPC or jira.searchUsers RPC
  H->>J: GET /user/search
  J-->>H: Jira users
  H-->>UI: Normalized user options
  U->>UI: Select user and submit
  UI->>H: createIssue(customFields, userFieldKeys)
  H->>H: Shape IDs as accountId or name
  H->>J: Create issue
Loading

Reviews (2): Last reviewed commit: "fix(jira): scope reporter seed and keep ..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c93c2c1-4c46-4a3e-bea0-7891788c3cb5

📥 Commits

Reviewing files that changed from the base of the PR and between 83281ef and 3547b0f.

📒 Files selected for processing (15)
  • src/main/ipc/jira.ts
  • src/main/jira/jira-issue-create-metadata.ts
  • src/main/jira/jira-issue-mutations.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/jira.ts
  • src/renderer/src/components/TaskPage.tsx
  • src/renderer/src/components/jira-issue-workspace-chrome.tsx
  • src/renderer/src/components/jira-user-picker.tsx
  • src/renderer/src/components/task-page-jira-create-fields.test.ts
  • src/renderer/src/components/task-page-jira-create-fields.ts
  • src/renderer/src/components/task-page/dialogs/new-jira-issue-custom-fields.tsx
  • src/renderer/src/components/task-page/dialogs/new-jira-issue-dialog.tsx
  • src/renderer/src/components/task-page/hooks/use-task-page-create-jira-submit.ts
  • src/renderer/src/components/task-page/hooks/use-task-page-jira-create-dialog.tsx
  • src/renderer/src/runtime/runtime-jira-client.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/renderer/src/components/task-page/hooks/use-task-page-create-jira-submit.ts
  • src/main/runtime/rpc/methods/jira.ts
  • src/renderer/src/runtime/runtime-jira-client.ts
  • src/main/jira/jira-issue-mutations.ts
  • src/main/jira/jira-issue-create-metadata.ts
  • src/renderer/src/components/jira-issue-workspace-chrome.tsx
  • src/renderer/src/components/jira-user-picker.tsx
  • src/renderer/src/components/task-page/dialogs/new-jira-issue-dialog.tsx
  • src/main/runtime/orca-runtime.ts
  • src/main/ipc/jira.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Adds Jira user search through the Jira client, runtime RPC, IPC, preload, and renderer layers. Adds searchable user pickers for Jira issue fields and assignee selection. Seeds the reporter field with the authenticated viewer when the site matches. Shapes user field values as accountId for Cloud and name for Server/DC. Adds mutation and field-detection tests.

Merge Risk: 🟡 Moderate · up to 3547b

This PR fixes Jira person-field formatting and adds user search, but required multi-person fields still cannot be submitted correctly, and reporter prefill can use an identity from the wrong Jira site in some multi-site configurations. Older remote hosts may also show an empty user picker, so the PR is not merge-ready until these compatibility and correctness risks are addressed or explicitly accepted.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.59% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 19 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary changes: shaping Jira user-typed create fields and seeding the Reporter field with the authenticated viewer.
Description check ✅ Passed The description covers the required sections, links issue #17465, includes visual proof, testing details, scope notes, and checklist status. Manual testing was not completed and the AI assistance disc…
Linked Issues check ✅ Passed The changes address issue #17465 by shaping Cloud and Server/DC user fields, supporting scalar and array schemas, adding user search and selection, seeding the active-site Reporter, and adding relevan…
Out of Scope Changes check ✅ Passed The changes remain focused on Jira user-field creation support. IPC, RPC, runtime, renderer, metadata, assignee refactoring, tests, and documentation updates directly support the linked issue objectiv…
Full details: Description check

Explanation

The description covers the required sections, links issue #17465, includes visual proof, testing details, scope notes, and checklist status. Manual testing was not completed and the AI assistance disclosure still needs author confirmation, but the description is otherwise substantially complete.

Full details: Linked Issues check

Explanation

The changes address issue #17465 by shaping Cloud and Server/DC user fields, supporting scalar and array schemas, adding user search and selection, seeding the active-site Reporter, and adding relevant tests.

Full details: Out of Scope Changes check

Explanation

The changes remain focused on Jira user-field creation support. IPC, RPC, runtime, renderer, metadata, assignee refactoring, tests, and documentation updates directly support the linked issue objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 70.59% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 19 files. (1 skipped: 1 too large.)

  • Fix all pre-merge checks with AI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1ab4645-dc48-4c4b-8971-737b769bd278

📥 Commits

Reviewing files that changed from the base of the PR and between ba5f334 and 83281ef.

📒 Files selected for processing (22)
  • src/main/ipc/jira.ts
  • src/main/jira/issues.test.ts
  • src/main/jira/issues.ts
  • src/main/jira/jira-issue-create-metadata.ts
  • src/main/jira/jira-issue-mutations.test.ts
  • src/main/jira/jira-issue-mutations.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/jira.ts
  • src/preload/api/jira-api.ts
  • src/preload/index.ts
  • src/renderer/src/components/TaskPage.tsx
  • src/renderer/src/components/jira-issue-workspace-chrome.tsx
  • src/renderer/src/components/jira-user-picker.tsx
  • src/renderer/src/components/task-page-jira-create-fields.test.ts
  • src/renderer/src/components/task-page-jira-create-fields.ts
  • src/renderer/src/components/task-page/dialogs/new-jira-issue-custom-fields.tsx
  • src/renderer/src/components/task-page/dialogs/new-jira-issue-dialog.tsx
  • src/renderer/src/components/task-page/hooks/use-task-page-create-jira-submit.ts
  • src/renderer/src/components/task-page/hooks/use-task-page-jira-create-dialog.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/runtime/runtime-jira-client.ts
  • src/shared/jira-types.ts
💤 Files with no reviewable changes (1)
  • src/main/jira/issues.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The host-side shaping and the reporter seed are solid, but the seeding is applied more broadly than it should be (it fills every required single-value user field, not just reporter), and required multi-user picker fields are now rendered as a single-select. See inline.

Reviewed changes

  • Host-side user-field shaping — userFieldRef() / toUserFieldValue() shape user-typed create fields into { accountId } (Cloud) or { name } (Server/DC) for the keys declared in the new userFieldKeys argument; updateIssue()'s assignee branch now reuses userFieldRef().
  • User search — new searchUsers() against /user/search (Cloud query, Server username with a . wildcard fallback), wired through a new jira.searchUsers RPC method, IPC channel, preload binding, and runtime-jira-client wrapper.
  • Reporter seed — the create dialog seeds required single-value user fields with the authenticated viewer once create-fields load, keeping a parallel jiraUserFieldSelections map for display names.
  • Renderer picker — new jira-user-picker.tsx combobox (250 ms debounce) and JiraUserOptionList extracted for the existing assignee popover.

ℹ️ New jira.searchUsers RPC method vs. older hosts

A newer client against an older remote host will get method_not_found for jira.searchUsers; the picker catches that and renders an empty list, so the dialog degrades gracefully rather than breaking. That matches the runtime-rpc behavior (an answer, not silence), so capability negotiation is not required here — this is the same graceful-degradation pattern already used by the search path. Just confirming the author's open question: the empty-list fallback is acceptable.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

… path

Review follow-ups on the create-field shaping:

- Seed only `reporter`. isVisibleJiraCreateField matches every required
  non-system field, so the previous filter also pre-filled required custom
  user pickers (Reviewer, Requested by) that Jira never defaults.
- Skip the seed when the target project is on another site. The viewer
  comes from the active site, and the host shapes against the target's
  client, so a foreign accountId is rejected on Cloud and can silently
  resolve to a different person by username on Server/DC.
- Render JiraUserPicker only for scalar user fields. It holds one user, so
  an array-of-user field collapsed to a single member; those keep the
  existing comma-separated text path, which still reaches toUserFieldValue's
  array branch.

Adds docstrings across the touched Jira functions to satisfy the
docstring-coverage pre-merge check.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HdMzQN6T3jRVahCK2sNyur

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Three prior findings were resolved in 3547b0f, and the fixes are correct.

  • Reporter-only seed — the create dialog now seeds only the reporter field (JIRA_REPORTER_FIELD_KEY), matching Jira's own create screen; other required user-picker fields stay empty for the user to fill.
  • Cross-site guard — seeding is skipped when the target project's siteId differs from jiraViewerSiteId (the active site's id), so a Cloud accountId can no longer be emitted as { name } against a Server/DC target.
  • Array-of-user fields — isJiraScalarUserCreateField() (scalar type === 'user' only) at the render site keeps multi-user fields on the comma-separated text path, and getJiraUserCreateFieldKeys() still includes them so the host shapes each member. Unit tests cover all three cases.
  • Doc comments — added JSDoc to the new helpers and changed functions (formatting/documentation only, no behavior change).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@OrcaWin OrcaWin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the implementation end to end: Jira Cloud and Server/DC user shaping, scalar/array field handling, create metadata search, picker state, IPC/preload/runtime routing, and tests. The feature is correct and the automated checks are green. I also verified the remote-wire caveat around the new jira.searchUsers RPC; I am landing capability gating separately so older Orca hosts fail safely instead of silently presenting an unusable picker. Credit to @NiZZioN / Aldin Saracevic for the implementation.

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.

[Bug]: Creating a Jira issue fails when the project requires a Reporter or other user-picker field

3 participants