Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
130 changes: 130 additions & 0 deletions dashboard/e2e/atlassian-one.spec.ts
Original file line number Diff line number Diff line change
@@ -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<string, unknown> = {}) {
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<void>) {
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\//);
});
18 changes: 11 additions & 7 deletions dashboard/e2e/jira-app-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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();
Expand All @@ -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/);
});
Expand Down
6 changes: 3 additions & 3 deletions dashboard/e2e/wide-data/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
},
};
}
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/app/runs/detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
if (idx > max) max = idx;
});
return max;
}, [run?.current_pass, run?.pass_history]);

Check warning on line 327 in dashboard/src/app/runs/detail/page.tsx

View workflow job for this annotation

GitHub Actions / Lint & Build

React Hook useMemo has a missing dependency: 'run'. Either include it or remove the dependency array

if (!runId) {
return (
Expand Down Expand Up @@ -1153,11 +1153,11 @@
{fromJira && jiraApp?.run_note && (
<p className="mt-2 text-sm text-zinc-400" data-testid="run-jira-app-note">
{jiraApp.run_note}
{jiraApp.manage_url && (
{(jiraApp.install_url || jiraApp.manage_url) && (
<>
{" "}
<a href={jiraApp.manage_url} target="_blank" rel="noopener noreferrer" className="text-sky-300 underline-offset-2 hover:underline">
Open Manage apps
<a href={jiraApp.install_url || jiraApp.manage_url} target="_blank" rel="noopener noreferrer" className="text-sky-300 underline-offset-2 hover:underline">
{jiraApp.install_url ? "Update the app" : "Open Atlassian Administration"}
</a>
</>
)}
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/app/settings/integrations/jira/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand Down
Loading
Loading