Skip to content

fix(jira): show the site host next to each Jira site name - #37719

Open
Mahdi-Hasan wants to merge 6 commits into
stablyai:mainfrom
Mahdi-Hasan:fix/jira-site-unique-names
Open

Mahdi-Hasan wants to merge 6 commits into
stablyai:mainfrom
Mahdi-Hasan:fix/jira-site-unique-names

Conversation

@Mahdi-Hasan

@Mahdi-Hasan Mahdi-Hasan commented Nov 3, 2026 •

Copy link
Copy Markdown

ELI5

With two Jira sites connected, both showed the same name: yours. Now each one also shows its web address.

What Changed

  • Before: each Jira site was labeled with the profile's display name, e.g. Ada Lovelace twice.
  • After: Ada Lovelace (acme.atlassian.net). Server/DC sites keep their context path, e.g. jira.example.com/jira.
  • New helper getJiraSiteLabel(site) in src/shared/jira/jira-site-label.ts, built from the stored JiraSite.siteUrl.
  • Used for issue/project siteName in jira-issue-mapping.ts, the Tasks site picker, the source summary, new-workspace Jira rows, and the settings Disconnect aria-label.
  • If the name is blank or equals the host, the label is just the host.

Why

  • Jira's API gives no separate site name, but siteUrl is already stored and normalized.
  • The host is always shown, not only on collisions. siteName is built in main per issue, where other sites are unknown. Labels also stay stable when sites are added or removed.

Linked Issue

Fixes #37435

Visual Proof

Taken from the real Electron app (Windows, electron-vite build --mode e2e) driven by a throwaway Playwright script, before = main at 312ce09. Two Jira sites are seeded into the store, both on a profile named "Ada Lovelace".

Before After
Before: two identical Ada Lovelace entries After: entries show acme.atlassian.net and globex.atlassian.net

The source chip at the top also gains the host.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • vitest: new jira-site-label.test.ts (same-name sites, Server/DC path, blank or host-equal name) plus updated source-display and a11y tests. Wider run over src/main/jira, src/cli/jira, task-page, new-workspace and settings/jira: 1039 tests pass.

  • Full typecheck (run-typecheck-projects-in-parallel.mjs): pass.

  • check:changed on Windows: 28/30 pass. The 2 failures are not from this diff. Unit tests failed in orchestration, ai-vault and terminal-recovery files this PR doesn't touch (EBUSY locks on Windows). protected-copy-keys.json is stale is only CRLF line endings on a Windows checkout; regenerating it gives no content change.

  • Tested on Windows only.

Risk

Level: Low

  • The site / KEY context on board and list rows gets longer. It sits in truncating containers.
  • An older remote host still sends the name-only siteName. The task-page list and board relabel it from the stored site, and the picker and summary build the label locally, so all of them show the host.
  • Not changed: the mobile jiraSiteLabel chip. Happy to add it here or in a follow-up.
  • Back out: plain revert. No saved data changes.

AI Disclosure

Written with Claude Code (Claude Opus 5.5). I reviewed the diff and the test results.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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)

@Mahdi-Hasan
Mahdi-Hasan marked this pull request as ready for review November 3, 2026 09:13
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds getJiraSiteLabel to normalize Jira site hosts and combine them with display names when needed. Jira mappings and renderer labels now use this function. withJiraSiteLabel updates issue and project site names from matching Jira sites. Tests cover duplicate site names, host-based labels, relabeling, and accessible names.

Severity of issue fixed: Low

Merge Risk: Minimal · previous review 46b90

No merge-blocking risk is established from the available evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title "fix(jira): show the site host next to each Jira site name" matches the main change. The PR adds a getJiraSiteLabel helper that appends each Jira site's host to its displayed name, so two si…
Linked Issues check Passed Issue #37435 requires distinct Jira site names when sites share a profile name. getJiraSiteLabel builds labels with the normalized host and preserves Server/Data Center context paths. The helper is …
Out of Scope Changes check Passed The changed files implement or test the Jira site-label requirement in issue #37435. The task-page projection and creation-project changes support consistent labels for older name-only values. The sou…
Description check Passed The description covers the required sections, including before-and-after images, testing, risks, and rollback. It reports Windows-only testing and two failed checks. The visual-proof checklist item re…
Full details: Title check

Explanation

The title "fix(jira): show the site host next to each Jira site name" matches the main change. The PR adds a getJiraSiteLabel helper that appends each Jira site's host to its displayed name, so two sites on the same profile name become distinguishable. The title is specific, short, and clearly describes the primary change.

Full details: Linked Issues check

Explanation

Issue #37435 requires distinct Jira site names when sites share a profile name. getJiraSiteLabel builds labels with the normalized host and preserves Server/Data Center context paths. The helper is used for issue and project mappings, task-page site labels, source display, new-workspace rows, and the settings Disconnect label. withJiraSiteLabel also relabels older name-only values from stored site data. Tests cover duplicate names, context paths, fallback names, and projection and creation-project behavior.

Full details: Out of Scope Changes check

Explanation

The changed files implement or test the Jira site-label requirement in issue #37435. The task-page projection and creation-project changes support consistent labels for older name-only values. The source, picker, workspace, settings, mapping, and accessibility updates are related display changes. No unrelated product behavior is identified. The unchanged mobile chip is not required by the linked issue.

Full details: Description check

Explanation

The description covers the required sections, including before-and-after images, testing, risks, and rollback. It reports Windows-only testing and two failed checks. The visual-proof checklist item remains unchecked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 10 functions across 13 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55ecdbd7-088b-49ad-a0c7-89907425368b
Commits

Reviewing files that changed from the base of the PR and between 0e67842 and 46b9070.

Files selected for processing: 3

  • src/renderer/src/components/task-page/SourceBar.tsx
  • src/renderer/src/components/task-page/jira/use-task-page-jira-creation-projects.site-label.test.tsx
  • src/renderer/src/components/task-page/jira/use-task-page-jira-creation-projects.ts

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

@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.

Follow-up Comments

Outside diff Expose the full selected site label.

213-213: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expose the full selected site label.

The trigger is fixed at 220px, and SelectTrigger clips its value. Long profile names can hide the host after a site is selected. Allow more space or provide the full label in a tooltip. (raw.githubusercontent.com)

Open the source location

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Normalize Jira site labels at the task-page… · use-task-page-jira-list-projection.ts:58-71

src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts:58-71
Minor · Functional Correctness · Quick win

Normalize Jira site labels at the task-page projection boundary.

A task-page request can read issues from an older runtime that includes siteId but only the display name in siteName. The matching site in jiraStatus.sites includes siteUrl, but this projection preserves the name-only value. The all-sites issue list and board therefore keep same-name sites indistinguishable.

Map each projected issue through getJiraSiteLabel after the cache fallback. This shared projection supplies the corrected label to both surfaces.

Suggested fix
+import { getJiraSiteLabel } from '../../../../../shared/jira/jira-site-label'
 import { filterLinkedJiraIssues } from './task-page-jira-linked-issues'
 import { sortJiraIssues } from '../../jira-issue-sorter'
@@
       (jiraHasWorkspace ? filterLinkedJiraIssues(jiraIssues, appliedJiraSearch) : jiraIssues).map(
-        (issue) =>
-          findTaskPageJiraIssue(
-            jiraCacheSnapshot.issueCache,
-            jiraCacheSnapshot.searchCache,
-            issue.key,
-            {
-              sourceContext: jiraTaskSourceContext,
-              siteId: issue.siteId
-            }
-          ) ?? issue
+        (issue) => {
+          const projectedIssue =
+            findTaskPageJiraIssue(
+              jiraCacheSnapshot.issueCache,
+              jiraCacheSnapshot.searchCache,
+              issue.key,
+              {
+                sourceContext: jiraTaskSourceContext,
+                siteId: issue.siteId
+              }
+            ) ?? issue
+          const site = jiraStatus.sites?.find(
+            (candidate) => candidate.id === projectedIssue.siteId
+          )
+          return site
+            ? { ...projectedIssue, siteName: getJiraSiteLabel(site) }
+            : projectedIssue
+        }
       ),
@@
-      jiraTaskSourceContext
+      jiraTaskSourceContext,
+      jiraStatus.sites
Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0aafaa0-4c22-42cf-a910-1ddd5c0ab16f
Commits

Reviewing files that changed from the base of the PR and between 1f9028a and 050e800.

Files selected for processing: 2
  • src/renderer/src/components/new-workspace/SmartWorkspaceNameField.jira-accessibility.test.tsx
  • src/renderer/src/components/new-workspace/smart-workspace-source-row-content.tsx
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/components/new-workspace/smart-workspace-source-row-content.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@Mahdi-Hasan

Copy link
Copy Markdown
Author

@coderabbitai Fixed the outside-diff finding (use-task-page-jira-list-projection.ts) in 28981fa. The task-page projection now relabels each issue from its stored site via a small withJiraSiteLabel helper in jira-site-label.ts, so name-only siteName values from older remote hosts show the host in the all-sites list and board. It returns the same issue object when the label already matches. Unit tests added; Jira suites (1050 tests) and full typecheck pass.

@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.

Nitpick comments: 1
src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts: 1

63-78: Trivial · Maintainability & Code Quality · Quick win

Add a projection-level test for the site-label relabel.

The helper tests cover withJiraSiteLabel in isolation. They do not detect removal of the relabel call in useTaskPageJiraListProjection. The status-order session test uses an empty jiraStatus.sites and an issue with no siteName, so it never reaches the relabel branch.

A focused test can render the projection with:

  • an issue that has siteId: 'acme' and siteName: 'Ada Lovelace', with no cache entry for that issue,
  • jiraStatus.sites containing { id: 'acme', displayName: 'Ada Lovelace', siteUrl: 'https://acme.atlassian.net' }.

It should assert that displayedJiraIssues[0].siteName is 'Ada Lovelace (acme.atlassian.net)'. Adding a case with a cached issue would also cover the findTaskPageJiraIssue fallback path.

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9dabba29-ec98-403f-9b11-c0c4b0736476
Commits

Reviewing files that changed from the base of the PR and between 050e800 and 28981fa.

Files selected for processing: 3
  • src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts
  • src/shared/jira/jira-site-label.test.ts
  • src/shared/jira/jira-site-label.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -euo pipefail
fd -t f '^(use-task-page-jira-list-projection\.ts|jira-site-label\.ts|jira-site-label\.test\.ts)$'
for file in src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts src/shared/jira/jira-site-label.ts src/shared/jira/jira-site-label.test.ts; do
  ast-grep outline "$file"
  printf '\n--- %s ---\n' "$file"
  sed -n '1,260p' "$file"
done

Length of output: 9233


@Mahdi-Hasan Thanks. The inspected code addresses the outside-diff finding.

  • The projection applies withJiraSiteLabel after cache lookup and includes jiraStatus.sites in its memo dependencies.
  • The helper preserves object identity when the label already matches.
  • Tests cover older name-only labels and unchanged issues with unknown or missing site IDs.

I did not rerun the tests or typecheck. The passing results are from your report.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

@Mahdi-Hasan

Copy link
Copy Markdown
Author

@coderabbitai Added the projection-level test in 0e67842 (use-task-page-jira-list-projection.site-label.test.tsx). It renders useTaskPageJiraListProjection with a name-only siteName, no cache entry, and the stored acme site, and expects 'Ada Lovelace (acme.atlassian.net)'. It fails when the withJiraSiteLabel call is removed.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Add the host label to projects from name-only remote responses. · jira-issue-mapping.ts:86

src/main/jira/jira-issue-mapping.ts:86
Minor · Functional Correctness · Quick win

Add the host label to projects from name-only remote responses.

For a connected older remote, the picker can show two projects as identical. The mapper change formats siteName only in the main process, so the old remote keeps the bare display name. JiraProjectPicker renders ${project.key} · ${project.name} with the raw project.siteName as the description, so two sites with the same display name produce the same visible option text. The user cannot tell which site a project belongs to. The selection value still carries siteId, so the failure is in the displayed text.

The issue list is relabeled in use-task-page-jira-list-projection.ts with withJiraSiteLabel(..., jiraStatus.sites ?? []). The project list from use-task-page-provider-metadata.ts has no equivalent step. Apply the same host label to projects from the current runtime's jiraStatus.sites before the picker receives them.

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31748c0b-d963-4523-93e6-e190f7af95e2
Commits

Reviewing files that changed from the base of the PR and between 28981fa and 0e67842.

Files selected for processing: 1
  • src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.site-label.test.tsx

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

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -euo pipefail
fd -t f '^use-task-page-jira-list-projection(\.site-label\.test\.tsx|\.ts)$'
for file in src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.site-label.test.tsx src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts; do
  ast-grep outline "$file"
  printf '\n--- %s ---\n' "$file"
  sed -n '1,240p' "$file"
done

Length of output: 8508


@Mahdi-Hasan Thanks. I inspected the added test. It exercises useTaskPageJiraListProjection with a name-only siteName, empty caches, and the stored acme site. It asserts that the projected label is Ada Lovelace (acme.atlassian.net).

This covers the projection-level regression, not just the helper. I did not run the test or verify the reported failure when withJiraSiteLabel is removed.

You are interacting with an AI system.

@Mahdi-Hasan

Copy link
Copy Markdown
Author

@coderabbitai Fixed both Minor findings in 46b9070.

  • Project picker labels (jira-issue-mapping.ts:86): useTaskPageJiraCreationProjects now runs each project through withJiraSiteLabel(project, jiraSites) before sorting. Older remotes' name-only siteName shows the host in the picker, its search, and its sort. New test use-task-page-jira-creation-projects.site-label.test.tsx fails without the relabel.
  • Clipped site select (SourceBar.tsx:213): the trigger keeps its 220px width and gets the full getJiraSiteLabel(selectedJiraSite) as its title, so a clipped host is still readable on hover.

oxlint, oxfmt, full typecheck, and the task-page + jira suites (671 tests) pass.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -euo pipefail
fd -t f '^(use-task-page-jira-creation-projects\.ts|use-task-page-jira-creation-projects\.site-label\.test\.tsx|SourceBar\.tsx|jira-issue-mapping\.ts)$'
for file in src/renderer/src/components/task-page/jira/use-task-page-jira-creation-projects.ts src/renderer/src/components/task-page/jira/use-task-page-jira-creation-projects.site-label.test.tsx src/renderer/src/components/task-page/SourceBar.tsx; do
  ast-grep outline "$file"
  printf '\n--- %s ---\n' "$file"
  sed -n '1,260p' "$file"
done

Length of output: 21190


@Mahdi-Hasan Thanks. I inspected the code and regression test. Both Minor findings are addressed.

  • useTaskPageJiraCreationProjects relabels projects before sorting and filtering. Its memo dependencies include jiraSites. The new hook test checks that a name-only label becomes Ada Lovelace (acme.atlassian.net).
  • SourceBar.tsx keeps the 220px selector width and sets its title to the full selected-site label.

I did not run the checks or tests. The passing results and the test’s failure without relabeling remain based on your report.

You are interacting with an AI system.

@Mahdi-Hasan
Mahdi-Hasan force-pushed the fix/jira-site-unique-names branch 2 times, most recently from a0cfbae to 29cb5f6 Compare November 10, 2026 13:23
Mahdi-Hasan and others added 6 commits November 17, 2026 11:46
A Jira site's name is the connected user's profile name, so several
sites with the same account read the same. Label sites as
"Name (host)" in the Tasks site picker, source summary, issue and
project site context, new-workspace rows and the disconnect action.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An older remote host still sends siteName as the profile name only, so
same-name sites looked alike in the all-sites list and board. The task-page
projection now relabels each issue from its stored site with
getJiraSiteLabel, via a small withJiraSiteLabel helper that returns the
same issue when the label already matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Renders useTaskPageJiraListProjection with a name-only siteName and a
stored site, so removing the relabel call fails a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Older remote hosts send a name-only siteName for projects too. The task-page
project list now relabels each project from its stored site, so same-name
sites stay apart in the create-issue picker. The site select trigger also
gets the full label as a title, since its fixed width can clip the host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream moved jira-integration-card.tsx one folder deeper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mahdi-Hasan
Mahdi-Hasan force-pushed the fix/jira-site-unique-names branch from 29cb5f6 to 7f39741 Compare November 17, 2026 06:06

This branch has not been deployed

No deployments
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.

[Feature]: Make Jira site names unique when using multiple

1 participant