diff --git a/README.md b/README.md index 7eb8b0d7..99e0b590 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ This repository holds the dashboard, the docs site and the website. The agent, t | Feature | What you get | |---|---| -| [Tickets to pull requests](https://docs.coderhelm.com/getting-started/first-run) | Assign a [GitHub issue](https://docs.coderhelm.com/getting-started/github) or [Jira ticket](https://docs.coderhelm.com/getting-started/jira), add the `coderhelm` label or comment `/coderhelm`. A plan, the change, your tests, a self review and a pull request. | +| [Tickets to pull requests](https://docs.coderhelm.com/getting-started/first-run) | Assign a [GitHub issue](https://docs.coderhelm.com/getting-started/github) or [Jira ticket](https://docs.coderhelm.com/getting-started/atlassian), add the `coderhelm` label or comment `/coderhelm`. A plan, the change, your tests, a self review and a pull request. | | [PR reviewer](https://docs.coderhelm.com/getting-started/reviewer) | Add the review label (`ch-review` by default) to any pull request. A real GitHub review with line comments, a risk level and a verdict: it requests changes only for a named correctness, security or data loss problem with its evidence, and everything else is a labeled note. | | [CI and review comment fixes](https://docs.coderhelm.com/getting-started/review-fixes) | Fixes failing CI on its pull requests, answers review comments, resolves conflicts and, with auto merge on, merges only the exact commit it reviewed. | | [Alerts to fixes](https://coderhelm.com/alerts) | Route CloudWatch alarms and EventBridge events through SNS. Matching alerts become analyzed pull requests that a person approves. | diff --git a/dashboard/e2e/atlassian-one.spec.ts b/dashboard/e2e/atlassian-one.spec.ts new file mode 100644 index 00000000..d0fdeefb --- /dev/null +++ b/dashboard/e2e/atlassian-one.spec.ts @@ -0,0 +1,130 @@ +import { expect, test, type Page, type Route } from "@playwright/test"; +import fs from "node:fs"; +import path from "node:path"; + +// Settings → Integrations: Jira, Confluence and Atlassian's own server are one +// Atlassian row (services/gateway/src/routes/integrations.rs, atlassian_card). +// Each piece keeps its own card under `detail.parts`. Every API call is +// answered here; nothing reaches a real backend. + +const SHOTS_DIR = process.env.E2E_SHOTS_DIR || path.join("test-results", "shots"); + +function card(id: string, section: string, name: string, status: string, action: string, over: Record = {}) { + return { id, section, name, does: `${name} does things.`, status, reason: "", action, last_check: "", manage_href: "", detail: {}, ...over }; +} + +function plugin(id: string, name: string) { + return { + id, name, description: "Agent tools for Jira issues and Confluence pages.", category: "Project Management", tier: 2, icon: id, + credential_fields: [], docs_url: "https://example.com/docs", repo_url: "https://example.com/docs", default_prompt: "Read only.", recommended_permissions: "Read access", + npx_package: "", remote_url: "https://mcp.example.com/v2/mcp", remote_key: false, + }; +} + +interface Parts { + jira: string; + confluence: string; + tools: string; + reason?: string; + status?: string; + action?: string; +} + +function atlassian(p: Parts) { + const jira = card("jira", "code", "Jira", p.jira, p.jira === "connected" ? "manage" : "connect", { manage_href: "/settings/integrations/jira", detail: { app: p.jira === "connected", app_update: null } }); + const confluence = card("confluence", "docs", "Confluence", p.confluence, p.confluence === "connected" ? "manage" : "connect", { detail: { kind: "confluence", connected: false, knowledge: null } }); + const tools = card("atlassian", "code", "Atlassian", p.tools, p.tools === "connected" ? "manage" : "connect", { + detail: { plugin: plugin("atlassian", "Atlassian"), enabled: false, has_credentials: false, custom_prompt: "", last_test_ok: null, last_test_message: "", remote: null, own_app: null, unused: [] }, + }); + return card("atlassian", "code", "Atlassian", p.status ?? "not_connected", p.action ?? "connect", { + reason: p.reason ?? "", + detail: { + app_update: null, + parts: [ + { id: "jira", name: "Jira", what: "Coderhelm's Jira app (Forge): tickets start work.", item: jira }, + { id: "confluence", name: "Confluence", what: "Agents read pages and Knowledge syncs them.", item: confluence }, + { id: "agent_tools", name: "Agent tools", what: "Atlassian's own server (Rovo MCP).", item: tools }, + ], + }, + }); +} + +async function mockApi(page: Page, items: unknown[], connect: (r: Route) => Promise) { + const json = (route: Route, body: unknown, status = 200) => route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) }); + const context = page.context(); + await context.route((url) => url.hostname !== "localhost", (route) => route.abort()); + await context.route((url) => url.hostname === "localhost" && /^\/(api|auth)\//.test(url.pathname), async (r) => { + const p = new URL(r.request().url()).pathname; + if (p === "/api/me") return json(r, { user_id: "u_1", team_id: "t_1", github_login: null, email: "person@example.com", avatar_url: "", role: "admin", auth_provider: "email" }); + if (p === "/api/usage") return json(r, { month: "2026-01", tokens_in: 0, tokens_out: 0, total_runs: 0, total_tokens: 0, max_tokens: 0 }); + if (p === "/api/banners") return json(r, { banners: [] }); + if (p === "/api/teams") return json(r, { teams: [{ team_id: "t_1", org: "your-team", status: "active", current: true }] }); + if (p === "/api/integrations") return json(r, { can_edit: true, items, migrated: 0 }); + if (p === "/api/reviewer/org-config") return json(r, { instructions: "", web_domains: [] }); + if (p === "/api/knowledge/connectors/confluence/connect") return connect(r); + return json(r, { error: `not mocked: ${p}` }, 404); + }); +} + +async function shot(page: Page, name: string) { + fs.mkdirSync(SHOTS_DIR, { recursive: true }); + await page.addStyleTag({ content: "nextjs-portal{display:none!important}" }); + for (const width of [1280, 375]) { + await page.setViewportSize({ width, height: 900 }); + await page.screenshot({ path: path.join(SHOTS_DIR, `${name}-${width === 1280 ? "desktop" : "phone"}.png`), fullPage: true }); + } + await page.setViewportSize({ width: 1280, height: 800 }); +} + +const github = card("github", "code", "GitHub", "connected", "manage", { manage_href: "/settings/integrations/github" }); + +test("one Atlassian row covers Jira, Confluence and agent tools", async ({ page }) => { + await mockApi(page, [github, atlassian({ jira: "not_connected", confluence: "not_connected", tools: "not_connected" })], (r) => + r.fulfill({ status: 200, contentType: "application/json", body: "{}" }), + ); + await page.goto("/settings/integrations/"); + const rows = page.locator('[data-testid^="integration-"][data-status]'); + await expect(page.getByTestId("integration-atlassian")).toBeVisible(); + // No separate Jira or Confluence row. + await expect(page.getByTestId("integration-jira")).toHaveCount(0); + await expect(page.getByTestId("integration-confluence")).toHaveCount(0); + expect(await rows.count()).toBe(2); + + await page.getByTestId("integration-atlassian").getByRole("button", { name: /Atlassian/ }).click(); + const panel = page.getByTestId("atlassian-panel"); + await expect(panel.getByTestId("atlassian-part-jira")).toBeVisible(); + await expect(panel.getByTestId("atlassian-part-confluence")).toBeVisible(); + await expect(panel.getByTestId("atlassian-part-agent_tools")).toBeVisible(); + await expect(panel.getByRole("link", { name: "Install the Jira app" })).toHaveAttribute("href", /\/settings\/integrations\/jira/); + // One Connect, for the next piece that takes a sign-in: Confluence first. + await expect(panel.getByTestId("atlassian-connect")).toHaveAttribute("data-next", "confluence"); + await expect(panel.getByRole("button", { name: "Connect Atlassian" })).toBeVisible(); + await shot(page, "atlassian-one"); +}); + +test("old links to the Jira or Confluence row open the Atlassian row", async ({ page }) => { + await mockApi(page, [github, atlassian({ jira: "connected", confluence: "connected", tools: "not_connected", status: "connected", action: "manage", reason: "Jira and Confluence are connected. Agent tools isn't set up." })], (r) => + r.fulfill({ status: 200, contentType: "application/json", body: "{}" }), + ); + await page.goto("/settings/integrations/#integration-confluence"); + const panel = page.getByTestId("atlassian-panel"); + await expect(panel).toBeVisible(); + await expect(panel.getByTestId("atlassian-summary")).toHaveText("Jira and Confluence are connected. Agent tools isn't set up."); + // Connected Jira and Confluence carry over: the next step is agent tools. + await expect(panel.getByTestId("atlassian-part-jira")).toHaveAttribute("data-status", "connected"); + await expect(panel.getByTestId("atlassian-connect")).toHaveAttribute("data-next", "agent_tools"); + await expect(panel.getByRole("link", { name: "Manage the Jira app" })).toBeVisible(); +}); + +test("Atlassian's sign-in failing on its side is said in plain words", async ({ page }) => { + const words = "Confluence's sign-in page is failing on Confluence's side (HTTP 500), so Coderhelm didn't send you there. Nothing on your side needs changing. Try again in a few minutes."; + await mockApi(page, [github, atlassian({ jira: "not_connected", confluence: "not_connected", tools: "not_connected" })], (r) => + r.fulfill({ status: 400, contentType: "application/json", body: JSON.stringify({ error: words }) }), + ); + await page.goto("/settings/integrations/#integration-atlassian"); + const panel = page.getByTestId("atlassian-panel"); + await panel.getByRole("button", { name: "Connect Atlassian" }).click(); + await expect(panel.getByText("failing on Confluence's side (HTTP 500)")).toBeVisible(); + // Nobody was sent anywhere. + await expect(page).toHaveURL(/\/settings\/integrations\//); +}); diff --git a/dashboard/e2e/jira-app-update.spec.ts b/dashboard/e2e/jira-app-update.spec.ts index 4b0f15f0..566b1031 100644 --- a/dashboard/e2e/jira-app-update.spec.ts +++ b/dashboard/e2e/jira-app-update.spec.ts @@ -10,12 +10,13 @@ const BEHIND = { version: "6.8.0", latest: "6.11.0", missing: ["mentions", "in-place edits", "extended issue fields", "threaded replies"], - manage_url: "https://your-team.atlassian.net/plugins/servlet/upm", + manage_url: "https://admin.atlassian.com/", + install_url: "https://developer.atlassian.com/console/install/00000000-0000-0000-0000-000000000002?signature=abc&product=jira", seen_at: "2026-11-14T10:00:00Z", message: - "Your Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0). Missing: mentions, in-place edits, extended issue fields, threaded replies. A Jira admin needs to accept the update: Jira Settings, Apps, Manage apps, Coderhelm, Update.", + "Your Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0). Missing: mentions, in-place edits, extended issue fields, threaded replies. An Atlassian site admin can open the app's installation link (https://developer.atlassian.com/console/install/00000000-0000-0000-0000-000000000002?signature=abc&product=jira), choose the site and Update, or accept it in Atlassian Administration (admin.atlassian.com): Apps, Sites, choose the site, Connected apps, Coderhelm, View app details, Update.", run_note: - "Comments on this ticket may be incomplete: its Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0) without mentions, in-place edits, extended issue fields, threaded replies. A Jira admin can accept the update in Manage apps.", + "Comments on this ticket may be incomplete: its Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0) without mentions, in-place edits, extended issue fields, threaded replies. An Atlassian site admin can accept the update in Atlassian Administration, Connected apps.", }; const RUN = { @@ -82,9 +83,12 @@ test("Integrations: a Jira site on an older app says its version, the latest, wh await expect(notice).toBeVisible(); await expect(notice).toContainText("Your Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0)."); await expect(notice).toContainText("Missing: mentions, in-place edits, extended issue fields, threaded replies."); - await expect(notice).toContainText("A Jira admin needs to accept the update: Jira Settings, Apps, Manage apps, Coderhelm, Update."); - const link = notice.getByRole("link", { name: "Open Manage apps in Jira" }); - await expect(link).toHaveAttribute("href", "https://your-team.atlassian.net/plugins/servlet/upm"); + await expect(notice).toContainText("Atlassian Administration (admin.atlassian.com): Apps, Sites, choose the site, Connected apps, Coderhelm, View app details, Update."); + // Atlassian Administration and the one-click installation link: never Jira's Manage apps, which has no Update for it. + await expect(notice.getByRole("link", { name: "Open Connected apps in Atlassian Administration" })).toHaveAttribute("href", "https://admin.atlassian.com/"); + const link = notice.getByRole("link", { name: "Update with the installation link" }); + await expect(link).toHaveAttribute("href", /^https:\/\/developer\.atlassian\.com\/console\/install\//); + await expect(notice).not.toContainText("Manage apps, Coderhelm"); await expect(link).toHaveAttribute("target", "_blank"); // It sits with the Jira row, not elsewhere on the page. await expect(page.getByTestId("integration-jira").getByTestId("jira-app-update")).toBeVisible(); @@ -104,7 +108,7 @@ test("Run page: a ticket from a behind site gets one quiet line about its commen const line = page.getByTestId("run-jira-app-note"); await expect(line).toHaveCount(1); await expect(line).toContainText("Comments on this ticket may be incomplete: its Jira site runs an older Coderhelm app (version 6.8.0, latest 6.11.0)"); - await expect(line.getByRole("link", { name: "Open Manage apps" })).toHaveAttribute("href", BEHIND.manage_url); + await expect(line.getByRole("link", { name: "Update the app" })).toHaveAttribute("href", BEHIND.install_url); // Quiet: a plain line, not a warning box. await expect(line).toHaveClass(/text-zinc-400/); }); diff --git a/dashboard/e2e/wide-data/settings.ts b/dashboard/e2e/wide-data/settings.ts index d0634fab..414019ac 100644 --- a/dashboard/e2e/wide-data/settings.ts +++ b/dashboard/e2e/wide-data/settings.ts @@ -336,9 +336,9 @@ export const settingsData: Handler = ({ method, path, url }) => { const missing = ["full comment reading", "mentions", "in-place edits", "extended issue fields", "threaded replies", "issue type"]; return { behind: { - version: "", latest: "6.11.0", missing, manage_url: `https://${SHA}${SHA}.atlassian.net/plugins/servlet/upm`, seen_at: iso(30), - message: `Your Jira site runs an older Coderhelm app (a version from before the app reported its number, latest 6.11.0). Missing: ${missing.join(", ")}. A Jira admin needs to accept the update: Jira Settings, Apps, Manage apps, Coderhelm, Update.`, - run_note: `Comments on this ticket may be incomplete: its Jira site runs an older Coderhelm app (a version from before the app reported its number, latest 6.11.0) without ${missing.join(", ")}. A Jira admin can accept the update in Manage apps.`, + version: "", latest: "6.11.0", missing, manage_url: "https://admin.atlassian.com/", seen_at: iso(30), + message: `Your Jira site runs an older Coderhelm app (a version from before the app reported its number, latest 6.11.0). Missing: ${missing.join(", ")}. An Atlassian site admin accepts the update in Atlassian Administration (admin.atlassian.com): Apps, Sites, choose the site, Connected apps, Coderhelm, View app details, Update. Jira's own Manage apps page doesn't list it.`, + run_note: `Comments on this ticket may be incomplete: its Jira site runs an older Coderhelm app (a version from before the app reported its number, latest 6.11.0) without ${missing.join(", ")}. An Atlassian site admin can accept the update in Atlassian Administration, Connected apps.`, }, }; } diff --git a/dashboard/src/app/runs/detail/page.tsx b/dashboard/src/app/runs/detail/page.tsx index 8de05d6e..9c0427d7 100644 --- a/dashboard/src/app/runs/detail/page.tsx +++ b/dashboard/src/app/runs/detail/page.tsx @@ -1153,11 +1153,11 @@ function RunDetailInner() { {fromJira && jiraApp?.run_note && (

{jiraApp.run_note} - {jiraApp.manage_url && ( + {(jiraApp.install_url || jiraApp.manage_url) && ( <> {" "} - - Open Manage apps + + {jiraApp.install_url ? "Update the app" : "Open Atlassian Administration"} )} diff --git a/dashboard/src/app/settings/integrations/jira/page.tsx b/dashboard/src/app/settings/integrations/jira/page.tsx index 0290feea..4de94d22 100644 --- a/dashboard/src/app/settings/integrations/jira/page.tsx +++ b/dashboard/src/app/settings/integrations/jira/page.tsx @@ -22,7 +22,7 @@ import { Page, PageHeader, Section } from "@/components/page"; import { HybridAppChoice } from "@/components/hybrid-app-choice"; import { HostedJiraLinked, HostedJiraLinkRequest, HybridJiraLink } from "@/components/hybrid-jira-link"; import { isSelfHosted } from "@/lib/runtime-config"; -import { useHybrid } from "@/lib/hybrid"; +import { integrationOf, useHybrid } from "@/lib/hybrid"; import { Code, Field, SaveBar, SettingsRow, SettingsSection, Switch, useDirtyForm } from "@/components/settings"; import { buttonClass, focusRing, inputClass, linkButton, primaryButton, secondaryButton } from "@/components/ui"; import { Select } from "@/components/select"; @@ -440,7 +440,7 @@ function SetupGuide({ const self = isSelfHosted(); const hybrid = useHybrid(); const relayed = - self && !!hybrid.status?.registered && !!hybrid.status.install_id && hybrid.status.integrations.some((i) => i.id === "jira" && i.uses_coderhelm); + self && !!hybrid.status?.registered && !!hybrid.status.install_id && !!integrationOf(hybrid.status.integrations, "jira")?.uses_coderhelm; const ownCopy = self && !relayed; const [picked, setPicked] = useState<"app" | "webhook" | null>(null); const how = picked ?? (ownCopy ? "webhook" : "app"); diff --git a/dashboard/src/app/settings/integrations/page.tsx b/dashboard/src/app/settings/integrations/page.tsx index 2578b5b3..572ea289 100644 --- a/dashboard/src/app/settings/integrations/page.tsx +++ b/dashboard/src/app/settings/integrations/page.tsx @@ -13,6 +13,7 @@ import { type IntegrationSection, type IntegrationStatus, type IntegrationUse, + type AtlassianPart, type JiraAppUpdate, type KnowledgeSignIn, type McpServer, @@ -35,16 +36,16 @@ import { BrandIcon } from "@/components/brand-icons"; import { EmptyState } from "@/components/empty-state"; import { Problem } from "@/components/problem"; import { INTEGRATION_STATUS } from "@/lib/integration-status"; -import { AddMcpServerDialog, McpServerPanel } from "@/components/mcp-servers"; +import { AddMcpServerDialog, McpServerPanel, beginCatalogSignIn } from "@/components/mcp-servers"; import { CatalogPanel } from "@/components/mcp-server-panel"; -import { Attention, ConnectionFacts, DangerRow, OtherWays, PanelLink, PanelSection, UsesList, Way, type Fact } from "@/components/integration-panel"; -import { KnowledgeDisconnect, KnowledgeSignInControl } from "@/components/knowledge-connection"; +import { Attention, ConnectionFacts, DangerRow, OtherWays, PanelLink, PanelSection, SignInControl, UsesList, Way, type Fact } from "@/components/integration-panel"; +import { KnowledgeDisconnect, KnowledgeSignInControl, beginKnowledgeSignIn } from "@/components/knowledge-connection"; // Settings → Integrations: every outside system Coderhelm connects to, as one // list per kind of tool. One row per integration with the same columns in the // same places (mark, name and a short line, status, one action), so the eye // runs down a column instead of zigzagging across cards. A row opens its -// settings: in place, or on its own page for GitHub, Jira and AWS. Why +// settings: in place, or on its own page for GitHub and AWS. Why // something isn't working is said inside, not on the row. // // Every opened row follows one pattern (components/integration-panel.tsx): @@ -95,10 +96,8 @@ const ORDER: Record = { needs_credentials: 0, needs_r /** What each one is for, short enough for one line of a list. The full sentence is inside. */ const SHORT: Record = { github: "Reads code, opens and reviews pull requests", - jira: "Starts work from tickets and keeps them in step", aws: "Logs, metrics and Airflow through a read-only role", newrelic: "Queries, deploy markers and error rates", - confluence: "Reads pages for context", google_drive: "Folders, Docs, Sheets and PDFs, synced into Knowledge", opensearch: "Searches the indexes your app reads", rest: "Reads records from an API you use", @@ -121,7 +120,10 @@ const SHORT: Record = { turso: "Databases and queries", neon: "Postgres databases and branches", launchdarkly: "Feature flags and targeting", - atlassian: "Jira issues and Confluence pages, through Atlassian's own server", + atlassian: "Jira tickets, Confluence pages and agent tools", + // Older gateways still send Jira and Confluence as rows of their own. + jira: "Starts work from tickets and keeps them in step", + confluence: "Reads pages for context", }; function shortLine(item: Integration): string { @@ -134,6 +136,12 @@ function remoteOf(item: Integration): McpServer | null { return ((item.detail as { remote?: McpServer | null }).remote ?? null) as McpServer | null; } +/** Links made before Jira and Confluence were pieces of the one Atlassian row open that row. */ +const ANCHOR_ALIASES: Record = { + "integration-jira": "integration-atlassian", + "integration-confluence": "integration-atlassian", +}; + /** The anchor a row answers to (`#integration-aws` for the first AWS account). */ function anchorOf(item: Integration, firstAws: boolean): string { if (item.id.startsWith("aws")) return firstAws ? "integration-aws" : `integration-${item.id}`; @@ -167,7 +175,10 @@ function IntegrationsPage() { // Open the row a link points at (#integration-sentry from a skill check). const [target, setTarget] = useState(""); useEffect(() => { - const read = () => setTarget(window.location.hash.replace(/^#/, "")); + const read = () => { + const h = window.location.hash.replace(/^#/, ""); + setTarget(ANCHOR_ALIASES[h] ?? h); + }; read(); window.addEventListener("hashchange", read); return () => window.removeEventListener("hashchange", read); @@ -506,7 +517,7 @@ function IntegrationRow({ )} - {kind === "jira" && appUpdateOf(item) && } + {(kind === "jira" || kind === "atlassian") && appUpdateOf(item) && } {open && (canEdit || personal) && (

@@ -535,6 +546,7 @@ function IntegrationRow({ {kind === "knowledge" && } {kind === "remote" && remote && setOpen(false)} />} {kind === "plugin" && setOpen(false)} />} + {kind === "atlassian" && setOpen(false)} />} {kind === "chat" && }