Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(e2e): harden real-tier specs, CI, and mock-gate rigor after review

Sergey Kozyrenko4b6dd0423e87
diff --git a/.github/workflows/e2e-report.yml b/.github/workflows/e2e-report.yml
index 560aba5e..3b8c8f34 100644
--- a/.github/workflows/e2e-report.yml
+++ b/.github/workflows/e2e-report.yml
@@ -13,10 +13,19 @@ permissions:
actions: read
pull-requests: write
+# A cancelled superseded run must not race the report of the run that
+# replaced it and become the sticky comment's last writer.
+concurrency:
+ group: e2e-report-${{ github.event.workflow_run.head_branch }}
+ cancel-in-progress: true
+
jobs:
comment:
- if: github.event.workflow_run.event == 'pull_request'
+ if: >
+ github.event.workflow_run.event == 'pull_request' &&
+ github.event.workflow_run.conclusion != 'cancelled'
runs-on: ubuntu-latest
+ timeout-minutes: 5
steps:
- name: Download results
continue-on-error: true
@@ -72,12 +81,20 @@ jobs:
'Debug a red run locally: download the `e2e-report` artifact and open the trace with `pnpm exec playwright show-trace <trace.zip>`.',
].join('\n');
- const { data: comments } = await github.rest.issues.listComments({
+ const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
+ per_page: 100,
});
- const existing = comments.find((comment) => comment.body?.startsWith(marker));
+ // Author check: anyone can pre-post the marker; only the bot's own
+ // comment may claim the sticky slot.
+ const existing = comments.find(
+ (comment) =>
+ comment.body?.startsWith(marker) &&
+ comment.user?.type === 'Bot' &&
+ comment.user?.login === 'github-actions[bot]',
+ );
if (existing) {
await github.rest.issues.updateComment({
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 35dedcef..d55174cc 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -5,6 +5,9 @@ name: E2E
on:
pull_request:
+ # `labeled` lets applying `e2e:stand` start the stand job by itself; the
+ # default types never fire on label changes.
+ types: [opened, synchronize, reopened, labeled]
push:
branches:
- main
@@ -13,16 +16,30 @@ on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
+ inputs:
+ tier:
+ description: "Extra tier to run on top of mock + visual"
+ type: choice
+ options:
+ - none
+ - local
+ - stand
+ - all
+ default: local
permissions:
contents: read
+# Keyed on the PR number (not the branch name — two fork PRs named identically
+# would cancel each other) and the event action (a `labeled` run must not
+# cancel an in-flight `synchronize` run of the same PR).
concurrency:
- group: e2e-${{ github.head_ref || github.run_id }}
+ group: e2e-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
e2e-mock:
+ if: github.event.action != 'labeled'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
@@ -75,8 +92,9 @@ jobs:
- name: Append trend record
if: always()
+ continue-on-error: true
working-directory: frontend
- run: node e2e/tools/trend.mjs || true
+ run: node e2e/tools/trend.mjs
env:
E2E_TREND_SHA: ${{ github.sha }}
E2E_TREND_REF: ${{ github.head_ref || github.ref_name }}
@@ -93,6 +111,7 @@ jobs:
# Visual snapshots: pinned container = pixel-stable baselines. Advisory —
# never a required check.
e2e-visual:
+ if: github.event.action != 'labeled'
runs-on: ubuntu-latest
timeout-minutes: 20
container:
@@ -116,6 +135,14 @@ jobs:
with:
package_json_file: frontend/package.json
+ # The dist must be built with the pinned Node, not whatever the
+ # Playwright container ships — local baselines are built under .nvmrc
+ # and pixel-stability assumes identically built bundles.
+ - name: Set up Node.js
+ uses: actions/setup-node@v6
+ with:
+ node-version-file: frontend/.nvmrc
+
- name: Install dependencies
working-directory: frontend
run: pnpm install --frozen-lockfile
@@ -140,7 +167,10 @@ jobs:
# Tier 2: branch-built image + isolated compose stack + the mock-LLM agent
# loop. Not part of the PR gate — nightly and on-demand only.
e2e-local:
- if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
+ if: >
+ github.event_name == 'schedule' ||
+ (github.event_name == 'workflow_dispatch' &&
+ contains(fromJSON('["local", "all"]'), inputs.tier))
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
@@ -184,7 +214,8 @@ jobs:
# run blocks on a human. Fork PRs never reach it (they get Tier 1 only).
e2e-stand:
if: >
- github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'workflow_dispatch' &&
+ contains(fromJSON('["stand", "all"]'), inputs.tier)) ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'e2e:stand'))
runs-on: ubuntu-latest
@@ -224,16 +255,19 @@ jobs:
working-directory: frontend
run: pnpm exec playwright install --with-deps chromium
+ # The config scopes the stand tier to @stand specs — no CLI grep to
+ # drift out of sync with the tags.
- name: Run stand smoke
working-directory: frontend
- run: E2E_TIER=stand npx playwright test -c e2e/playwright.config.ts --grep @smoke
+ run: E2E_TIER=stand npx playwright test -c e2e/playwright.config.ts
env:
E2E_BASE_URL: ${{ secrets.E2E_STAND_URL }}
E2E_USER: ${{ secrets.E2E_STAND_USER }}
E2E_PASSWORD: ${{ secrets.E2E_STAND_PASSWORD }}
- # Real-tier traces embed cookies and live payloads — keep them short-lived
- # and never upload storageState.
+ # Traces/videos are disabled on this tier (they would embed the live
+ # session cookie in a public-repo artifact) — this uploads results.json
+ # and failure screenshots only; never storageState.
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
diff --git a/frontend/.gitignore b/frontend/.gitignore
index 1df32974..866f0df2 100644
--- a/frontend/.gitignore
+++ b/frontend/.gitignore
@@ -27,5 +27,4 @@ ssl
e2e/test-results/
e2e/playwright-report/
e2e/blob-report/
-playwright/.auth/
e2e/.auth/
diff --git a/frontend/e2e/fixtures/backend.ts b/frontend/e2e/fixtures/backend.ts
index a83a7d52..e433c148 100644
--- a/frontend/e2e/fixtures/backend.ts
+++ b/frontend/e2e/fixtures/backend.ts
@@ -8,7 +8,6 @@ import { seedAuthenticated } from './auth.ts';
export interface BackendConfig {
installMocks: boolean;
- tier: BackendTier;
}
export interface BackendOptions {
@@ -34,7 +33,7 @@ export const test = base.extend<BackendFixtures & BackendOptions & { _installMoc
// first 401 wipes it and hard-redirects to login. Real tiers authenticate
// once in the setup project and reuse storageState.
_installMocks: [
- async ({ backend, isAuthSeeded, page, world }, use) => {
+ async ({ backend, isAuthSeeded, page, world }, use, testInfo) => {
if (!backend.installMocks) {
await use();
@@ -49,11 +48,22 @@ export const test = base.extend<BackendFixtures & BackendOptions & { _installMoc
await installMockRoutes(page, world);
await use();
+
+ // Silently-dead subscriptions are legal (cassettes mock only the
+ // relevant ones), but on a failure they are the first suspect — a
+ // typo'd subscription key otherwise surfaces as a UI timeout.
+ if (testInfo.status !== testInfo.expectedStatus && world.unmatchedSubscriptions.length) {
+ await testInfo.attach('unmatched-subscriptions', {
+ body: world.unmatchedSubscriptions.join('\n'),
+ contentType: 'text/plain',
+ });
+ }
+
expect(world.unmatched, 'every API call the app made must have a cassette entry').toEqual([]);
},
{ auto: true },
],
- backend: [{ installMocks: true, tier: 'mock' }, { option: true }],
+ backend: [{ installMocks: true }, { option: true }],
cassette: [{}, { option: true }],
isAuthSeeded: [true, { option: true }],
world: async ({ cassette }, use) => {
diff --git a/frontend/e2e/helpers/a11y.ts b/frontend/e2e/helpers/a11y.ts
index 6c61ea45..9528a7ec 100644
--- a/frontend/e2e/helpers/a11y.ts
+++ b/frontend/e2e/helpers/a11y.ts
@@ -4,28 +4,43 @@ import AxeBuilder from '@axe-core/playwright';
import { expect } from '@playwright/test';
/**
- * Known pre-existing violations, keyed by route, listing axe rule ids. An entry
- * here is technical debt with a name — remove the line when the violation is
+ * Known pre-existing violations, keyed by route. A waiver names the axe rule
+ * AND a pattern for the offending nodes' target selectors — only matching
+ * nodes are waived, so the rule still fires anywhere else on the page. An
+ * entry here is technical debt with a name — remove it when the violation is
* fixed, never add one without a look at the actual finding.
*/
-export type A11yAllowlist = Record<string, string[]>;
+export type A11yAllowlist = Record<string, A11yWaiver[]>;
+
+export interface A11yWaiver {
+ rule: string;
+ target: RegExp;
+}
const BLOCKING_IMPACTS = new Set(['critical', 'serious']);
export const scanA11y = async (page: Page, route: string, allowlist: A11yAllowlist): Promise<void> => {
- const allowed = new Set(allowlist[route] ?? []);
- const results = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa']).analyze();
+ const waivers = allowlist[route] ?? [];
+ const results = await new AxeBuilder({ page })
+ .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'])
+ .analyze();
const blocking = results.violations
- .filter(({ id, impact }) => BLOCKING_IMPACTS.has(impact ?? '') && !allowed.has(id))
+ .filter(({ impact }) => BLOCKING_IMPACTS.has(impact ?? ''))
.map(({ id, impact, nodes }) => ({
id,
impact,
- nodes: nodes.slice(0, 5).map((node) => ({
- html: node.html.slice(0, 160),
- target: node.target.join(' '),
- })),
- }));
+ nodes: nodes
+ .filter(
+ (node) => !waivers.some(({ rule, target }) => rule === id && target.test(node.target.join(' '))),
+ )
+ .slice(0, 5)
+ .map((node) => ({
+ html: node.html.slice(0, 160),
+ target: node.target.join(' '),
+ })),
+ }))
+ .filter(({ nodes }) => nodes.length > 0);
expect(blocking, `axe critical/serious violations on ${route}`).toEqual([]);
};
diff --git a/frontend/e2e/mock-llm/scenario.mjs b/frontend/e2e/mock-llm/scenario.mjs
index 7503cb58..c38dbdc4 100644
--- a/frontend/e2e/mock-llm/scenario.mjs
+++ b/frontend/e2e/mock-llm/scenario.mjs
@@ -71,6 +71,70 @@ export const RULES = [
},
],
},
+ // The transcript's one real sandbox exec — the only Tier-2 leg that
+ // exercises exec → terminal-log → WS streaming into the UI. The primary
+ // agent has no terminal tool (only delegate tools like `pentester`), so
+ // the chain is: primary delegates → the subagent (whose toolset has
+ // `terminal` + its `hack_result` barrier) runs the command → reports with
+ // the marker → the marker in each caller's transcript settles it. Order
+ // matters: each rule below fires only after the ones above stopped
+ // matching that agent's turn.
+ {
+ label: 'subagent-terminal-report',
+ match: /(?=[\s\S]*"hack_result")(?=[\s\S]*E2E_TERMINAL_OK)/,
+ toolCalls: [
+ {
+ args: {
+ message: 'Terminal check passed, greeting delivered',
+ result: 'Terminal check E2E_TERMINAL_OK passed; greeted the user: Hello from the e2e mock LLM!',
+ },
+ name: 'hack_result',
+ },
+ ],
+ },
+ {
+ label: 'agent-terminal-done',
+ match: /E2E_TERMINAL_OK/,
+ toolCalls: [
+ {
+ args: {
+ message: 'Greeted the user',
+ result: 'Hello from the e2e mock LLM!',
+ success: true,
+ },
+ name: 'done',
+ },
+ ],
+ },
+ {
+ label: 'agent-terminal',
+ match: /"terminal"/,
+ toolCalls: [
+ {
+ args: {
+ cwd: '/',
+ detach: false,
+ input: 'uname -a && echo E2E_TERMINAL_OK',
+ message: 'Checking the sandbox kernel',
+ timeout: 0,
+ },
+ name: 'terminal',
+ },
+ ],
+ },
+ {
+ label: 'agent-delegate',
+ match: /"pentester"/,
+ toolCalls: [
+ {
+ args: {
+ message: 'Delegating the greeting task',
+ question: 'Say hello to the user from the sandbox.',
+ },
+ name: 'pentester',
+ },
+ ],
+ },
];
// Any agent turn not matched above settles its subtask via the `done` barrier
diff --git a/frontend/e2e/mock-llm/server.mjs b/frontend/e2e/mock-llm/server.mjs
index 64f7e3a2..d156fd90 100644
--- a/frontend/e2e/mock-llm/server.mjs
+++ b/frontend/e2e/mock-llm/server.mjs
@@ -54,6 +54,11 @@ const respondJson = (response, status, payload) => {
response.end(JSON.stringify(payload));
};
+// OpenAI error envelope — langchaingo surfaces `error.message`, a bare string
+// under `error` is dropped on the floor.
+const respondError = (response, status, message) =>
+ respondJson(response, status, { error: { code: null, message, param: null, type: 'invalid_request_error' } });
+
const respondCompletion = (response, payload, rule) => {
completionCounter += 1;
const id = `chatcmpl-e2e-${completionCounter}`;
@@ -112,10 +117,23 @@ createServer(async (request, response) => {
const { url = '' } = request;
if (request.method === 'POST' && url.endsWith('/chat/completions')) {
- const payload = JSON.parse((await readBody(request)) || '{}');
+ // A malformed body must 400, not throw: an uncaught throw in this
+ // async callback kills the process, resets completionCounter, and
+ // drops every in-flight SSE stream of the run.
+ let payload;
+
+ try {
+ payload = JSON.parse((await readBody(request)) || '{}');
+ } catch (error) {
+ respondError(response, 400, `mock-llm: invalid JSON body: ${error}`);
+
+ return;
+ }
+
const rule = pickAnswer(payload);
+ const toolNames = (payload.tools ?? []).map((tool) => tool.function?.name ?? tool.type).join(',');
- console.log(`[mock-llm] ${rule.label}: ${payload.stream ? 'stream' : 'plain'}`);
+ console.log(`[mock-llm] ${rule.label}: ${payload.stream ? 'stream' : 'plain'} tools=[${toolNames}]`);
respondCompletion(response, payload, rule);
return;
@@ -130,5 +148,5 @@ createServer(async (request, response) => {
return;
}
- respondJson(response, 404, { error: `mock-llm: unhandled ${request.method} ${url}` });
+ respondError(response, 404, `mock-llm: unhandled ${request.method} ${url}`);
}).listen(PORT, () => console.log(`[mock-llm] listening on :${PORT}`));
diff --git a/frontend/e2e/mocks/cassette.ts b/frontend/e2e/mocks/cassette.ts
index 3355d907..cf251b39 100644
--- a/frontend/e2e/mocks/cassette.ts
+++ b/frontend/e2e/mocks/cassette.ts
@@ -39,6 +39,12 @@ export interface GraphQLPayload {
export interface RestCassetteEntry extends WorldFlagged {
body?: unknown;
+ /**
+ * Deep-subset match against the request's JSON body. Without it a path hit
+ * answers success no matter what the app sent — pin it on every mutation
+ * entry whose payload matters (login credentials, create/update bodies).
+ */
+ bodySubset?: Record<string, unknown>;
status?: number;
}
diff --git a/frontend/e2e/mocks/cassettes/base.ts b/frontend/e2e/mocks/cassettes/base.ts
index 6c7ede41..70ebc132 100644
--- a/frontend/e2e/mocks/cassettes/base.ts
+++ b/frontend/e2e/mocks/cassettes/base.ts
@@ -18,12 +18,13 @@ const flows: ResultOf<typeof FlowsDocument> = { flows: [] };
const flowTemplates: ResultOf<typeof FlowTemplatesDocument> = { flowTemplates: [] };
-const providers: ResultOf<typeof ProvidersDocument> = { providers: [] };
-
-// Normally cache-only (hydrated from REST), but refetchObservableQueries()
-// forces it onto the wire after a websocket reconnect.
+// Live entry, not dead weight: after a websocket reconnect the app re-requests
+// resources on the wire with {recursive:true} (removing this red-lights the
+// reconnect spec on the 501 gate).
const resources: ResultOf<typeof ResourcesDocument> = { resources: [] };
+const providers: ResultOf<typeof ProvidersDocument> = { providers: [] };
+
const settings: ResultOf<typeof SettingsDocument> = {
settings: entity('Settings', {
askUser: false,
diff --git a/frontend/e2e/mocks/cassettes/flows.ts b/frontend/e2e/mocks/cassettes/flows.ts
index b601d741..1d0c5e6e 100644
--- a/frontend/e2e/mocks/cassettes/flows.ts
+++ b/frontend/e2e/mocks/cassettes/flows.ts
@@ -17,7 +17,7 @@ import { baseQueries, baseRest } from './base.ts';
const T = '2026-01-15T11:30:00Z';
-const provider = entity('Provider', { name: 'E2E Provider', type: ProviderType.Custom });
+export const PROVIDER = entity('Provider', { name: 'E2E Provider', type: ProviderType.Custom });
const terminal = (id: string) =>
entity('Terminal', {
@@ -33,7 +33,7 @@ export const makeFlow = (id: string, title: string, status: StatusType = StatusT
entity('Flow', {
createdAt: T,
id,
- provider,
+ provider: PROVIDER,
status,
terminals: [terminal(id)],
title,
@@ -84,7 +84,7 @@ export const FLOW_B_STREAMED_IDS = ['203', '204'];
const messagesFor = (flowId: string, ids: string[]) => ids.map((id) => makeMessage(id, flowId));
-const flowQueryData = (
+export const flowQueryData = (
flow: FlowFragmentFragment,
messageLogs: MessageLogFragmentFragment[],
terminalLogs: TerminalLogFragmentFragment[] = [],
diff --git a/frontend/e2e/mocks/cassettes/smoke.ts b/frontend/e2e/mocks/cassettes/smoke.ts
index a9f49407..78461c33 100644
--- a/frontend/e2e/mocks/cassettes/smoke.ts
+++ b/frontend/e2e/mocks/cassettes/smoke.ts
@@ -1,6 +1,6 @@
import type { Cassette } from '../cassette.ts';
-import { authenticatedInfoEntry, guestInfoEntry } from '../../fixtures/auth.ts';
+import { authenticatedInfoEntry, guestInfoEntry, SEEDED_USER } from '../../fixtures/auth.ts';
import { baseQueries, baseRest } from './base.ts';
/** Seeded-session smoke: every request answers as an authenticated user. */
@@ -15,6 +15,12 @@ export const loginJourneyCassette: Cassette = {
rest: {
...baseRest(),
'GET /api/v1/info': [guestInfoEntry(), { ...authenticatedInfoEntry(), whenFlag: 'authenticated' }],
- 'POST /api/v1/auth/login': [{ body: { data: {}, status: 'success' }, setFlag: 'authenticated' }],
+ 'POST /api/v1/auth/login': [
+ {
+ body: { data: {}, status: 'success' },
+ bodySubset: { mail: SEEDED_USER.mail, password: 'e2e-password' },
+ setFlag: 'authenticated',
+ },
+ ],
},
};
diff --git a/frontend/e2e/mocks/install.ts b/frontend/e2e/mocks/install.ts
index ca774a2a..64e94d53 100644
--- a/frontend/e2e/mocks/install.ts
+++ b/frontend/e2e/mocks/install.ts
@@ -41,7 +41,13 @@ export const installMockRoutes = async (page: Page, world: MockWorld): Promise<v
return;
}
- const entry = world.matchRest(request.method(), pathname);
+ // postDataJSON throws on non-JSON bodies (multipart uploads) — only
+ // parse what declares itself JSON.
+ const contentType = request.headers()['content-type'] ?? '';
+ const body = contentType.includes('application/json')
+ ? (request.postDataJSON() as Record<string, unknown> | undefined)
+ : undefined;
+ const entry = world.matchRest(request.method(), pathname, body ?? undefined);
if (entry) {
await route.fulfill({
diff --git a/frontend/e2e/mocks/world.ts b/frontend/e2e/mocks/world.ts
index 4f3ac9d2..755a31dd 100644
--- a/frontend/e2e/mocks/world.ts
+++ b/frontend/e2e/mocks/world.ts
@@ -1,5 +1,3 @@
-import type { WebSocketRoute } from '@playwright/test';
-
import type {
Cassette,
CassetteFrame,
@@ -10,12 +8,25 @@ import type {
WorldFlagged,
} from './cassette.ts';
+// Key-sorted stringify: the app builds variables objects at runtime (spreads,
+// conditional assignment), so property order must not affect matching.
+const stableStringify = (value: unknown): string =>
+ JSON.stringify(value, (_key, node: unknown) =>
+ node && typeof node === 'object' && !Array.isArray(node)
+ ? Object.fromEntries(Object.entries(node).sort(([a], [b]) => a.localeCompare(b)))
+ : node,
+ ) ?? 'undefined';
+
const isSubsetMatch = (expected?: Record<string, unknown>, actual?: Record<string, unknown>): boolean =>
!expected ||
- Object.entries(expected).every(([key, value]) => JSON.stringify(actual?.[key]) === JSON.stringify(value));
+ Object.entries(expected).every(([key, value]) => stableStringify(actual?.[key]) === stableStringify(value));
const sleep = (delayMs: number) => new Promise<void>((resolve) => setTimeout(resolve, delayMs));
+export interface MockSocket {
+ close: (options?: { code?: number; reason?: string }) => unknown;
+}
+
export interface StreamSubscriber {
complete: () => void;
next: (payload: GraphQLPayload) => void;
@@ -29,11 +40,18 @@ interface StreamState {
export class MockWorld {
readonly unmatched: string[] = [];
+ /**
+ * Unmatched subscriptions are expected (a flow page opens ~15 and cassettes
+ * mock only the relevant ones), so unlike `unmatched` this is not a teardown
+ * gate — it is attached as a diagnostic when a test fails, so a typo'd
+ * subscription key points at the cassette instead of a UI timeout.
+ */
+ readonly unmatchedSubscriptions: string[] = [];
- private readonly consumed = new Map<string, number>();
+ private readonly consumed = new Map<string, { index: number; signature: string }>();
private readonly flags = new Set<string>();
private readonly flagWaiters = new Map<string, Array<() => void>>();
- private readonly sockets = new Set<WebSocketRoute>();
+ private readonly sockets = new Set<MockSocket>();
private readonly streams = new Map<string, StreamState>();
constructor(private readonly cassette: Cassette) {}
@@ -63,28 +81,34 @@ export class MockWorld {
const sections = [this.cassette.queries, this.cassette.mutations];
for (const section of sections) {
- const candidates = this.eligible(
- section?.[operationName]?.filter((entry) => isSubsetMatch(entry.variables, variables)),
- );
+ const matching = section?.[operationName]?.filter((entry) => isSubsetMatch(entry.variables, variables));
+ const candidates = this.eligible(matching);
- if (candidates?.length) {
- return this.nextEntry(`gql:${operationName}:${JSON.stringify(variables ?? {})}`, candidates);
+ if (matching && candidates?.length) {
+ return this.nextEntry(`gql:${operationName}:${stableStringify(variables ?? {})}`, candidates, matching);
}
}
return undefined;
}
- matchRest(method: string, pathname: string): RestCassetteEntry | undefined {
+ matchRest(method: string, pathname: string, body?: Record<string, unknown>): RestCassetteEntry | undefined {
const normalized = pathname.replace(/\/+$/, '');
const key = Object.keys(this.cassette.rest ?? {}).find((candidate) => {
const [candidateMethod, candidatePath = ''] = candidate.split(' ');
return candidateMethod === method && candidatePath.replace(/\/+$/, '') === normalized;
});
- const candidates = this.eligible(key ? this.cassette.rest?.[key] : undefined);
+ // A path hit whose bodySubset does not match stays unmatched (501): a
+ // broken request payload must not be answered with a canned success.
+ const matching = (key ? this.cassette.rest?.[key] : undefined)?.filter((entry) =>
+ isSubsetMatch(entry.bodySubset, body),
+ );
+ const candidates = this.eligible(matching);
- return candidates?.length ? this.nextEntry(`rest:${method}:${normalized}`, candidates) : undefined;
+ return matching && candidates?.length
+ ? this.nextEntry(`rest:${method}:${normalized}`, candidates, matching)
+ : undefined;
}
matchSubscription(
@@ -100,7 +124,7 @@ export class MockWorld {
: undefined;
}
- registerSocket(socket: WebSocketRoute): void {
+ registerSocket(socket: MockSocket): void {
this.sockets.add(socket);
}
@@ -108,6 +132,10 @@ export class MockWorld {
this.unmatched.push(description);
}
+ reportUnmatchedSubscription(description: string): void {
+ this.unmatchedSubscriptions.push(description);
+ }
+
/**
* One driver per stream broadcasts each frame once to every current
* subscriber: duplicate subscribers (e.g. flowUpdated is opened by both the
@@ -129,7 +157,7 @@ export class MockWorld {
return () => state.subscribers.delete(subscriber);
}
- unregisterSocket(socket: WebSocketRoute): void {
+ unregisterSocket(socket: MockSocket): void {
this.sockets.delete(socket);
}
@@ -161,11 +189,18 @@ export class MockWorld {
return open?.some((entry) => entry.whenFlag) ? open.filter((entry) => entry.whenFlag) : open;
}
- /** Sequenced responses: entries for the same match key are consumed in order; the last one repeats. */
- private nextEntry<T extends WorldFlagged>(key: string, candidates: T[]): T {
- const index = this.consumed.get(key) ?? 0;
+ /**
+ * Sequenced responses: entries for the same match key are consumed in
+ * order; the last one repeats. The cursor is scoped to the current eligible
+ * subset — when a raised flag changes which entries are visible, carrying a
+ * pre-flag cursor over would skip the new subset's leading entries.
+ */
+ private nextEntry<T extends WorldFlagged>(key: string, candidates: T[], all: T[]): T {
+ const signature = candidates.map((candidate) => all.indexOf(candidate)).join(',');
+ const state = this.consumed.get(key);
+ const index = state?.signature === signature ? state.index : 0;
- this.consumed.set(key, index + 1);
+ this.consumed.set(key, { index: index + 1, signature });
const entry = candidates[Math.min(index, candidates.length - 1)] as T;
diff --git a/frontend/e2e/mocks/ws-graphql.ts b/frontend/e2e/mocks/ws-graphql.ts
index d084e9be..47d815b0 100644
--- a/frontend/e2e/mocks/ws-graphql.ts
+++ b/frontend/e2e/mocks/ws-graphql.ts
@@ -2,6 +2,11 @@ import type { Page } from '@playwright/test';
import type { MockWorld } from './world.ts';
+export interface WsTransport {
+ close: (options?: { code?: number; reason?: string }) => unknown;
+ send: (data: string) => void;
+}
+
type ClientMessage =
| { id: string; payload: SubscribePayload; type: 'subscribe' }
| { id: string; type: 'complete' }
@@ -15,21 +20,35 @@ interface SubscribePayload {
variables?: Record<string, unknown>;
}
-export const installWsMock = async (page: Page, world: MockWorld): Promise<void> => {
- await page.routeWebSocket('**/api/v1/graphql', (ws) => {
- world.registerSocket(ws);
+/**
+ * Transport-agnostic graphql-ws server half: Playwright routes and the vitest
+ * protocol-contract suite (ws-graphql.unit.test.ts) both drive this exact
+ * code, so the protocol invariants are pinned outside full browser runs.
+ */
+export const handleWsConnection = (
+ world: MockWorld,
+ transport: WsTransport,
+): { onClose: () => void; onMessage: (raw: string) => void } => {
+ world.registerSocket(transport);
- const unsubscribes = new Map<string, () => void>();
- let isOpen = true;
+ const unsubscribes = new Map<string, () => void>();
+ let isOpen = true;
- const send = (message: Record<string, unknown>) => {
- if (isOpen) {
- ws.send(JSON.stringify(message));
- }
- };
+ const send = (message: Record<string, unknown>) => {
+ if (isOpen) {
+ transport.send(JSON.stringify(message));
+ }
+ };
- ws.onMessage((raw) => {
- const message = JSON.parse(String(raw)) as ClientMessage;
+ return {
+ onClose: () => {
+ isOpen = false;
+ unsubscribes.forEach((unsubscribe) => unsubscribe());
+ unsubscribes.clear();
+ world.unregisterSocket(transport);
+ },
+ onMessage: (raw) => {
+ const message = JSON.parse(raw) as ClientMessage;
switch (message.type) {
case 'complete': {
@@ -58,6 +77,9 @@ export const installWsMock = async (page: Page, world: MockWorld): Promise<void>
if (!match) {
// Unmatched subscriptions get ack'd silence and stay open: a flow page
// opens ~15 at once, and `error`/`complete` would poison the client.
+ world.reportUnmatchedSubscription(
+ `subscription ${payload.operationName} ${JSON.stringify(payload.variables ?? {})}`,
+ );
break;
}
@@ -75,13 +97,15 @@ export const installWsMock = async (page: Page, world: MockWorld): Promise<void>
break;
}
}
- });
+ },
+ };
+};
- ws.onClose(() => {
- isOpen = false;
- unsubscribes.forEach((unsubscribe) => unsubscribe());
- unsubscribes.clear();
- world.unregisterSocket(ws);
- });
+export const installWsMock = async (page: Page, world: MockWorld): Promise<void> => {
+ await page.routeWebSocket('**/api/v1/graphql', (ws) => {
+ const connection = handleWsConnection(world, ws);
+
+ ws.onMessage((raw) => connection.onMessage(String(raw)));
+ ws.onClose(() => connection.onClose());
});
};
diff --git a/frontend/e2e/mocks/ws-graphql.unit.test.ts b/frontend/e2e/mocks/ws-graphql.unit.test.ts
new file mode 100644
index 00000000..0d845cbb
--- /dev/null
+++ b/frontend/e2e/mocks/ws-graphql.unit.test.ts
@@ -0,0 +1,156 @@
+import type { Client } from 'graphql-ws';
+
+import { createClient } from 'graphql-ws';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { WebSocket, WebSocketServer } from 'ws';
+
+import type { Cassette } from './cassette.ts';
+
+import { MockWorld } from './world.ts';
+import { handleWsConnection } from './ws-graphql.ts';
+
+/**
+ * Protocol-contract suite: a real graphql-ws client (configured like the app's
+ * in src/lib/apollo.ts — infinite retries, shouldRetry always) driven against
+ * a real ws server backed by the exact `handleWsConnection` the Playwright
+ * mock uses. Violations of these invariants otherwise only surface as
+ * reconnect storms inside flaky browser specs.
+ */
+
+interface Harness {
+ client: Client;
+ world: MockWorld;
+}
+
+const disposers: Array<() => Promise<void> | void> = [];
+
+afterEach(async () => {
+ while (disposers.length) {
+ await disposers.pop()?.();
+ }
+});
+
+const start = async (cassette: Cassette, onConnected?: (wasRetry: boolean) => void): Promise<Harness> => {
+ const world = new MockWorld(cassette);
+ const server = new WebSocketServer({
+ handleProtocols: (protocols) => (protocols.has('graphql-transport-ws') ? 'graphql-transport-ws' : false),
+ port: 0,
+ });
+
+ server.on('connection', (socket) => {
+ const connection = handleWsConnection(world, {
+ close: ({ code = 1000, reason = '' } = {}) => socket.close(code, reason),
+ send: (data) => socket.send(data),
+ });
+
+ socket.on('message', (raw) => connection.onMessage(String(raw)));
+ socket.on('close', () => connection.onClose());
+ });
+
+ await new Promise<void>((resolve) => server.on('listening', resolve));
+
+ const address = server.address();
+ const port = typeof address === 'object' && address ? address.port : 0;
+
+ const client = createClient({
+ lazy: true,
+ on: { connected: (_socket, _payload, wasRetry) => onConnected?.(wasRetry) },
+ retryAttempts: Infinity,
+ retryWait: () => new Promise((resolve) => setTimeout(resolve, 10)),
+ shouldRetry: () => true,
+ url: `ws://127.0.0.1:${port}/api/v1/graphql`,
+ webSocketImpl: WebSocket,
+ });
+
+ disposers.push(async () => {
+ await Promise.resolve(client.dispose()).catch(() => undefined);
+ await new Promise<void>((resolve) => server.close(() => resolve()));
+ });
+
+ return { client, world };
+};
+
+const collect = (client: Client, operationName: string, variables?: Record<string, unknown>) => {
+ const received: unknown[] = [];
+ const errors: unknown[] = [];
+ let isComplete = false;
+
+ const unsubscribe = client.subscribe(
+ { operationName, query: `subscription ${operationName} { stub }`, variables },
+ {
+ complete: () => {
+ isComplete = true;
+ },
+ error: (error) => errors.push(error),
+ next: (value) => received.push(value),
+ },
+ );
+
+ return { errors, isComplete: () => isComplete, received, unsubscribe };
+};
+
+describe('graphql-ws mock protocol contract', () => {
+ it('acks the handshake and delivers a matched subscription frame', async () => {
+ const { client } = await start({
+ subscriptions: { demo: [{ frames: [{ payload: { data: { demo: 1 } } }] }] },
+ });
+ const sink = collect(client, 'demo');
+
+ await vi.waitFor(() => expect(sink.received).toEqual([{ data: { demo: 1 } }]));
+ expect(sink.errors).toEqual([]);
+ });
+
+ it('answers an unmatched subscription with recorded silence — no error, no complete', async () => {
+ const { client, world } = await start({});
+ const sink = collect(client, 'unknownOp', { id: '9' });
+
+ await vi.waitFor(() => expect(world.unmatchedSubscriptions).toEqual(['subscription unknownOp {"id":"9"}']));
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ expect(sink.received).toEqual([]);
+ expect(sink.errors).toEqual([]);
+ expect(sink.isComplete()).toBe(false);
+ });
+
+ it('completes the sink only for streams that opt into complete', async () => {
+ const { client } = await start({
+ subscriptions: { finite: [{ complete: true, frames: [{ payload: { data: { finite: 1 } } }] }] },
+ });
+ const sink = collect(client, 'finite');
+
+ await vi.waitFor(() => expect(sink.isComplete()).toBe(true));
+ expect(sink.received).toEqual([{ data: { finite: 1 } }]);
+ });
+
+ it('recovers from a 1001 drop and never replays already-delivered frames', async () => {
+ const retries: boolean[] = [];
+ const { client, world } = await start(
+ {
+ queries: { raise: [{ data: {}, setFlag: 'later' }] },
+ subscriptions: {
+ stream: [
+ {
+ frames: [
+ { payload: { data: { seq: 1 } } },
+ { payload: { data: { seq: 2 } }, whenFlag: 'later' },
+ ],
+ },
+ ],
+ },
+ },
+ (wasRetry) => retries.push(wasRetry),
+ );
+ const sink = collect(client, 'stream');
+
+ await vi.waitFor(() => expect(sink.received).toEqual([{ data: { seq: 1 } }]));
+
+ world.dropSockets();
+
+ // graphql-ws resubscribes active sinks after the retry connect.
+ await vi.waitFor(() => expect(retries).toEqual([false, true]));
+
+ world.matchGraphQL('raise');
+
+ await vi.waitFor(() => expect(sink.received).toEqual([{ data: { seq: 1 } }, { data: { seq: 2 } }]));
+ expect(sink.errors).toEqual([]);
+ });
+});
diff --git a/frontend/e2e/playwright.config.ts b/frontend/e2e/playwright.config.ts
index 33cc05a8..e6fcd9be 100644
--- a/frontend/e2e/playwright.config.ts
+++ b/frontend/e2e/playwright.config.ts
@@ -1,11 +1,9 @@
import { defineConfig, devices } from '@playwright/test';
import { fileURLToPath } from 'node:url';
-import type { BackendOptions } from './fixtures/backend.ts';
+import type { BackendOptions, BackendTier } from './fixtures/backend.ts';
-export type BackendTier = 'local' | 'mock' | 'stand';
-
-const tier = (process.env.E2E_TIER ?? 'mock') as BackendTier;
+const rawTier = process.env.E2E_TIER ?? 'mock';
const isCI = Boolean(process.env.CI);
// Visual snapshots only ever run inside the pinned Playwright Linux container
// (e2e/tools/run-visual.sh) — a darwin run would generate parallel baselines
@@ -27,6 +25,12 @@ const TIERS: Record<BackendTier, { baseURL: string; installMocks: boolean }> = {
stand: { baseURL: process.env.E2E_BASE_URL ?? '', installMocks: false },
};
+if (!(rawTier in TIERS)) {
+ throw new Error(`E2E_TIER must be one of ${Object.keys(TIERS).join('|')}, got "${rawTier}"`);
+}
+
+const tier = rawTier as BackendTier;
+
if (tier === 'stand' && !TIERS.stand.baseURL) {
throw new Error('E2E_TIER=stand requires E2E_BASE_URL');
}
@@ -61,6 +65,10 @@ export default defineConfig<BackendOptions>({
},
{
dependencies: ['setup'],
+ // The stand tier runs only @stand-tagged specs: flow-run
+ // drives a real (paid) agent run and must never target a
+ // shared stand.
+ ...(tier === 'stand' ? { grep: /@stand/ } : {}),
name: `${tier}-chromium`,
testMatch: '**/specs/real/**',
use: { ...devices['Desktop Chrome'], storageState: AUTH_STATE_PATH },
@@ -79,14 +87,17 @@ export default defineConfig<BackendOptions>({
retries: 1,
testDir: './specs',
use: {
- backend: { installMocks: TIERS[tier].installMocks, tier },
+ backend: { installMocks: TIERS[tier].installMocks },
baseURL: TIERS[tier].baseURL,
ignoreHTTPSErrors: tier === 'local',
locale: 'en-US',
screenshot: 'only-on-failure',
timezoneId: 'UTC',
- trace: 'on-first-retry',
- video: 'retain-on-failure',
+ // Stand traces/videos embed the live session cookie and the setup
+ // project's password fill; CI uploads test-results as a public-repo
+ // artifact, so they must never be recorded on that tier.
+ trace: tier === 'stand' ? 'off' : 'on-first-retry',
+ video: tier === 'stand' ? 'off' : 'retain-on-failure',
},
// The gate must test the shipped artifact: keep this on the production build,
// never a dev server.
@@ -98,7 +109,10 @@ export default defineConfig<BackendOptions>({
command: isVisual ? 'node e2e/tools/serve-dist.mjs' : 'pnpm run build && pnpm exec vite preview',
cwd: fileURLToPath(new URL('..', import.meta.url)),
env: { VITE_PORT: '8000', VITE_USE_HTTPS: 'false' },
- reuseExistingServer: !isCI,
+ // Never reuse a listener on the port: the build runs inside
+ // this command, so a reused (possibly orphaned) preview
+ // silently serves a previous commit's dist as the gate.
+ reuseExistingServer: false,
timeout: 240_000,
url: `http://localhost:${PREVIEW_PORT}`,
}
diff --git a/frontend/e2e/route-manifest.unit.test.ts b/frontend/e2e/route-manifest.unit.test.ts
new file mode 100644
index 00000000..6b8c2c51
--- /dev/null
+++ b/frontend/e2e/route-manifest.unit.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from 'vitest';
+
+import { routes } from '@/lib/routes';
+
+import { ROUTE_MANIFEST } from './routes.ts';
+
+/**
+ * Routes deliberately outside the manifest sweeps (nav, visual, a11y,
+ * diff-scoping), each with the reason. Adding a route to lib/routes forces a
+ * decision here: give it a manifest entry or list it with a reason — it cannot
+ * silently stay out of every sweep. Dynamic builders (`routes.flow(id)`, …)
+ * are functions and out of this static check's scope.
+ */
+const EXCLUDED: Record<string, string> = {
+ '/': 'redirects to /dashboard',
+ '/flows/new': 'create form; no stable list/detail ready-state to sweep',
+ '/knowledges/new': 'create-mode variant of the knowledge detail page',
+ '/oauth/result': 'OAuth popup landing; only meaningful mid-OAuth-roundtrip',
+ '/settings': 'redirects to /settings/account',
+ '/settings/account': 'needs an account cassette + visual baseline before joining the sweep',
+ '/templates/new': 'create-mode variant of the template detail page',
+};
+
+const staticPaths = (node: unknown): string[] => {
+ if (typeof node === 'string') {
+ return [node];
+ }
+
+ if (node && typeof node === 'object') {
+ return Object.values(node).flatMap(staticPaths);
+ }
+
+ return [];
+};
+
+describe('ROUTE_MANIFEST completeness', () => {
+ const manifestPaths = new Set(ROUTE_MANIFEST.map((entry) => entry.path));
+
+ it('covers or explicitly excludes every static app route', () => {
+ const uncovered = staticPaths(routes).filter((path) => !manifestPaths.has(path) && !(path in EXCLUDED));
+
+ expect(uncovered).toEqual([]);
+ });
+
+ it('keeps the exclusion list free of routes the manifest already covers', () => {
+ expect(Object.keys(EXCLUDED).filter((path) => manifestPaths.has(path))).toEqual([]);
+ });
+});
diff --git a/frontend/e2e/routes.ts b/frontend/e2e/routes.ts
index 2359f8f6..1aa12151 100644
--- a/frontend/e2e/routes.ts
+++ b/frontend/e2e/routes.ts
@@ -18,14 +18,21 @@ export interface RouteManifestEntry {
path: string;
/** The route counts as rendered when this locator is visible. */
ready: (page: Page) => Locator;
- /** Owning src/ areas — the substrate for changed-files → affected-routes mapping. */
+ /**
+ * Owning src/ areas — the substrate for changed-files → affected-routes
+ * mapping. A dir rendered by several routes must be listed under every one
+ * of them: ownership never falls back to the run-everything path, so a
+ * single-route listing silently skips the other consumers.
+ */
sources: string[];
}
/**
- * One entry per navigable route, consumed by the NAV sweep, per-route specs,
- * and (later) CI diff-scoping and the exploratory agent. Paths come from the
- * app's own routes module so a route rename breaks this file at compile time.
+ * The routes swept by NAV/visual/a11y specs and CI diff-scoping. This is a
+ * subset of the app's routes — route-manifest.unit.test.ts pins the excluded
+ * remainder so a new route cannot silently stay out of every sweep. Paths come
+ * from the app's own routes module so a route rename breaks this file at
+ * compile time.
*/
export const ROUTE_MANIFEST: RouteManifestEntry[] = [
{
@@ -38,7 +45,15 @@ export const ROUTE_MANIFEST: RouteManifestEntry[] = [
cassette: flowsCassette,
path: routes.flow('5'),
ready: (page) => page.getByRole('button', { name: 'Flow actions' }),
- sources: ['src/pages/flows', 'src/features/flows', 'src/providers/flow-provider.tsx'],
+ sources: [
+ 'src/pages/flows',
+ 'src/features/flows',
+ 'src/providers/flow-provider.tsx',
+ // Rendered inside the detail page's tabs alongside their owning routes.
+ 'src/components/shared/file-manager',
+ 'src/components/dashboard',
+ 'src/features/resources',
+ ],
},
{
cassette: templatesCassette,
diff --git a/frontend/e2e/specs/auth.setup.ts b/frontend/e2e/specs/auth.setup.ts
index cfa2c1e1..dc56d84d 100644
--- a/frontend/e2e/specs/auth.setup.ts
+++ b/frontend/e2e/specs/auth.setup.ts
@@ -20,6 +20,9 @@ setup('authenticate', async ({ page }) => {
await expect(skip.or(loggedIn).first()).toBeVisible({ timeout: 15_000 });
+ // Whether the seeded admin still carries password_change_required depends
+ // on backend state; the `.or()` wait above has already settled one branch.
+ // eslint-disable-next-line playwright/no-conditional-in-test
if (await skip.isVisible()) {
await skip.click();
}
diff --git a/frontend/e2e/specs/cross/a11y.spec.ts b/frontend/e2e/specs/cross/a11y.spec.ts
index 6ec62fcf..e39ccb2b 100644
--- a/frontend/e2e/specs/cross/a11y.spec.ts
+++ b/frontend/e2e/specs/cross/a11y.spec.ts
@@ -10,8 +10,10 @@ import { templatesCassette } from '../../mocks/cassettes/templates.ts';
const ALLOWLIST: A11yAllowlist = {
// Message metadata (date + ID) intentionally renders at 50% opacity — a
- // design decision, not a regression; revisit with the design pass.
- '/flows/:flowId': ['color-contrast'],
+ // design decision, not a regression; revisit with the design pass. Axe
+ // targets are class chains, so the pattern pins the 50%-muted class; any
+ // other contrast violation on the page still fails.
+ '/flows/:flowId': [{ rule: 'color-contrast', target: /text-muted-foreground\\?\/50/ }],
};
test.describe('a11y', { tag: '@cross' }, () => {
diff --git a/frontend/e2e/specs/dashboard/dashboard.spec.ts b/frontend/e2e/specs/dashboard/dashboard.spec.ts
index 2956ccd6..50de3b5a 100644
--- a/frontend/e2e/specs/dashboard/dashboard.spec.ts
+++ b/frontend/e2e/specs/dashboard/dashboard.spec.ts
@@ -7,7 +7,7 @@ import { dashboardCassette } from '../../mocks/cassettes/dashboard.ts';
const CHART_TITLES = ['Flows Activity Over Time', 'Tool Calls Over Time', 'Token Usage Over Time', 'Cost Over Time'];
const cardWith = (page: Page, heading: string) =>
- page.locator('[data-slot="card"]', { has: page.getByRole('heading', { exact: true, name: heading }) });
+ page.getByTestId('dashboard-card').filter({ has: page.getByRole('heading', { exact: true, name: heading }) });
test.describe('dashboard', { tag: '@coverage' }, () => {
test.describe('happy path', () => {
diff --git a/frontend/e2e/specs/flows/create.spec.ts b/frontend/e2e/specs/flows/create.spec.ts
new file mode 100644
index 00000000..93f8ef7e
--- /dev/null
+++ b/frontend/e2e/specs/flows/create.spec.ts
@@ -0,0 +1,52 @@
+import type { ResultOf } from '@graphql-typed-document-node/core';
+
+import type { CreateFlowDocument } from '@/graphql/types';
+
+import { StatusType } from '@/graphql/types';
+
+import { expect, test } from '../../fixtures/test.ts';
+import { expectCleanPage } from '../../helpers/errors.ts';
+import { flowQueryData, flowsCassette, makeFlow, PROVIDER } from '../../mocks/cassettes/flows.ts';
+
+const CREATED_FLOW = makeFlow('7', 'Say Hello Flow', StatusType.Created);
+const created: ResultOf<typeof CreateFlowDocument> = { createFlow: CREATED_FLOW };
+
+test.describe('flow create', { tag: ['@flows', '@smoke'] }, () => {
+ test.use({
+ cassette: flowsCassette({
+ mutations: {
+ createFlow: [
+ {
+ data: created,
+ setFlag: 'flow-created',
+ variables: { input: 'Say hello', modelProvider: PROVIDER.name },
+ },
+ ],
+ },
+ queries: {
+ flow: [{ data: flowQueryData(CREATED_FLOW, []), variables: { id: '7' } }],
+ providers: [{ data: { providers: [PROVIDER] } }],
+ },
+ subscriptions: {
+ flowCreated: [
+ { frames: [{ payload: { data: { flowCreated: CREATED_FLOW } }, whenFlag: 'flow-created' }] },
+ ],
+ },
+ }),
+ });
+
+ test('creates a flow from the form and lands on its detail page', async ({ page, pageErrorLog }) => {
+ await page.goto('/flows/new');
+
+ // The form only becomes submittable once the providers query resolved
+ // and the default provider is selected.
+ await expect(page.getByText(PROVIDER.name)).toBeVisible();
+ await page.getByPlaceholder(/Describe what you would like PentAGI to test/).fill('Say hello');
+ await page.getByRole('button', { name: 'Submit' }).click();
+
+ await expect(page).toHaveURL(/\/flows\/7/);
+ await expect(page.getByRole('button', { name: 'Flow actions' })).toBeVisible();
+ await expect(page.locator('header').getByText('Say Hello Flow')).toBeVisible();
+ expectCleanPage(pageErrorLog);
+ });
+});
diff --git a/frontend/e2e/specs/flows/lifecycle.spec.ts b/frontend/e2e/specs/flows/lifecycle.spec.ts
index c175a354..5d8bf5ae 100644
--- a/frontend/e2e/specs/flows/lifecycle.spec.ts
+++ b/frontend/e2e/specs/flows/lifecycle.spec.ts
@@ -10,6 +10,7 @@ import type {
import { ResultType, StatusType } from '@/graphql/types';
import { expect, test } from '../../fixtures/test.ts';
+import { expectCleanPage } from '../../helpers/errors.ts';
import { entity } from '../../mocks/cassette.ts';
import { FLOW_A, flowsCassette, makeFlow } from '../../mocks/cassettes/flows.ts';
@@ -41,7 +42,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
}),
});
- test('renames from the actions menu and the title persists', async ({ page }) => {
+ test('renames from the actions menu and the title persists', async ({ page, pageErrorLog }) => {
await openFlowA(page);
await page.getByRole('button', { name: 'Flow actions' }).click();
await page.getByRole('menuitem', { name: 'Rename' }).click();
@@ -50,6 +51,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
await expect(page.getByText('Flow renamed successfully')).toBeVisible();
await expect(page.locator('header').getByText('E2E Alpha Renamed', { exact: true })).toBeVisible();
+ expectCleanPage(pageErrorLog);
});
});
@@ -76,7 +78,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
}),
});
- test('finishes a running flow from the actions menu', async ({ page }) => {
+ test('finishes a running flow from the actions menu', async ({ page, pageErrorLog }) => {
await openFlowA(page);
await page.getByRole('button', { name: 'Flow actions' }).click();
await page.getByRole('menuitem', { name: 'Finish' }).click();
@@ -86,6 +88,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
await page.getByRole('button', { name: 'Flow actions' }).click();
await expect(page.getByRole('menuitem', { name: 'Finish' })).toBeHidden();
+ expectCleanPage(pageErrorLog);
});
});
@@ -93,7 +96,9 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
const favorited: ResultOf<typeof AddFavoriteFlowDocument> = { addFavoriteFlow: ResultType.Success };
// The star is useOptimistic and reverts once the mutation settles — the
- // persisted state only arrives via the settingsUserUpdated frame.
+ // persisted state only arrives via the settingsUserUpdated frame. The
+ // delay keeps the optimistic flash from satisfying the persisted-state
+ // asserts below before the frame lands.
test.use({
cassette: flowsCassette({
mutations: { addFavoriteFlow: [{ data: favorited, setFlag: 'flow-favorited' }] },
@@ -102,6 +107,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
{
frames: [
{
+ delayMs: 400,
payload: {
data: {
settingsUserUpdated: entity('UserPreferences', {
@@ -119,7 +125,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
}),
});
- test('toggles the favorite star', async ({ page }) => {
+ test('toggles the favorite star and the state persists', async ({ page, pageErrorLog }) => {
await openFlowA(page);
const star = page.locator('header').getByRole('button', { name: 'Toggle favorite' });
@@ -127,6 +133,11 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
await expect(star).toHaveAttribute('aria-pressed', 'false');
await star.click();
await expect(star).toHaveAttribute('aria-pressed', 'true');
+ // The sidebar favorites group renders only from the subscription
+ // frame — the optimistic star alone can never produce it.
+ await expect(page.getByText('Favorite Flows')).toBeVisible();
+ await expect(star).toHaveAttribute('aria-pressed', 'true');
+ expectCleanPage(pageErrorLog);
});
});
@@ -146,7 +157,7 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
}),
});
- test('deletes via the destructive confirm and drops off the list', async ({ page }) => {
+ test('deletes via the destructive confirm and drops off the list', async ({ page, pageErrorLog }) => {
await openFlowA(page);
await page.getByRole('button', { name: 'Flow actions' }).click();
await page.getByRole('menuitem', { name: 'Delete' }).click();
@@ -154,12 +165,14 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
const dialog = page.getByRole('dialog');
await expect(dialog.getByText('Delete flow')).toBeVisible();
+ await expect(dialog.getByRole('button', { name: 'Delete' })).toHaveClass(/destructive/);
await dialog.getByRole('button', { name: 'Delete' }).click();
await expect(page.getByText('Flow deleted successfully')).toBeVisible();
await expect(page).toHaveURL(/\/flows$/);
await expect(page.getByRole('row', { name: /E2E Beta/ })).toBeVisible();
await expect(page.getByRole('row', { name: /E2E Alpha/ })).toBeHidden();
+ expectCleanPage(pageErrorLog);
});
});
});
diff --git a/frontend/e2e/specs/real/flow-run.spec.ts b/frontend/e2e/specs/real/flow-run.spec.ts
index 97c5f16e..3f4218c8 100644
--- a/frontend/e2e/specs/real/flow-run.spec.ts
+++ b/frontend/e2e/specs/real/flow-run.spec.ts
@@ -1,23 +1,44 @@
import { expect, test } from '@playwright/test';
+import { readTerminalBuffer } from '../../helpers/terminal.ts';
+
test.describe('real backend flow run', { tag: '@real' }, () => {
test('runs a flow end-to-end through the mock LLM', async ({ page }) => {
test.setTimeout(240_000);
+ const pageErrors: string[] = [];
+
+ page.on('pageerror', (error) => pageErrors.push(String(error)));
+
await page.goto('/flows/new');
await page.getByPlaceholder(/Describe what you would like PentAGI to test/).fill('Say hello');
await page.getByRole('button', { name: 'Submit' }).click();
await expect(page).toHaveURL(/\/flows\/\d+/, { timeout: 30_000 });
+ // Scope the list assertion to this attempt's flow id: a retry runs
+ // against a DB that already holds the previous attempt's identically
+ // named flow, and an unscoped row match would be a strict-mode
+ // violation.
+ const flowId = new URL(page.url()).pathname.match(/\d+/)?.[0] ?? '';
await expect(page.getByTestId('flow-message-id').first()).toBeVisible({ timeout: 90_000 });
await expect(page.getByText('Hello from the e2e mock LLM!').first()).toBeVisible({ timeout: 90_000 });
+ // The scenario's `uname -a` exec must stream its sandbox output back
+ // into the xterm buffer — `Linux` appears only in the command's real
+ // output, never in the echoed command line.
+ await expect(async () => {
+ expect(await readTerminalBuffer(page)).toMatch(/Linux/);
+ }).toPass({ timeout: 90_000 });
+
// A completed task settles the flow into Waiting (ready for the next
// input) — Finished only happens via the explicit user action.
await page.goto('/flows');
await expect(
- page.getByRole('row', { name: /Say Hello Flow/ }).getByText('Waiting', { exact: true }),
+ page
+ .getByRole('row', { name: new RegExp(`${flowId}.*Say Hello Flow`) })
+ .getByText('Waiting', { exact: true }),
).toBeVisible({ timeout: 60_000 });
+ expect(pageErrors, 'uncaught errors during the flow run').toEqual([]);
});
});
diff --git a/frontend/e2e/specs/real/stand-smoke.spec.ts b/frontend/e2e/specs/real/stand-smoke.spec.ts
index 68c7277d..f112d4a7 100644
--- a/frontend/e2e/specs/real/stand-smoke.spec.ts
+++ b/frontend/e2e/specs/real/stand-smoke.spec.ts
@@ -3,21 +3,32 @@ import { expect, test } from '@playwright/test';
// LLM-independent integration smoke for a live backend (Tier 2 or a real
// stand): the authenticated shell renders and each core route loads without an
// uncaught error. No seeded data and no agent run — safe against a shared stand.
-const ROUTES = ['/flows', '/templates', '/knowledges', '/settings/prompts', '/settings/api-tokens'];
+const ROUTES = [
+ { path: '/flows', title: 'Flows' },
+ { path: '/templates', title: 'Templates' },
+ { path: '/knowledges', title: 'Knowledges' },
+ { path: '/settings/prompts', title: 'Prompts' },
+ { path: '/settings/api-tokens', title: 'API Tokens' },
+];
test.describe('stand smoke', { tag: '@stand' }, () => {
- for (const route of ROUTES) {
- test(`renders ${route} without a page error`, async ({ page }) => {
+ for (const { path, title } of ROUTES) {
+ test(`renders ${path} without a page error`, async ({ page }) => {
const pageErrors: string[] = [];
page.on('pageerror', (error) => pageErrors.push(String(error)));
- await page.goto(route);
+ await page.goto(path);
// Staying on the route (not bounced to /login) proves the reused
// session authenticated — no dependency on the stand's username.
- await expect(page).toHaveURL((url) => url.pathname === route);
- await expect(page.getByRole('link', { name: 'Templates' })).toBeVisible();
- expect(pageErrors, `uncaught errors on ${route}`).toEqual([]);
+ await expect(page).toHaveURL((url) => url.pathname === path);
+ // The header title is the only anchor every route owns in both
+ // layouts — the main and settings sidebars have disjoint links, so
+ // any shared sidebar anchor fails on one layout or the other. The
+ // span tag matters: NavLink puts aria-current="page" on the active
+ // settings-sidebar <a> at runtime, the breadcrumb title is a span.
+ await expect(page.locator('span[aria-current="page"]')).toHaveText(title);
+ expect(pageErrors, `uncaught errors on ${path}`).toEqual([]);
});
}
});
diff --git a/frontend/e2e/tools/run-local-tier.sh b/frontend/e2e/tools/run-local-tier.sh
index d7a9f4a4..a9724d05 100755
--- a/frontend/e2e/tools/run-local-tier.sh
+++ b/frontend/e2e/tools/run-local-tier.sh
@@ -17,17 +17,26 @@ compose() {
}
# Sandbox containers are spawned by the backend straight on the docker socket,
-# outside the compose project — `down -v` never removes them. The 9xxxx flow-id
-# range (seeded below) makes them unambiguously ours to delete.
+# outside the compose project — `down -v` never removes them. The anchored
+# regex matches only the seeded 9xxxx (5+ digit) flow-id range; an unanchored
+# name filter is a substring match and would also remove a dev stack's
+# sandboxes for any flow id starting with 9.
remove_e2e_sandboxes() {
- docker ps -aq --filter "name=pentagi-terminal-9" | xargs -r docker rm -f
+ docker ps -aq --filter 'name=^/?pentagi-terminal-9[0-9]{4,}$' | xargs -r docker rm -f
}
cleanup() {
- remove_e2e_sandboxes
- if [[ "${E2E_KEEP_STACK:-}" != "1" ]]; then
- compose down -v --remove-orphans
+ if [[ "${E2E_KEEP_STACK:-}" == "1" ]]; then
+ return
fi
+ # The backend/mock-LLM logs are the only record of the agent loop — capture
+ # them before `down -v` destroys the containers, so a red CI run has more
+ # than a trace of a stuck UI.
+ mkdir -p "$REPO_ROOT/frontend/e2e/test-results"
+ compose logs --no-color pentagi mock-llm \
+ > "$REPO_ROOT/frontend/e2e/test-results/compose.log" 2>&1 || true
+ remove_e2e_sandboxes
+ compose down -v --remove-orphans
}
trap cleanup EXIT
diff --git a/frontend/e2e/tools/run-visual.sh b/frontend/e2e/tools/run-visual.sh
index d0903c09..a1006e75 100755
--- a/frontend/e2e/tools/run-visual.sh
+++ b/frontend/e2e/tools/run-visual.sh
@@ -21,11 +21,16 @@ if [[ "${1:-}" == "--update" ]]; then
shift
fi
+# --user: the image defaults to root, and on Linux a root-owned --update would
+# write baselines/test-results into the repo that git/rm can't touch without
+# sudo (masked on macOS Docker Desktop by its uid mapping).
docker run --rm \
-v "$REPO_ROOT:/work" \
-w /work/frontend \
-e E2E_VISUAL=1 \
-e CI="${CI:-}" \
+ -e HOME=/tmp \
+ --user "$(id -u):$(id -g)" \
--ipc=host \
"$IMAGE" \
npx playwright test -c e2e/playwright.config.ts ${UPDATE_ARGS[@]+"${UPDATE_ARGS[@]}"} "$@"
diff --git a/frontend/e2e/tools/schema-compat.mjs b/frontend/e2e/tools/schema-compat.mjs
index db16eef7..7e5b7bbf 100644
--- a/frontend/e2e/tools/schema-compat.mjs
+++ b/frontend/e2e/tools/schema-compat.mjs
@@ -1,23 +1,16 @@
// Deploy-skew pre-flight for the stand tier: validates the frontend's persisted
// GraphQL operations against the TARGET backend's live schema (fetched via
-// introspection), so a renamed/removed field fails in one readable step here
-// instead of as dozens of red specs. This is the RC-01/RC-02 class — a new
-// frontend field the deployed backend doesn't yet expose.
+// introspection), so a renamed/removed field — e.g. a new frontend field the
+// deployed backend doesn't yet expose — fails in one readable step here
+// instead of as dozens of red specs.
//
// Usage: node schema-compat.mjs
// E2E_BASE_URL (required) e.g. https://localhost:8444
// E2E_USER / E2E_PASSWORD (default [email protected] / admin)
+import { buildClientSchema, getIntrospectionQuery, parse, separateOperations, validate } from 'graphql';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
-import {
- buildClientSchema,
- getIntrospectionQuery,
- parse,
- separateOperations,
- validate,
-} from 'graphql';
-
const BASE_URL = process.env.E2E_BASE_URL;
const USER = process.env.E2E_USER ?? '[email protected]';
const PASSWORD = process.env.E2E_PASSWORD ?? 'admin';
@@ -61,6 +54,11 @@ const introspect = async (cookie) => {
headers: { 'content-type': 'application/json', cookie },
method: 'POST',
});
+
+ if (!response.ok) {
+ throw new Error(`introspection failed: HTTP ${response.status}`);
+ }
+
const { data, errors } = await response.json();
if (errors) {
@@ -74,6 +72,13 @@ const main = async () => {
const schema = await introspect(await login());
const document = parse(readFileSync(OPERATIONS_DOC, 'utf8'));
const operations = separateOperations(document);
+
+ // "All 0 operations satisfied" is a broken gate, not a pass: a codegen
+ // change that turns the doc into SDL/fragments must fail loudly.
+ if (!Object.keys(operations).length) {
+ throw new Error(`no operations found in ${OPERATIONS_DOC} — the document no longer contains operations`);
+ }
+
const failures = [];
for (const [name, operation] of Object.entries(operations)) {
diff --git a/frontend/e2e/tools/serve-dist.mjs b/frontend/e2e/tools/serve-dist.mjs
index 03e57757..b6529f24 100644
--- a/frontend/e2e/tools/serve-dist.mjs
+++ b/frontend/e2e/tools/serve-dist.mjs
@@ -23,14 +23,33 @@ const MIME = {
'.woff2': 'font/woff2',
};
+const INDEX = join(DIST, 'index.html');
+
+if (!existsSync(INDEX)) {
+ console.error(`[serve-dist] no build at ${DIST} — run \`pnpm run build\` first`);
+ process.exit(2);
+}
+
createServer((request, response) => {
- const pathname = normalize(new URL(request.url ?? '/', 'http://localhost').pathname).replace(/^(\.\.[/\\])+/, '');
+ // The WHATWG URL parser already resolves any `..` segments in the pathname.
+ const pathname = normalize(new URL(request.url ?? '/', 'http://localhost').pathname);
let filePath = join(DIST, pathname);
if (!existsSync(filePath) || statSync(filePath).isDirectory()) {
- filePath = join(DIST, 'index.html');
+ // A miss on an asset-like path (hashed chunk, image) must 404 loudly —
+ // an index.html fallback there masks a broken build as text/html.
+ if (extname(pathname)) {
+ response.writeHead(404, { 'content-type': 'text/plain' });
+ response.end(`not found: ${pathname}`);
+
+ return;
+ }
+
+ filePath = INDEX;
}
response.writeHead(200, { 'content-type': MIME[extname(filePath)] ?? 'application/octet-stream' });
- createReadStream(filePath).pipe(response);
+ createReadStream(filePath)
+ .on('error', () => response.destroy())
+ .pipe(response);
}).listen(PORT, () => console.log(`[serve-dist] ${DIST} on :${PORT}`));
diff --git a/frontend/e2e/tools/trend.mjs b/frontend/e2e/tools/trend.mjs
index 50abf9bd..8721e9e5 100644
--- a/frontend/e2e/tools/trend.mjs
+++ b/frontend/e2e/tools/trend.mjs
@@ -1,8 +1,11 @@
// Turns a Playwright JSON report into one trend record so a green/red gate also
// surfaces slow regressions: duration p95, per-spec outliers, and flaky/failed
-// counts. Appends JSONL to the trend file (an artifact retained across runs).
+// counts. Writes one JSONL record per run; each CI run uploads its own
+// `e2e-trend` artifact (immutable per run) — aggregate across runs offline,
+// e.g. `gh run download` + `cat */trend.jsonl`.
//
-// Usage: node trend.mjs [results.json] [trend.jsonl]
+// Usage: CI=1 pnpm e2e && node trend.mjs [results.json] [trend.jsonl]
+// (the json reporter that writes results.json only runs under CI=1)
// E2E_TREND_SHA / E2E_TREND_REF optional provenance stamped into the record
import { appendFileSync, readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
@@ -23,10 +26,14 @@ const percentile = (values, p) => {
const collectSpecs = (report) => {
const specs = [];
+
const walk = (suite) => {
suite.suites?.forEach(walk);
suite.specs?.forEach((spec) => {
- const ms = Math.max(0, ...(spec.tests ?? []).flatMap((test) => (test.results ?? []).map((r) => r.duration)));
+ const ms = Math.max(
+ 0,
+ ...(spec.tests ?? []).flatMap((test) => (test.results ?? []).map((r) => r.duration)),
+ );
specs.push({ ms, title: spec.title });
});
@@ -37,7 +44,16 @@ const collectSpecs = (report) => {
return specs;
};
-const report = JSON.parse(readFileSync(RESULTS, 'utf8'));
+let raw;
+
+try {
+ raw = readFileSync(RESULTS, 'utf8');
+} catch {
+ console.error(`trend: no results file at ${RESULTS} — run the suite with CI=1 so the json reporter writes it`);
+ process.exit(2);
+}
+
+const report = JSON.parse(raw);
const specs = collectSpecs(report);
const durations = specs.map((spec) => spec.ms);
const { expected = 0, flaky = 0, skipped = 0, unexpected = 0 } = report.stats ?? {};
diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs
index bf04c8c3..dbb75efa 100644
--- a/frontend/eslint.config.mjs
+++ b/frontend/eslint.config.mjs
@@ -106,6 +106,20 @@ const eslintConfig = [
files: ['e2e/**/*.ts'],
rules: { 'react-hooks/rules-of-hooks': 'off' },
},
+ {
+ // The dependency-free .mjs tools run under plain Node — declare its
+ // globals so no-undef doesn't misfire.
+ files: ['e2e/**/*.mjs'],
+ languageOptions: {
+ globals: {
+ console: 'readonly',
+ fetch: 'readonly',
+ process: 'readonly',
+ setTimeout: 'readonly',
+ URL: 'readonly',
+ },
+ },
+ },
{
ignores: [
'node_modules/**',
diff --git a/frontend/package.json b/frontend/package.json
index a14d4ca5..75c8b306 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -11,10 +11,10 @@
"e2e:visual": "./e2e/tools/run-visual.sh",
"e2e:visual:update": "./e2e/tools/run-visual.sh --update",
"graphql:generate": "graphql-codegen --config graphql-codegen.ts",
- "lint": "eslint \"{src,e2e}/**/*.{ts,tsx,js,jsx}\"",
- "lint:fix": "eslint \"{src,e2e}/**/*.{ts,tsx,js,jsx}\" --fix",
- "prettier": "prettier --check \"{src,e2e}/**/*.{ts,tsx,js,jsx,json,css,scss}\"",
- "prettier:fix": "prettier --write \"{src,e2e}/**/*.{ts,tsx,js,jsx,json,css,scss}\"",
+ "lint": "eslint \"{src,e2e}/**/*.{ts,tsx,js,jsx,mjs}\"",
+ "lint:fix": "eslint \"{src,e2e}/**/*.{ts,tsx,js,jsx,mjs}\" --fix",
+ "prettier": "prettier --check \"{src,e2e}/**/*.{ts,tsx,js,jsx,mjs,json,css,scss}\"",
+ "prettier:fix": "prettier --write \"{src,e2e}/**/*.{ts,tsx,js,jsx,mjs,json,css,scss}\"",
"ssl:generate": "tsx --eval 'import { generateCertificates } from \"./scripts/generate-ssl.ts\"; generateCertificates();'",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
@@ -113,6 +113,7 @@
"@types/node": "^24.13.2",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
+ "@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.61.1",
"@typescript-eslint/parser": "^8.61.1",
"@vitejs/plugin-react-swc": "^4.3.1",
@@ -133,7 +134,8 @@
"vite": "^8.0.16",
"vite-plugin-html": "^3.2.2",
"vite-tsconfig-paths": "^6.1.1",
- "vitest": "^4.1.9"
+ "vitest": "^4.1.9",
+ "ws": "^8.21.1"
},
"packageManager": "[email protected]"
}
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 17469df2..2072a534 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -13,7 +13,7 @@ importers:
dependencies:
'@apollo/client':
specifier: ^4.2.3
'@graphql-typed-document-node/core':
specifier: ^3.2.0
version: 3.2.0([email protected])
@@ -154,7 +154,7 @@ importers:
version: 16.14.2
graphql-ws:
specifier: ^6.0.8
highlight.js:
specifier: ^11.11.1
version: 11.11.1
@@ -279,6 +279,9 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/[email protected])
+ '@types/ws':
+ specifier: ^8.18.1
+ version: 8.18.1
'@typescript-eslint/eslint-plugin':
specifier: ^8.61.1
@@ -342,6 +345,9 @@ importers:
vitest:
specifier: ^4.1.9
+ ws:
+ specifier: ^8.21.1
+ version: 8.21.1
packages:
@@ -5565,8 +5571,8 @@ packages:
resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==}
+ resolution: {integrity: sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
@@ -5637,7 +5643,7 @@ snapshots:
'@alloc/[email protected]': {}
dependencies:
'@graphql-typed-document-node/core': 3.2.0([email protected])
'@wry/caches': 1.0.1
@@ -5649,7 +5655,7 @@ snapshots:
rxjs: 7.8.2
tslib: 2.8.1
optionalDependencies:
react: 19.2.7
react-dom: 19.2.7([email protected])
@@ -6285,10 +6291,10 @@ snapshots:
'@graphql-tools/utils': 11.1.0([email protected])
'@whatwg-node/disposablestack': 0.0.6
graphql: 16.14.2
- isows: 1.0.7([email protected])
+ isows: 1.0.7([email protected])
tslib: 2.8.1
- ws: 8.21.0
+ ws: 8.21.1
transitivePeerDependencies:
- '@fastify/websocket'
- bufferutil
@@ -6315,9 +6321,9 @@ snapshots:
'@graphql-tools/utils': 11.1.0([email protected])
'@types/ws': 8.18.1
graphql: 16.14.2
- isomorphic-ws: 5.0.0([email protected])
+ isomorphic-ws: 5.0.0([email protected])
tslib: 2.8.1
- ws: 8.21.0
+ ws: 8.21.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -6439,10 +6445,10 @@ snapshots:
'@whatwg-node/fetch': 0.10.13
'@whatwg-node/promise-helpers': 1.3.2
graphql: 16.14.2
- isomorphic-ws: 5.0.0([email protected])
+ isomorphic-ws: 5.0.0([email protected])
sync-fetch: 0.6.0
tslib: 2.8.1
- ws: 8.21.0
+ ws: 8.21.1
transitivePeerDependencies:
- '@fastify/websocket'
- '@types/node'
@@ -9151,11 +9157,11 @@ snapshots:
graphql: 16.14.2
tslib: 2.8.1
dependencies:
graphql: 16.14.2
optionalDependencies:
- ws: 8.21.0
+ ws: 8.21.1
@@ -9470,13 +9476,13 @@ snapshots:
dependencies:
- ws: 8.21.0
+ ws: 8.21.1
dependencies:
- ws: 8.21.0
+ ws: 8.21.1
@@ -11417,7 +11423,7 @@ snapshots:
string-width: 7.2.0
strip-ansi: 7.2.0
diff --git a/frontend/src/components/shared/terminal/use-xterm.ts b/frontend/src/components/shared/terminal/use-xterm.ts
index 94b48c92..494cee71 100644
--- a/frontend/src/components/shared/terminal/use-xterm.ts
+++ b/frontend/src/components/shared/terminal/use-xterm.ts
@@ -28,6 +28,10 @@ export interface UseXtermResult {
write: (data: string) => void;
}
+export interface XtermHostElement extends HTMLDivElement {
+ xterm?: Terminal;
+}
+
/**
* Manages the full xterm.js lifecycle: creation, addon loading,
* resize handling, WebGL fallback, theme sync, and cleanup.
@@ -38,10 +42,6 @@ export interface UseXtermResult {
* Requires Ctrl+Click (Cmd+Click on Mac) to open links per
* https://xtermjs.org/docs/guides/link-handling/
*/
-export interface XtermHostElement extends HTMLDivElement {
- xterm?: Terminal;
-}
-
export function useXterm({ theme }: { theme: 'dark' | 'light' | 'system' }): UseXtermResult {
const containerRef = useRef<HTMLDivElement | null>(null);
const terminalRef = useRef<null | Terminal>(null);
diff --git a/frontend/src/components/ui/sheet.tsx b/frontend/src/components/ui/sheet.tsx
index 845c39c6..ff21cd4a 100644
--- a/frontend/src/components/ui/sheet.tsx
+++ b/frontend/src/components/ui/sheet.tsx
@@ -90,7 +90,9 @@ function SheetContent({ children, className, container, overlay = true, side = '
>
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
<X className="h-4 w-4" />
- <span className="sr-only">Close</span>
+ {/* Not "Close": a sheet with its own footer Close button would
+ produce two identically named controls. */}
+ <span className="sr-only">Dismiss sheet</span>
</SheetPrimitive.Close>
{children}
</SheetPrimitive.Content>