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
2 changes: 1 addition & 1 deletion packages/app/src/features/auth/account-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function AccountBar() {
<nav aria-label="Main navigation" className="mx-auto flex min-h-16 max-w-6xl flex-wrap items-center justify-between gap-3 px-4 py-3 sm:px-6 lg:px-8">
<Link to="/" className="flex items-center gap-2 text-lg font-bold tracking-tight"><img src={beeMark} alt="" className="size-8 object-contain dark:invert" />Factorize</Link>
<div className="flex flex-wrap items-center gap-2 sm:gap-4">
{authenticated && <><Link to="/projects" activeProps={{ className: "border-factorize-500 text-factorize-700 dark:text-factorize-500", "aria-current": "page" }} className="inline-flex min-h-11 items-center border-b-2 border-transparent px-2 py-2 text-sm font-semibold hover:border-stone-300 dark:hover:border-slate-600">Projects</Link><Link to="/job-runs" activeProps={{ className: "border-factorize-500 text-factorize-700 dark:text-factorize-500", "aria-current": "page" }} className="inline-flex min-h-11 items-center border-b-2 border-transparent px-2 py-2 text-sm font-semibold hover:border-stone-300 dark:hover:border-slate-600">Runs</Link><Link to="/skills" activeProps={{ className: "border-factorize-500 text-factorize-700 dark:text-factorize-500", "aria-current": "page" }} className="inline-flex min-h-11 items-center border-b-2 border-transparent px-2 py-2 text-sm font-semibold hover:border-stone-300 dark:hover:border-slate-600">Skills</Link><SearchLauncher /></>}
{authenticated && <><Link to="/projects" activeProps={{ className: "border-factorize-500 text-factorize-700 dark:text-factorize-500", "aria-current": "page" }} className="inline-flex min-h-11 items-center border-b-2 border-transparent px-2 py-2 text-sm font-semibold hover:border-stone-300 dark:hover:border-slate-600">Projects</Link><Link to="/job-runs" activeProps={{ className: "border-factorize-500 text-factorize-700 dark:text-factorize-500", "aria-current": "page" }} className="inline-flex min-h-11 items-center border-b-2 border-transparent px-2 py-2 text-sm font-semibold hover:border-stone-300 dark:hover:border-slate-600">Runs</Link><SearchLauncher /></>}
<ThemeToggle />
{authenticated ? <div ref={menu} className="relative">
<Button ref={trigger} aria-expanded={open} aria-controls="profile-menu" onClick={() => setOpen(!open)} aria-label="Your account"><span className="flex size-6 items-center justify-center rounded-full bg-factorize-100 text-xs text-slate-950">{(session.data?.user.email ?? "").slice(0, 1).toUpperCase()}</span><span className="hidden sm:inline">Account</span><span aria-hidden="true">⌄</span></Button>
Expand Down
8 changes: 3 additions & 5 deletions packages/app/src/features/runs/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { messageOf } from "../auth/session";
export function RunDetail() {
const { runId } = useParams({ strict: false });
const location = useLocation(), navigate = useNavigate(), cache = useQueryClient();
const tab: "trace" | "info" | "settings" = location.pathname.endsWith("/info") ? "info" : location.pathname.endsWith("/settings") ? "settings" : "trace";
const tabPath = (name: "trace" | "info" | "settings"): "/job-runs/$runId" | "/job-runs/$runId/info" | "/job-runs/$runId/settings" => name === "trace" ? "/job-runs/$runId" : name === "info" ? "/job-runs/$runId/info" : "/job-runs/$runId/settings";
const tab: "trace" | "info" = location.pathname.endsWith("/info") ? "info" : "trace";
const tabPath = (name: "trace" | "info"): "/job-runs/$runId" | "/job-runs/$runId/info" => name === "trace" ? "/job-runs/$runId" : "/job-runs/$runId/info";
const status = useQuery(runStatusQuery(runId!));
const [revision, setRevision] = useState("");
const [now, setNow] = useState(() => Date.now());
Expand Down Expand Up @@ -52,7 +52,7 @@ export function RunDetail() {
</>}
{stop.error && <p role="alert">{stop.error.message}</p>}
<nav role="tablist" aria-label="Run details" className="mt-6 flex gap-1 overflow-x-auto border-b border-stone-200 dark:border-slate-700">
{(["trace", "info", "settings"] as const).map((name, index, tabs) => <Link key={name} to={tabPath(name)} params={{ runId: runId! }} search={{ after: 0 }} role="tab" id={`run-tab-${name}`} aria-controls={`run-panel-${name}`} aria-selected={tab === name} tabIndex={tab === name ? 0 : -1}
{(["trace", "info"] as const).map((name, index, tabs) => <Link key={name} to={tabPath(name)} params={{ runId: runId! }} search={{ after: 0 }} role="tab" id={`run-tab-${name}`} aria-controls={`run-panel-${name}`} aria-selected={tab === name} tabIndex={tab === name ? 0 : -1}
className={`min-h-11 shrink-0 border-b-2 px-4 py-3 text-sm capitalize ${tab === name ? "border-factorize-500 font-semibold" : "border-transparent text-slate-600 hover:border-stone-300 dark:text-slate-400"}`}
onKeyDown={event => {
const next = event.key === "ArrowRight" ? (index + 1) % tabs.length : event.key === "ArrowLeft" ? (index + tabs.length - 1) % tabs.length : event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : null;
Expand All @@ -69,8 +69,6 @@ export function RunDetail() {
<div className="sm:col-span-2"><dt className="text-sm font-semibold text-slate-700 dark:text-slate-300">Execution destination</dt><dd className="break-words text-sm text-slate-600 dark:text-slate-400">{status.data.destination_url && /^https?:\/\//.test(status.data.destination_url) ? <><a className="break-all underline" href={status.data.destination_url} target="_blank" rel="noopener noreferrer">{status.data.destination_url}</a><span className="mt-1 block text-xs">The location where this run executes.</span></> : "Not available for this run"}</dd></div>
</dl>}
<ExpandedRunDetail runId={runId!} />
</section>
<section role="tabpanel" id="run-panel-settings" aria-labelledby="run-tab-settings" hidden={tab !== "settings"} tabIndex={0}>
{status.data && !active ? <ReplayTrace runId={runId!} /> : <p className="my-4">Replay is available after the run finishes and trace finalization completes.</p>}
</section>
<section role="tabpanel" id="run-panel-trace" aria-labelledby="run-tab-trace" hidden={tab !== "trace"} tabIndex={0}>
Expand Down
7 changes: 5 additions & 2 deletions packages/app/src/features/runs/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ export function runRoutes(root: AnyRootRoute) {
const base = createRoute({ getParentRoute: () => root, path: "/job-runs/$runId",
validateSearch, beforeLoad, loader, component,
});
const tab = (path: "/trace" | "/info" | "/settings") => createRoute({ getParentRoute: () => root, path: `/job-runs/$runId${path}`,
const tab = (path: "/trace" | "/info") => createRoute({ getParentRoute: () => root, path: `/job-runs/$runId${path}`,
validateSearch, beforeLoad, loader, component,
});
const contextCompatibility = createRoute({ getParentRoute: () => root, path: "/job-runs/$runId/context",
validateSearch, beforeLoad: ({ params, search }) => { throw redirect({ to: "/job-runs/$runId/info", params, search }); },
});
return [list, base, tab("/trace"), tab("/info"), tab("/settings"), contextCompatibility];
const settingsCompatibility = createRoute({ getParentRoute: () => root, path: "/job-runs/$runId/settings",
validateSearch, beforeLoad: ({ params, search }) => { throw redirect({ to: "/job-runs/$runId/info", params, search }); },
});
return [list, base, tab("/trace"), tab("/info"), settingsCompatibility, contextCompatibility];
}
2 changes: 1 addition & 1 deletion packages/app/test/auth.browser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test("authenticated password route shows settings navigation with the active pas
const settings = page.getByRole("navigation", { name: "Settings" });
await settings.getByRole("link", { name: "Integrations", exact: true }).waitFor();
assert.equal(await settings.getByRole("link", { name: "Skills library", exact: true }).count(), 0);
await page.getByRole("link", { name: "Skills", exact: true }).waitFor();
assert.equal(await page.getByRole("link", { name: "Skills", exact: true }).count(), 0);
const password = settings.getByRole("link", { name: "Change password", exact: true });
await password.waitFor();
assert.equal(await password.getAttribute("aria-current"), "page");
Expand Down
3 changes: 1 addition & 2 deletions packages/app/test/runs.browser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ test("prompt/provenance and diagnostics are lazy, terminal replay retries reuse
await page.getByRole("tab", { name: "Info", exact: true }).click();
await page.getByText("Created", { exact: true }).waitFor(); await page.getByText("Started", { exact: true }).waitFor(); await page.getByText("Queue time", { exact: true }).waitFor(); await page.getByText("Runtime", { exact: true }).waitFor(); await page.getByText("Execution destination", { exact: true }).waitFor();
await page.getByText("Prompt, context and provenance", { exact: true }).click(); await page.getByText("Private prompt", { exact: true }).waitFor(); await page.getByText("trigger-fixture", { exact: true }).waitFor(); await page.getByRole("heading", { name: "Trigger context and occurrence" }).waitFor(); await page.getByText("Diagnostics and artifacts", { exact: true }).click(); await page.getByText(/retained\/log.txt/).waitFor(); assert.equal(detailReads, 1); assert.equal(diagnosticReads, 1);
await page.getByRole("tab", { name: "Settings", exact: true }).click();
await page.getByText("Replay trace", { exact: true }).click(); page.once("dialog", dialog => dialog.accept()); await page.getByRole("button", { name: "Replay retained trace" }).click(); await page.getByRole("alert").filter({ hasText: "Retry replay" }).waitFor(); await page.getByRole("tab", { name: "Trace", exact: true }).click(); await page.getByRole("tab", { name: "Settings", exact: true }).click(); await page.getByRole("alert").filter({ hasText: "Retry replay" }).waitFor(); page.once("dialog", dialog => dialog.accept()); await page.getByRole("button", { name: "Replay retained trace" }).click(); await page.getByRole("status").filter({ hasText: "Trace replay completed." }).waitFor(); assert.equal(await page.getByText("projected", { exact: true }).count(), 0); await page.getByRole("tab", { name: "Trace", exact: true }).click(); await page.getByText("Replayed trace · assistant_message", { exact: true }).waitFor();
await page.getByText("Replay trace", { exact: true }).click(); page.once("dialog", dialog => dialog.accept()); await page.getByRole("button", { name: "Replay retained trace" }).click(); await page.getByRole("alert").filter({ hasText: "Retry replay" }).waitFor(); await page.getByRole("tab", { name: "Trace", exact: true }).click(); await page.getByRole("tab", { name: "Info", exact: true }).click(); await page.getByRole("alert").filter({ hasText: "Retry replay" }).waitFor(); page.once("dialog", dialog => dialog.accept()); await page.getByRole("button", { name: "Replay retained trace" }).click(); await page.getByRole("status").filter({ hasText: "Trace replay completed." }).waitFor(); assert.equal(await page.getByText("projected", { exact: true }).count(), 0); await page.getByRole("tab", { name: "Trace", exact: true }).click(); await page.getByText("Replayed trace · assistant_message", { exact: true }).waitFor();
assert.equal(replays[0].requestId, replays[1].requestId); assert.equal(await page.getByText("Old trace · assistant_message", { exact: true }).count(), 0); await context.close();
});
test("stopping a run submits once, observes stopping state and keeps terminal finalization visible", async () => {
Expand Down
Loading