Skip to content
Merged
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
4 changes: 3 additions & 1 deletion dashboard/e2e/data-sources.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ test("hub: empty state", async ({ page }) => {
await mockApi(page);
await page.goto("/data-sources");

await expect(page.getByRole("heading", { level: 1, name: "Let the reviewer check facts against your real systems" })).toBeVisible();
await expect(page.getByRole("heading", { level: 1, name: "Let Coderhelm check facts against your real systems" })).toBeVisible();
await expect(page.getByRole("link", { name: /An API/ })).toBeVisible();
await expect(page.getByText("Coming next")).toHaveCount(2);
await expect(page.getByRole("link", { name: /A database/ })).toHaveCount(0);
Expand Down Expand Up @@ -441,6 +441,7 @@ test("a source in error status says the reviewer is not using it, and activity e
{ at: now, source_id: "ds_1", source_name: "api.yourcompany.com", actor: "reviewer", repo: "your-team/backend", pr: 123, summary: "Checked the fields of an order", detail: "", ok: true, outcome: "ok", ms: 210 },
{ at: now, source_id: "ds_1", source_name: "api.yourcompany.com", actor: "admin@example.com", summary: "A write was attempted", detail: REFUSAL, ok: false, outcome: "refused", ms: 2 },
{ at: now, source_id: "ds_1", source_name: "api.yourcompany.com", actor: "reviewer", repo: "your-team/web", pr: 7, summary: "Looked up a setting", detail: "Your API did not answer in time.", ok: false, outcome: "failed", ms: 10000 },
{ at: now, source_id: "ds_1", source_name: "api.yourcompany.com", actor: "planner", repo: "your-team/backend", pr: 0, summary: "Checked which fields an order has", detail: "", ok: true, outcome: "ok", ms: 160 },
],
});
await page.goto("/data-sources");
Expand All @@ -454,6 +455,7 @@ test("a source in error status says the reviewer is not using it, and activity e

const activity = page.locator("#activity");
await expect(activity.getByText("Reviewer on your-team/backend #123")).toBeVisible();
await expect(activity.getByText("Planner on your-team/backend", { exact: true })).toBeVisible();
await expect(activity.getByText("admin@example.com")).toBeVisible();
await expect(activity.getByText(REFUSAL)).toBeVisible();
await expect(activity.getByText("Your API did not answer in time.")).toBeVisible();
Expand Down
11 changes: 5 additions & 6 deletions dashboard/src/app/data-sources/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react
import { api, type DataSource, type DataSourceActivityEvent } from "@/lib/api";
import {
DEFAULT_HIDDEN_FIELDS, errorMessage, formatDuration, readSetupHint, clearSetupHint,
runningChecks, timeAgo, toCheckItems,
runningChecks, actorLabel,
timeAgo, toCheckItems,
} from "@/lib/data-sources";
import { RoleGuard } from "@/components/role-guard";
import { useToast } from "@/components/toast";
Expand Down Expand Up @@ -65,10 +66,10 @@ function DataSourcesPage() {
return (
<div className="max-w-4xl">
<h1 className="text-2xl font-bold text-zinc-100 text-balance">
Let the reviewer check facts against your real systems
Let Coderhelm check facts against your real systems
</h1>
<p className="mt-2 max-w-prose text-sm text-zinc-400">
Connect a source and the reviewer can look things up while it reviews, like whether a field really exists or a
Connect a source and Coderhelm can look things up while it plans, writes code and reviews, like whether a field really exists or a
setting is live. It can only read. It can never change your data.
</p>
{anyOn && (
Expand Down Expand Up @@ -558,9 +559,7 @@ function Activity({ events, error, loading }: { events: DataSourceActivityEvent[
)}
<p className="mt-1 break-words text-xs text-zinc-500">
<span className="text-zinc-400">
{ev.actor === "reviewer"
? ev.repo ? `Reviewer on ${ev.repo}${ev.pr ? ` #${ev.pr}` : ""}` : "Reviewer"
: ev.actor}
{actorLabel(ev)}
</span>
<span aria-hidden="true"> · </span>
{ev.source_name}
Expand Down
15 changes: 15 additions & 0 deletions dashboard/src/lib/data-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,18 @@ export function prettyJson(text: string): string {
export function errorMessage(e: unknown, fallback: string): string {
return e instanceof Error && e.message ? e.message : fallback;
}

/** Agents that look things up, by the name the activity log records. */
const AGENT_NAMES: Record<string, string> = {
reviewer: "Reviewer",
planner: "Planner",
coder: "Coding agent",
};

/** Who ran a lookup: an agent and where it was working, or a person's email. */
export function actorLabel(ev: { actor: string; repo?: string; pr?: number }): string {
const agent = AGENT_NAMES[ev.actor];
if (!agent) return ev.actor;
if (!ev.repo) return agent;
return `${agent} on ${ev.repo}${ev.pr ? ` #${ev.pr}` : ""}`;
}
Loading