feat(webui): inspect file context in a live graph sidebar (#6562)
* feat(webui): inspect file context in a live graph sidebar * refactor(webui): place preview controls in the shared sidebar header * fix(webui): synchronize npm lockfile for graph dependencies * fix(webui): preserve compacted context and refine graph inspection * fix(context): harden provenance, request usage, and drawer lifecycle * fix(webui): align source skeleton and browser fixtures * perf(context): reuse source analysis and capture request graphs once * perf(webui): compact graph history and render graph motion on canvas * fix(webui): remove redundant context sidebar header * style(webui): clarify context replay icon * perf(webui): pace context replay on an adaptive timeline * feat(webui): briefly reveal labels for new context nodes * fix(webui): reveal new labels only for loaded context files * fix(webui): restart graph animation clock after idle * fix(webui): reveal labels when replay reverses node exit * refactor(context): project file-use facts without retention tracking * refactor(context): observe file reads outside agent execution * fix(webui): animate context sidebar closing * refactor(context): remove unused graph and usage panel code * refactor(context): isolate prompt observation from execution metadata * fix(webui): clarify cache rate and show context token usage * fix(webui): abbreviate context token counts in thousands * fix(webui): omit token unit from context usage details * fix(webui): restore large source preview highlighting and panel elevation * fix(webui): distinguish modifier scrolling from keyboard focus * fix(webui): align preview tab and panel corner radii * fix(webui): attach file tabs to the header divider * fix(webui): use one action to toggle file preview mode * fix(webui): use hover hint for context replay * fix(webui): share composer layout between graph and file sidebars * fix(webui): align sidebar bottom with composer surface * fix(webui): restore mobile graph drawing and touch file details * test(webui): align legacy cache assertions with current label * perf(context): retain source analysis and bound graph animation work * style(webui): add light elevation to user messages * test(webui): await lazy graph scene before replay assertions * fix(webui): align preview skeleton and browser contracts
This commit is contained in:
1 parent
2b44088413
commit
519ed81132
132 files changed
+4673
-1159
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { ContextInspector } from "@/components/thread/ContextInspector";
|
||||
import { ComposerUsagePopover } from "@/components/thread/ComposerUsagePopover";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { initializeI18n } from "@/i18n";
|
||||
import type { ContextSnapshot } from "@/lib/types";
|
||||
import "../src/globals.css";
|
||||
|
||||
const snapshots: ContextSnapshot[] = [
|
||||
{ id: "first", contextWindowTokens: 10000, usage: { prompt_tokens: 1000 }, graph: {
|
||||
nodes: [{ path: "/a.md", name: "a.md", state: "loaded", tokens: 100 }], edges: [],
|
||||
} },
|
||||
{ id: "second", contextWindowTokens: 10000, usage: { prompt_tokens: 2000 }, graph: {
|
||||
nodes: [{ path: "/a.md", name: "a.md", state: "loaded", tokens: 100 }, { path: "/b.md", name: "b.md", state: "discovered", tokens: 0 }],
|
||||
edges: [{ source: "/a.md", target: "/b.md" }],
|
||||
} },
|
||||
];
|
||||
const largeNodes = Array.from({ length: 500 }, (_, index) => ({ path: `/file-${index}.md`, name: `file-${index}.md`, state: "loaded" as const, tokens: 100 }));
|
||||
const large: ContextSnapshot[] = [{ id: "large", contextWindowTokens: 100000, usage: { prompt_tokens: 50000 }, graph: {
|
||||
nodes: largeNodes, edges: largeNodes.slice(1).map((node, index) => ({ source: largeNodes[Math.floor(index / 2)].path, target: node.path })),
|
||||
} }];
|
||||
function Fixture() {
|
||||
const [showLarge, setShowLarge] = useState(false);
|
||||
const [pythonLoaded, setPythonLoaded] = useState(false);
|
||||
const frames = new URLSearchParams(location.search).has("single") ? snapshots.map((snapshot) => ({ ...snapshot, graph: snapshots[0].graph })) : snapshots;
|
||||
const inspectedFrames = pythonLoaded ? [...frames, { ...frames[1], id: "python", graph: {
|
||||
nodes: [...frames[1].graph.nodes, { path: "/worker.py", name: "worker.py", state: "loaded" as const, tokens: 200 }], edges: frames[1].graph.edges,
|
||||
} }] : frames;
|
||||
const [opened, setOpened] = useState("");
|
||||
const [sidebarHost, setSidebarHost] = useState<HTMLElement | null>(null);
|
||||
if (new URLSearchParams(location.search).has("drawer")) return <main ref={setSidebarHost} className="relative" style={{ height: "100dvh" }}>
|
||||
<ComposerUsagePopover sidebarHost={sidebarHost} context={null} rounds={[]} snapshots={frames} onOpenFile={setOpened} />
|
||||
<output>{opened}</output>
|
||||
</main>;
|
||||
return <main className="mx-auto max-w-2xl p-4"><ContextInspector context={null} rounds={[]} snapshots={showLarge ? large : inspectedFrames} onOpenFile={setOpened} /><output>{opened}</output>{new URLSearchParams(location.search).has("pair") && <section aria-label="Second graph"><ContextInspector context={null} rounds={[]} snapshots={frames} /></section>}<button onClick={() => setShowLarge(true)}>Load 500 nodes</button><button onClick={() => setPythonLoaded(true)}>Read Python file</button></main>;
|
||||
}
|
||||
await initializeI18n();
|
||||
createRoot(document.getElementById("root")!).render(<TooltipProvider><Fixture /></TooltipProvider>);
|
||||
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><title>Context graph interaction</title></head><body><div id="root"></div><script type="module" src="/browser/context-graph-fixture.tsx"></script></body></html>
|
||||
@@ -0,0 +1,205 @@
|
||||
import { expect, test, type Locator } from "@playwright/test";
|
||||
|
||||
test.use({ reducedMotion: "reduce" });
|
||||
async function dotWidth(canvas: Locator, x: number, y: number) {
|
||||
return canvas.evaluate((element: HTMLCanvasElement, point) => {
|
||||
const scale = element.width / element.getBoundingClientRect().width;
|
||||
const pixels = element.getContext("2d")!.getImageData(Math.round((point.x - 15) * scale), Math.round(point.y * scale), Math.round(30 * scale), 1).data;
|
||||
let painted = 0;
|
||||
for (let index = 3; index < pixels.length; index += 4) if (pixels[index] > 0) painted++;
|
||||
return painted / scale;
|
||||
}, { x, y });
|
||||
}
|
||||
|
||||
test("graph keyboard controls, pointer hit targets, pixels and replay agree", async ({ page }) => {
|
||||
await page.goto("/browser/context-graph.html?single");
|
||||
const node = page.getByRole("button", { name: "a.md", exact: true });
|
||||
await expect(node).toBeAttached();
|
||||
await node.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(page.getByText("About 100 tokens")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Open file" }).click();
|
||||
await expect(page.locator("output")).toHaveText("/a.md");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(node).toBeFocused();
|
||||
await page.keyboard.press("Space");
|
||||
await expect(page.getByText("About 100 tokens")).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
const canvas = page.locator("canvas");
|
||||
const box = (await canvas.boundingBox())!;
|
||||
let x = box.x + box.width / 2;
|
||||
const y = box.y + box.height / 2;
|
||||
await expect.poll(() => dotWidth(canvas, box.width / 2, box.height / 2)).toBeGreaterThan(0);
|
||||
const radiusBefore = await dotWidth(canvas, box.width / 2, box.height / 2);
|
||||
await page.mouse.move(x + 40, y);
|
||||
await page.mouse.wheel(0, -400);
|
||||
x += 40 - 40 * Math.exp(0.8);
|
||||
await expect.poll(() => dotWidth(canvas, x - box.x, box.height / 2)).toBeGreaterThan(0);
|
||||
expect(Math.abs(await dotWidth(canvas, x - box.x, box.height / 2) - radiusBefore)).toBeLessThanOrEqual(1);
|
||||
await page.mouse.click(x + 11, y);
|
||||
await expect(page.getByText("About 100 tokens")).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await page.mouse.click(x + 15, y);
|
||||
await expect(page.getByText("About 100 tokens")).toHaveCount(0);
|
||||
await page.mouse.move(x, y); await page.mouse.down();
|
||||
await page.mouse.move(x + 50, y + 30, { steps: 5 }); await page.mouse.up();
|
||||
await expect(page.getByText("About 100 tokens")).toHaveCount(0);
|
||||
await expect.poll(() => dotWidth(canvas, x - box.x + 50, box.height / 2 + 30)).toBeGreaterThan(0);
|
||||
const replay = page.getByRole("button", { name: "Play context history" });
|
||||
await replay.click();
|
||||
await expect(page.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "10");
|
||||
await expect(replay).toBeDisabled();
|
||||
await expect(replay).toBeEnabled();
|
||||
await expect(page.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "20");
|
||||
});
|
||||
|
||||
test.describe("touch graph", () => {
|
||||
test.use({ viewport: { width: 390, height: 740 }, hasTouch: true });
|
||||
test("recovers batched drawer visibility, replays and opens a file by touch", async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
const NativeObserver = window.IntersectionObserver;
|
||||
window.IntersectionObserver = class extends NativeObserver {
|
||||
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit) {
|
||||
super((entries, observer) => {
|
||||
// Captured on a real drawer entrance under CPU throttling: the
|
||||
// offscreen record and subsequent onscreen record share a callback.
|
||||
const latest = entries[entries.length - 1];
|
||||
callback(latest.isIntersecting
|
||||
? [{ ...latest, isIntersecting: false }, ...entries]
|
||||
: entries, observer);
|
||||
}, options);
|
||||
}
|
||||
};
|
||||
});
|
||||
await page.goto("/browser/context-graph.html?single&drawer");
|
||||
await page.getByTestId("composer-context-usage").tap();
|
||||
const canvas = page.locator("canvas");
|
||||
const box = (await canvas.boundingBox())!;
|
||||
await expect.poll(() => dotWidth(canvas, box.width / 2, box.height / 2)).toBeGreaterThan(0);
|
||||
const replay = page.getByRole("button", { name: "Play context history" });
|
||||
await replay.click();
|
||||
await expect(page.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "10");
|
||||
await expect(replay).toBeEnabled();
|
||||
await expect(page.getByRole("progressbar")).toHaveAttribute("aria-valuenow", "20");
|
||||
const settledBox = (await canvas.boundingBox())!;
|
||||
await page.touchscreen.tap(settledBox.x + settledBox.width / 2, settledBox.y + settledBox.height / 2);
|
||||
const openFile = page.getByRole("button", { name: "Open file", exact: true });
|
||||
await expect(openFile).toBeVisible();
|
||||
await openFile.tap();
|
||||
await expect(page.locator("output")).toHaveText("/a.md");
|
||||
await expect(page.getByTestId("context-sidebar")).toHaveCount(0);
|
||||
});
|
||||
test("keeps a 44px touch target and redraws on theme changes", async ({ page }) => {
|
||||
await page.goto("/browser/context-graph.html?single");
|
||||
const node = page.getByRole("button", { name: "a.md", exact: true });
|
||||
await expect(node).toBeAttached();
|
||||
const canvas = page.locator("canvas");
|
||||
const box = (await canvas.boundingBox())!;
|
||||
await expect.poll(() => dotWidth(canvas, box.width / 2, box.height / 2)).toBeGreaterThan(0);
|
||||
const color = () => canvas.evaluate((element: HTMLCanvasElement) => Array.from(element.getContext("2d")!.getImageData(element.width / 2, element.height / 2, 1, 1).data));
|
||||
const before = await color();
|
||||
await page.evaluate(() => document.documentElement.classList.add("dark"));
|
||||
await expect.poll(color).not.toEqual(before);
|
||||
const x = box.x + box.width / 2, y = box.y + box.height / 2;
|
||||
await page.touchscreen.tap(x + 21, y);
|
||||
await expect(page.getByText("About 100 tokens")).toBeVisible();
|
||||
await page.getByRole("button", { name: "Open file" }).focus();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(node).toBeFocused();
|
||||
await page.touchscreen.tap(x + 23, y);
|
||||
await expect(page.getByText("About 100 tokens")).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
graphDrawTrace: { arcs: number; frames: number; maxTask: number; start: number };
|
||||
pythonLabelPaints: number[];
|
||||
}
|
||||
}
|
||||
|
||||
test.describe("normal-motion file loading", () => {
|
||||
test.use({ reducedMotion: "no-preference" });
|
||||
test("introduces a loaded Python filename after idle and again during fast history replay", async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
window.pythonLabelPaints = [];
|
||||
const fillText = CanvasRenderingContext2D.prototype.fillText;
|
||||
CanvasRenderingContext2D.prototype.fillText = function (...args) {
|
||||
if (args[0] === "worker.py") window.pythonLabelPaints.push(this.globalAlpha);
|
||||
return fillText.apply(this, args);
|
||||
};
|
||||
});
|
||||
await page.goto("/browser/context-graph.html?single");
|
||||
await expect(page.getByRole("button", { name: "a.md", exact: true })).toBeAttached();
|
||||
// Let the existing labels finish, then leave the stopped animation clock idle.
|
||||
await page.waitForTimeout(6500);
|
||||
await page.getByRole("button", { name: "Read Python file" }).click();
|
||||
await expect(page.getByRole("button", { name: "worker.py", exact: true })).toBeAttached();
|
||||
await expect.poll(() => page.evaluate(() => window.pythonLabelPaints.some((alpha) => alpha > 0.9))).toBe(true);
|
||||
await expect.poll(() => page.evaluate(() => {
|
||||
const alpha = window.pythonLabelPaints.at(-1) ?? 1;
|
||||
return alpha > 0 && alpha < 0.3;
|
||||
})).toBe(true);
|
||||
await page.waitForTimeout(700);
|
||||
const paints = await page.evaluate(() => window.pythonLabelPaints.length);
|
||||
await page.waitForTimeout(200);
|
||||
expect(await page.evaluate(() => window.pythonLabelPaints.length)).toBe(paints);
|
||||
await page.evaluate(() => { window.pythonLabelPaints = []; });
|
||||
await page.getByRole("button", { name: "Play context history" }).click();
|
||||
await expect.poll(() => page.evaluate(() => window.pythonLabelPaints.some((alpha) => alpha > 0.9))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test("500 reduced-motion nodes settle over multiple frames and are all painted", async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
window.graphDrawTrace = { arcs: 0, frames: 0, maxTask: 0, start: Infinity };
|
||||
const clear = CanvasRenderingContext2D.prototype.clearRect;
|
||||
CanvasRenderingContext2D.prototype.clearRect = function (...args) { window.graphDrawTrace.arcs = 0; return clear.apply(this, args); };
|
||||
const arc = CanvasRenderingContext2D.prototype.arc;
|
||||
CanvasRenderingContext2D.prototype.arc = function (...args) { window.graphDrawTrace.arcs++; return arc.apply(this, args); };
|
||||
const count = () => { window.graphDrawTrace.frames++; requestAnimationFrame(count); };
|
||||
requestAnimationFrame(count);
|
||||
new PerformanceObserver((entries) => {
|
||||
for (const entry of entries.getEntries()) if (entry.startTime >= window.graphDrawTrace.start) window.graphDrawTrace.maxTask = Math.max(window.graphDrawTrace.maxTask, entry.duration);
|
||||
}).observe({ entryTypes: ["longtask"] });
|
||||
});
|
||||
await page.goto("/browser/context-graph.html");
|
||||
await expect(page.getByRole("button", { name: "a.md", exact: true })).toBeAttached();
|
||||
await page.evaluate(() => { window.graphDrawTrace = { arcs: 0, frames: 0, maxTask: 0, start: performance.now() }; });
|
||||
await page.getByRole("button", { name: "Load 500 nodes" }).click();
|
||||
await expect(page.getByRole("button", { name: /^file-\d+\.md$/ })).toHaveCount(500);
|
||||
await expect.poll(() => page.evaluate(() => window.graphDrawTrace.arcs), { timeout: 15000 }).toBe(500);
|
||||
const trace = await page.evaluate(() => window.graphDrawTrace);
|
||||
expect(trace.frames).toBeGreaterThan(2);
|
||||
expect(trace.maxTask).toBeLessThan(100);
|
||||
});
|
||||
|
||||
|
||||
test("node details do not pan their graph and dismiss when another graph is clicked", async ({ page }) => {
|
||||
await page.goto("/browser/context-graph.html?single&pair");
|
||||
const firstNode = page.getByRole("button", { name: "a.md", exact: true }).first();
|
||||
const firstCanvas = page.locator("canvas").first();
|
||||
const box = (await firstCanvas.boundingBox())!;
|
||||
await expect.poll(() => dotWidth(firstCanvas, box.width / 2, box.height / 2)).toBeGreaterThan(0);
|
||||
await page.mouse.move(box.x + 8, box.y + 8); await page.mouse.down();
|
||||
await page.mouse.move(box.x + 58, box.y + 8); await page.mouse.up();
|
||||
await expect.poll(() => dotWidth(firstCanvas, box.width / 2 + 50, box.height / 2)).toBeGreaterThan(0);
|
||||
await firstNode.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
const details = page.getByText("About 100 tokens");
|
||||
await expect(details).toBeVisible();
|
||||
await details.click();
|
||||
await expect(details).toBeVisible();
|
||||
await details.dblclick();
|
||||
await expect(details).toBeVisible();
|
||||
expect(await dotWidth(firstCanvas, box.width / 2 + 50, box.height / 2)).toBeGreaterThan(0);
|
||||
const secondCanvas = page.getByRole("region", { name: "Second graph" }).locator("canvas");
|
||||
await secondCanvas.click({ position: { x: 8, y: 8 } });
|
||||
await expect(details).toHaveCount(0);
|
||||
await firstNode.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(details).toBeVisible();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(details).toHaveCount(0);
|
||||
});
|
||||
@@ -715,8 +715,8 @@ for (const elapsedMs of [0, 80]) test(`fast responses reclaim completed slots an
|
||||
await completePrepend(history, body, "Question 16", "Question 28", nextHeld.anchorTop);
|
||||
await expect(body.locator(".thread-history-slot")).toHaveCount(0);
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=120&before=28&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=120&before=28&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -924,10 +924,10 @@ test("navigation-window loading and errors remain visible and retry uses the nav
|
||||
await positionAtTop(body);
|
||||
await expect(page.locator('.thread-history-status[data-state="loading"]')).toHaveCount(0);
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=24&after=38&include_model_requests=1",
|
||||
"?limit=24&after=50&include_model_requests=1",
|
||||
"?limit=24&before=38&include_model_requests=1",
|
||||
"?limit=24&before=38&include_model_requests=1",
|
||||
"?limit=24&after=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&after=50&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -972,8 +972,8 @@ test("failed Blocks animate without visible error text; pulling retries once and
|
||||
expect((await historyGeometry(body, "Question 40")).slotBeforeKey).toBe("u40");
|
||||
await expectCoordinates(body, "Question 40", held);
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
|
||||
history.complete();
|
||||
@@ -1015,9 +1015,9 @@ test("cross-path unloaded rail jump has visible navigation feedback outside a sc
|
||||
await expect.poll(() => history.reads.length).toBe(3);
|
||||
await expect(page.locator('.thread-history-status[data-state="loading"]')).toBeInViewport();
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=24&after=10&include_model_requests=1",
|
||||
"?limit=24&after=10&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&after=10&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&after=10&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
history.complete();
|
||||
await expect(body.getByText("Question 10", { exact: true })).toBeInViewport();
|
||||
@@ -1060,10 +1060,10 @@ test("cross-path newer has visible navigation feedback and forward input retries
|
||||
await expect.poll(() => history.reads.length).toBe(4);
|
||||
await expect(page.locator('.thread-history-status[data-state="loading"]')).toBeInViewport();
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=24&after=10&include_model_requests=1",
|
||||
"?limit=24&before=10&include_model_requests=1",
|
||||
"?limit=24&after=22&include_model_requests=1",
|
||||
"?limit=24&after=22&include_model_requests=1",
|
||||
"?limit=24&after=10&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=10&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&after=22&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&after=22&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
history.complete();
|
||||
await expect(body.getByText("Question 33", { exact: true })).toBeAttached();
|
||||
@@ -1109,8 +1109,8 @@ test("cross-path older errors never float after latest or a loaded rail jump, bu
|
||||
await retry.click();
|
||||
await expect.poll(() => history.reads.length).toBe(initialReads + 2);
|
||||
expect(history.reads.slice(initialReads)).toEqual([
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=120&before=40&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
history.complete();
|
||||
await expect(body.getByText("Question 28", { exact: true })).toBeAttached();
|
||||
@@ -1202,9 +1202,9 @@ test("bounded navigation retains three pages and reclaims each completed wheel o
|
||||
await expectAnchorCoordinate(body, "Question 26", secondHeld.anchorTop);
|
||||
expect((await historyGeometry(body, "Question 26")).slotBeforeKey).toBeNull();
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=24&after=38&include_model_requests=1",
|
||||
"?limit=24&before=38&include_model_requests=1",
|
||||
"?limit=24&before=26&include_model_requests=1",
|
||||
"?limit=24&after=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=26&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
|
||||
const atNewHead = await approachNextHead("Question 14");
|
||||
@@ -1229,10 +1229,10 @@ test("bounded navigation retains three pages and reclaims each completed wheel o
|
||||
await expect(header).toHaveCount(0);
|
||||
await expect(page.getByText("No earlier messages", { exact: true })).toHaveCount(0);
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=24&after=38&include_model_requests=1",
|
||||
"?limit=24&before=38&include_model_requests=1",
|
||||
"?limit=24&before=26&include_model_requests=1",
|
||||
"?limit=24&before=14&include_model_requests=1",
|
||||
"?limit=24&after=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=26&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=14&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
|
||||
const atKeyboardHead = await approachNextHead("Question 2");
|
||||
@@ -1261,11 +1261,11 @@ test("bounded navigation retains three pages and reclaims each completed wheel o
|
||||
await expect(body.getByText("Question 26", { exact: true })).toHaveCount(0);
|
||||
await expect(body.locator('[data-thread-display-unit^="u"]')).toHaveCount(26);
|
||||
expect(history.reads).toEqual([
|
||||
"?limit=24&after=38&include_model_requests=1",
|
||||
"?limit=24&before=38&include_model_requests=1",
|
||||
"?limit=24&before=26&include_model_requests=1",
|
||||
"?limit=24&before=14&include_model_requests=1",
|
||||
"?limit=24&before=2&include_model_requests=1",
|
||||
"?limit=24&after=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=38&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=26&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=14&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
"?limit=24&before=2&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ for (const { width, dark } of [{ width: 360, dark: false }, { width: 314, dark:
|
||||
|
||||
await usage.click();
|
||||
const details = page.getByRole("dialog", { name: "Context usage" });
|
||||
await expect(details.getByRole("progressbar", { name: "Context 22%" })).toHaveAttribute("aria-valuenow", "22");
|
||||
await expect(details.getByRole("progressbar", { name: "Context" })).toHaveAttribute("aria-valuenow", "22");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(usage).toBeFocused();
|
||||
|
||||
|
||||
@@ -52,21 +52,21 @@ test("complete rail scrolls independently, jumps to unloaded history and returns
|
||||
await expect(first).toBeFocused();
|
||||
await first.press("Enter");
|
||||
await expect(body.getByText("Question 0", { exact: true })).toBeInViewport();
|
||||
expect(reads).toEqual(["?limit=24&after=0&include_model_requests=1"]);
|
||||
expect(reads).toEqual(["?limit=24&after=0&include_model_requests=1&context_graph_encoding=references-v1"]);
|
||||
await expect(body.getByText("Question 1999", { exact: true })).toHaveCount(0);
|
||||
// Force input-before-scroll ordering instead of relying on compositor timing.
|
||||
await body.evaluate((node) => node.addEventListener("wheel", () => undefined, { passive: false }));
|
||||
for (const after of [10, 20, 30, 40]) {
|
||||
await body.hover();
|
||||
await page.mouse.wheel(0, 10000);
|
||||
await expect.poll(() => reads.some((query) => query === `?limit=24&after=${after}&include_model_requests=1`)).toBe(true);
|
||||
await expect.poll(() => reads.some((query) => query === `?limit=24&after=${after}&include_model_requests=1&context_graph_encoding=references-v1`)).toBe(true);
|
||||
await expect(body.getByText(`Question ${after + 9}`, { exact: true })).toBeAttached();
|
||||
}
|
||||
expect(await body.locator("[data-user-prompt-id]").count()).toBeLessThanOrEqual(30);
|
||||
await body.hover();
|
||||
await page.mouse.wheel(0, -100000);
|
||||
await expect.poll(() => reads.some((query) => (
|
||||
query.startsWith("?limit=24&before=") && query.endsWith("&include_model_requests=1")
|
||||
query.startsWith("?limit=24&before=") && query.endsWith("&include_model_requests=1&context_graph_encoding=references-v1")
|
||||
))).toBe(true);
|
||||
await page.getByRole("button", { name: "Scroll to bottom" }).click();
|
||||
await expect(body.getByText("Question 1999", { exact: true })).toBeVisible();
|
||||
|
||||
@@ -137,7 +137,7 @@ function SkeletonSurface() {
|
||||
: surface === "automations" ? <AutomationsSettings payload={empty ? null : { jobs }} loading={loading} filter="all" actionKey={null} error={state === "error" ? "Preview read failed" : null}
|
||||
onFilterChange={noop} onAction={noop} onRequestEdit={noop} onRequestDelete={noop} />
|
||||
: surface === "skill-detail" ? <SkillsCatalogSettings skills={[skill]} />
|
||||
: surface === "session-jobs" ? <SessionInfoPopoverView title="Project review" jobs={empty ? [] : jobs} loading={loading} loadFailed={state === "error"} now={now}
|
||||
: surface === "session-jobs" ? <SessionInfoPopoverView jobs={empty ? [] : jobs} loading={loading} loadFailed={state === "error"} now={now}
|
||||
onAction={async () => jobs} onEdit={async () => jobs} />
|
||||
: surface === "linear-members" ? <LinearMemberAccessView snapshot={{ payload: empty ? null : members, loading, error: state === "error" ? "Preview read failed" : null, saves: {} }} onLoad={noop} onSetAllowed={noop} /> : null}
|
||||
</main>}
|
||||
|
||||
@@ -202,7 +202,7 @@ for (const width of [390, 1440]) {
|
||||
await page.goto(fixture("file", true));
|
||||
sameBox(await box(status(page).locator(".font-mono")), source);
|
||||
const line = await box(status(page).locator(".font-mono > div > :last-child").first());
|
||||
expect(line.x).toBe(code.x);
|
||||
expect(line.x).toBeCloseTo(code.x, 1);
|
||||
await noOverflow(page);
|
||||
await page.goto(fixture("markdown"));
|
||||
const heading = await box(page.getByRole("heading", { name: "Project overview" }));
|
||||
@@ -216,7 +216,7 @@ for (const width of [390, 1440]) {
|
||||
await noOverflow(page);
|
||||
await page.goto(fixture("markdown"));
|
||||
await expect(page.getByRole("heading", { name: "Project overview" })).toBeVisible();
|
||||
await page.getByTestId("file-preview-panel").locator(".segmented-control button").nth(1).click();
|
||||
await page.getByTestId("file-preview-panel").getByRole("button", { name: locale === "en" ? "Source" : "原文", exact: true }).click();
|
||||
await expect(page.getByTestId("viewport-code-rows")).toBeVisible();
|
||||
const markdownSource = await box(page.locator("pre"));
|
||||
await page.getByTestId("reload-preview").click();
|
||||
|
||||
@@ -62,7 +62,7 @@ function ThemeChatFixture({ theme, toggle }: { theme: "light" | "dark"; toggle:
|
||||
<ThreadViewport messages={messages} isStreaming={false} conversationKey={activeKey}
|
||||
navigationFrame={context.navigationFrame} composer={null} />
|
||||
<ThreadHistoryStatus loading={false} error={null} exhausted onRetry={noop} />
|
||||
{context.composerPortalTarget && createPortal(composer, context.composerPortalTarget)}
|
||||
{context.composerPortalTarget && createPortal(<div data-active-composer>{composer}</div>, context.composerPortalTarget)}
|
||||
</div>} />
|
||||
</div>
|
||||
</main>;
|
||||
|
||||
@@ -66,7 +66,16 @@ for (const narrow of [false, true]) {
|
||||
for (const selector of ["table", "th", "td"]) {
|
||||
expect((await metrics(page.locator(`.markdown-content ${selector}`).first())).size).toBeCloseTo(bodySize * 0.875);
|
||||
}
|
||||
expect(await tables.first().evaluate(node => node.scrollWidth <= node.clientWidth + 1)).toBe(true);
|
||||
// Wide tables scroll within their wrapper instead of squeezing words into single letters.
|
||||
const textTable = tables.first();
|
||||
await expect(textTable).toHaveCSS("overflow-x", "auto");
|
||||
await textTable.evaluate(node => { node.scrollLeft = node.scrollWidth; });
|
||||
expect(await textTable.evaluate(node => {
|
||||
const bounds = node.getBoundingClientRect();
|
||||
const lastCell = node.querySelector("tbody td:last-child")!.getBoundingClientRect();
|
||||
return lastCell.right <= bounds.right + 1 && lastCell.right > bounds.left;
|
||||
})).toBe(true);
|
||||
await textTable.evaluate(node => { node.scrollLeft = 0; });
|
||||
await expect.poll(() => formulaTable.locator(".katex-html > .base").evaluateAll((nodes) => nodes.every((node) => {
|
||||
const formula = node.getBoundingClientRect();
|
||||
const cell = node.closest("th, td")!;
|
||||
|
||||
Reference in new issue
Block a user