Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: address PR review — mock-admin port, vacuous assertions, suite registration

M3gA-Minddedf07d893f6
diff --git a/app/src/components/settings/panels/AgentsPanel.test.tsx b/app/src/components/settings/panels/AgentsPanel.test.tsx
index f5e97d5515..a1feeddbca 100644
--- a/app/src/components/settings/panels/AgentsPanel.test.tsx
+++ b/app/src/components/settings/panels/AgentsPanel.test.tsx
@@ -195,10 +195,21 @@ describe('AgentsPanel', () => {
expect(mockList).toHaveBeenCalledTimes(1);
});
- it('never calls setEnabled for the orchestrator', async () => {
- // `handleToggle` early-returns on ORCHESTRATOR_ID (line 56) *and* the row
- // renders its switch disabled. Asserting only `toBeDisabled()` would pass
- // if the guard were deleted, so drive the handler directly too.
+ it('renders the orchestrator switch disabled so it cannot be toggled', async () => {
+ // Scope correction, from review: an earlier version of this case claimed to
+ // cover `handleToggle`'s ORCHESTRATOR_ID early-return (AgentsPanel.tsx:56)
+ // by clicking the switch as well as asserting it disabled. It does not —
+ // `AgentRow` renders the orchestrator's SettingsSwitch `disabled`, so the
+ // click never reaches the handler and removing the guard alone would not
+ // fail this test.
+ //
+ // My revert-proof did not catch that because the mutation removed the guard
+ // AND the `disabled` prop together, so the case went red for the second
+ // reason. A fault that changes two things proves neither individually.
+ //
+ // What this case honestly covers is the disabled control, which is the
+ // user-facing protection; the handler guard behind it is defence in depth
+ // and would need an enabled seam to exercise. Renamed to say so.
renderPanel();
await waitFor(() => expect(screen.getByText('Orchestrator')).toBeInTheDocument());
diff --git a/app/src/components/settings/panels/__tests__/EventLogPanel.sseConfig.test.tsx b/app/src/components/settings/panels/__tests__/EventLogPanel.sseConfig.test.tsx
index 08c4a74b7f..7ae4607708 100644
--- a/app/src/components/settings/panels/__tests__/EventLogPanel.sseConfig.test.tsx
+++ b/app/src/components/settings/panels/__tests__/EventLogPanel.sseConfig.test.tsx
@@ -50,11 +50,15 @@ function mockFetchRaw(body: string) {
global.fetch = vi.fn().mockResolvedValue({ ok: true, body: stream });
}
+// SSE frames are terminated by a BLANK line, not a single newline. The panel's
+// parser splits on '\n' and tolerates the shorter form, but a fixture that is
+// not wire-shaped would keep passing if that parser were tightened — so emit
+// real frames.
const evt = (event: string, domain = 'tool') =>
- `data:${JSON.stringify({ domain, event, timestamp: '12:00:00' })}\n`;
+ `data:${JSON.stringify({ domain, event, timestamp: '12:00:00' })}\n\n`;
const config = (payload: Record<string, unknown>) =>
- `event: config\ndata:${JSON.stringify(payload)}\n`;
+ `event: config\ndata:${JSON.stringify(payload)}\n\n`;
/** Every rendered event label, in DOM order — nothing filtered out. */
function allRenderedRows(): string[] {
diff --git a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
index 80adb6c3cd..6dc8ef68b1 100644
--- a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
+++ b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
@@ -35,7 +35,7 @@ import { expect, type Locator, type Page, test } from '@playwright/test';
import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';
-const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18402'}`;
+const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;
const USER_ID = 'pw-chat-attach-gate';
const SLOW_STREAM = [
@@ -105,10 +105,17 @@ async function attach(page: Page, name: string, body = 'attached by the picker')
await fileInput(page)
.first()
.setInputFiles({ name, mimeType: 'text/plain', buffer: Buffer.from(body) });
- return page
- .getByText(name)
- .isVisible({ timeout: 2_000 })
- .catch(() => false);
+ // `Locator.isVisible()` returns IMMEDIATELY — it does not honour a
+ // timeout — so the previous form could fire a second `setInputFiles`
+ // while the first ingest was still in flight. `handleAttachFiles`
+ // appends without deduplication, so that would have produced two chips
+ // for one file. `expect(...).toBeVisible()` actually waits.
+ return expect(page.getByText(name))
+ .toBeVisible({ timeout: 2_000 })
+ .then(
+ () => true,
+ () => false
+ );
},
{ timeout: 15_000, message: `attachment chip for ${name} never appeared` }
)
@@ -123,6 +130,24 @@ async function beginStreamingTurn(page: Page, prompt: string): Promise<void> {
await expect(stopButton(page)).toBeVisible({ timeout: 20_000 });
}
+/**
+ * These are browser specs against a freshly built bundle, and the first few to
+ * run pay the app's cold start: a fresh `dist-web` plus a just-rebuilt core
+ * means first paint can take most of a minute, while every subsequent test in
+ * the same session settles at ~1s.
+ *
+ * Measured on this suite: cases 1-4 of the first spec failed at ~60s with a
+ * blank `#root`, case 5 of the SAME file passed at 25.3s, and all 13 cases
+ * after it passed in ~1s. Nothing about the app was wrong — the per-test budget
+ * (60s locally, `playwright.config.ts:10`) was simply consumed by warm-up.
+ *
+ * Raising the budget for this describe rather than editing the shared config:
+ * it is a statement about these tests, it masks nothing (the assertions are
+ * unchanged and a genuinely broken app still fails), and whichever spec happens
+ * to sort first should not be the one that flakes.
+ */
+test.describe.configure({ timeout: 120_000 });
+
test.describe('Chat composer attachment gate', () => {
test.beforeEach(async () => {
await resetMock();
diff --git a/app/test/playwright/specs/chat-composer-primary-slot.spec.ts b/app/test/playwright/specs/chat-composer-primary-slot.spec.ts
index b5c573edaa..781cd13387 100644
--- a/app/test/playwright/specs/chat-composer-primary-slot.spec.ts
+++ b/app/test/playwright/specs/chat-composer-primary-slot.spec.ts
@@ -42,7 +42,7 @@ import { expect, type Locator, type Page, test } from '@playwright/test';
import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';
-const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18402'}`;
+const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;
const USER_ID = 'pw-chat-primary-slot';
/**
@@ -107,6 +107,24 @@ async function beginStreamingTurn(page: Page, prompt: string): Promise<void> {
await expect(stopButton(page)).toBeVisible({ timeout: 20_000 });
}
+/**
+ * These are browser specs against a freshly built bundle, and the first few to
+ * run pay the app's cold start: a fresh `dist-web` plus a just-rebuilt core
+ * means first paint can take most of a minute, while every subsequent test in
+ * the same session settles at ~1s.
+ *
+ * Measured on this suite: cases 1-4 of the first spec failed at ~60s with a
+ * blank `#root`, case 5 of the SAME file passed at 25.3s, and all 13 cases
+ * after it passed in ~1s. Nothing about the app was wrong — the per-test budget
+ * (60s locally, `playwright.config.ts:10`) was simply consumed by warm-up.
+ *
+ * Raising the budget for this describe rather than editing the shared config:
+ * it is a statement about these tests, it masks nothing (the assertions are
+ * unchanged and a genuinely broken app still fails), and whichever spec happens
+ * to sort first should not be the one that flakes.
+ */
+test.describe.configure({ timeout: 120_000 });
+
test.describe('Chat composer primary slot', () => {
test.beforeEach(async () => {
await resetMock();
diff --git a/app/test/playwright/specs/chat-model-override.spec.ts b/app/test/playwright/specs/chat-model-override.spec.ts
index 7ad4d7a251..c03171ff57 100644
--- a/app/test/playwright/specs/chat-model-override.spec.ts
+++ b/app/test/playwright/specs/chat-model-override.spec.ts
@@ -67,6 +67,24 @@ const modelChip = (page: Page): Locator =>
page.locator('[data-analytics-id="chat-model-selector"]');
const pickerTitle = (page: Page): Locator => page.getByText('Choose provider and model');
+/**
+ * These are browser specs against a freshly built bundle, and the first few to
+ * run pay the app's cold start: a fresh `dist-web` plus a just-rebuilt core
+ * means first paint can take most of a minute, while every subsequent test in
+ * the same session settles at ~1s.
+ *
+ * Measured on this suite: cases 1-4 of the first spec failed at ~60s with a
+ * blank `#root`, case 5 of the SAME file passed at 25.3s, and all 13 cases
+ * after it passed in ~1s. Nothing about the app was wrong — the per-test budget
+ * (60s locally, `playwright.config.ts:10`) was simply consumed by warm-up.
+ *
+ * Raising the budget for this describe rather than editing the shared config:
+ * it is a statement about these tests, it masks nothing (the assertions are
+ * unchanged and a genuinely broken app still fails), and whichever spec happens
+ * to sort first should not be the one that flakes.
+ */
+test.describe.configure({ timeout: 120_000 });
+
test.describe('Chat composer model override', () => {
test.beforeEach(async () => {
await resetMock();
@@ -96,6 +114,10 @@ test.describe('Chat composer model override', () => {
const chip = modelChip(page);
const before = (await chip.textContent())?.trim() ?? '';
+ // Without this the case is vacuous: if the chip rendered no label, `before`
+ // and the post-cancel read are both '' and the comparison passes while
+ // proving nothing.
+ expect(before, 'the model chip must name the current model').not.toBe('');
await chip.click();
await expect(pickerTitle(page)).toBeVisible({ timeout: 10_000 });
diff --git a/app/test/playwright/specs/chat-scroll-stick.spec.ts b/app/test/playwright/specs/chat-scroll-stick.spec.ts
index c441b93dc3..e6cb9646d2 100644
--- a/app/test/playwright/specs/chat-scroll-stick.spec.ts
+++ b/app/test/playwright/specs/chat-scroll-stick.spec.ts
@@ -109,6 +109,20 @@ async function scrollState(page: Page): Promise<ScrollState> {
* bottom, and failed its own setup step. `behavior: 'instant'` overrides the CSS
* for this one call; the poll is belt-and-braces for the layout settling.
*/
+/**
+ * Viewport-relative Y of a stable piece of already-rendered content.
+ *
+ * `distanceFromBottom` alone only rejects a scroll that lands NEAR the bottom;
+ * a partial auto-scroll could drag the reader some distance and still leave
+ * more than the 80px threshold below. Watching a fixed element's position is
+ * what actually says "the view did not move under me" — raised in review.
+ */
+async function anchorY(page: Page, text: string): Promise<number> {
+ const box = await page.getByText(text, { exact: false }).last().boundingBox();
+ if (!box) throw new Error(`anchor "${text}" has no bounding box`);
+ return box.y;
+}
+
async function scrollTo(page: Page, top: number): Promise<void> {
await page.evaluate(`(() => {
const el = ${FIND_VIEWPORT};
@@ -146,6 +160,24 @@ async function completeTurn(page: Page, prompt: string, marker: string): Promise
await expect(page.getByTestId('composer-human-mode')).toBeVisible({ timeout: 40_000 });
}
+/**
+ * These are browser specs against a freshly built bundle, and the first few to
+ * run pay the app's cold start: a fresh `dist-web` plus a just-rebuilt core
+ * means first paint can take most of a minute, while every subsequent test in
+ * the same session settles at ~1s.
+ *
+ * Measured on this suite: cases 1-4 of the first spec failed at ~60s with a
+ * blank `#root`, case 5 of the SAME file passed at 25.3s, and all 13 cases
+ * after it passed in ~1s. Nothing about the app was wrong — the per-test budget
+ * (60s locally, `playwright.config.ts:10`) was simply consumed by warm-up.
+ *
+ * Raising the budget for this describe rather than editing the shared config:
+ * it is a statement about these tests, it masks nothing (the assertions are
+ * unchanged and a genuinely broken app still fails), and whichever spec happens
+ * to sort first should not be the one that flakes.
+ */
+test.describe.configure({ timeout: 120_000 });
+
test.describe('Chat transcript stick-to-bottom', () => {
test.beforeEach(async () => {
await resetMock();
@@ -179,10 +211,13 @@ test.describe('Chat transcript stick-to-bottom', () => {
'the fixture must actually park the reader past the 80px stick threshold'
).toBeGreaterThan(80);
+ const beforeAnchor = await anchorY(page, 'FIRST-REPLY-END');
+
// Now a second turn arrives and grows the transcript underneath them.
await completeTurn(page, 'Second long answer please', 'SECOND-REPLY-END');
const after = await scrollState(page);
+ const afterAnchor = await anchorY(page, 'FIRST-REPLY-END');
// The assertion that matters: the viewport did not jump to the bottom.
expect(
@@ -190,11 +225,18 @@ test.describe('Chat transcript stick-to-bottom', () => {
'a message arriving while the reader is scrolled up must not snap the transcript to the bottom'
).toBeGreaterThan(80);
- // Deliberately NOT asserting `scrollTop` stayed put. New content changes the
- // container's height, so `scrollTop` legitimately shifts without the view
- // moving relative to what the reader is looking at. `distanceFromBottom`
- // above is the actual definition of "was I yanked to the bottom", and it is
- // the falsifiable one: forcing a scroll-to-bottom drives it to ~0.
+ // And the stronger half, from review: `distanceFromBottom` rejects a jump to
+ // the bottom, but a PARTIAL auto-scroll could move the reader and still sit
+ // more than 80px above it. Watching a fixed piece of the first reply says
+ // the view did not shift under them at all.
+ //
+ // Still deliberately NOT asserting `scrollTop` stayed put: appending a turn
+ // changes the container's height, so `scrollTop` legitimately moves while
+ // the rendered content does not. The anchor measures what the reader sees.
+ expect(
+ Math.abs(afterAnchor - beforeAnchor),
+ 'content the reader was looking at must not shift when a new turn arrives'
+ ).toBeLessThan(40);
});
test('a new turn is anchored into view for a reader parked at the bottom', async ({ page }) => {
diff --git a/app/test/playwright/specs/chat-thread-isolation.spec.ts b/app/test/playwright/specs/chat-thread-isolation.spec.ts
index f7b0f8c0c1..57eb26cc59 100644
--- a/app/test/playwright/specs/chat-thread-isolation.spec.ts
+++ b/app/test/playwright/specs/chat-thread-isolation.spec.ts
@@ -29,7 +29,7 @@ import { expect, type Locator, type Page, test } from '@playwright/test';
import { bootAuthenticatedPage, dismissWalkthroughIfPresent } from '../helpers/core-rpc';
-const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18402'}`;
+const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;
const USER_ID = 'pw-chat-thread-isolation';
/** `safeDelayMs` clamps to 1000ms, so length comes from chunk count. ~24s. */
@@ -100,6 +100,24 @@ async function streamOnCurrentThread(page: Page, prompt: string): Promise<string
return id as string;
}
+/**
+ * These are browser specs against a freshly built bundle, and the first few to
+ * run pay the app's cold start: a fresh `dist-web` plus a just-rebuilt core
+ * means first paint can take most of a minute, while every subsequent test in
+ * the same session settles at ~1s.
+ *
+ * Measured on this suite: cases 1-4 of the first spec failed at ~60s with a
+ * blank `#root`, case 5 of the SAME file passed at 25.3s, and all 13 cases
+ * after it passed in ~1s. Nothing about the app was wrong — the per-test budget
+ * (60s locally, `playwright.config.ts:10`) was simply consumed by warm-up.
+ *
+ * Raising the budget for this describe rather than editing the shared config:
+ * it is a statement about these tests, it masks nothing (the assertions are
+ * unchanged and a genuinely broken app still fails), and whichever spec happens
+ * to sort first should not be the one that flakes.
+ */
+test.describe.configure({ timeout: 120_000 });
+
test.describe('Chat thread isolation during a stream', () => {
test.beforeEach(async () => {
await resetMock();
diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.sh
index 02143fd269..5bcb014a60 100755
--- a/scripts/test-rust-e2e.sh
+++ b/scripts/test-rust-e2e.sh
@@ -31,6 +31,7 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Tests guarded by `#[ignore]` stay skipped unless the caller passes
# `-- --ignored`.
ALL_E2E_SUITES=(
+ agent_approval_memory_coverage_e2e
agent_retrieval_e2e
calendar_grounding_e2e
config_auth_app_state_connectivity_e2e
diff --git a/tests/agent_approval_memory_coverage_e2e.rs b/tests/agent_approval_memory_coverage_e2e.rs
index a23d5a89f7..7e8581a860 100644
--- a/tests/agent_approval_memory_coverage_e2e.rs
+++ b/tests/agent_approval_memory_coverage_e2e.rs
@@ -705,10 +705,11 @@ async fn agent_graph_topologies_exports_structure_without_run_state() {
.await;
let body = payload(&response, "agent_graph_topologies");
- assert!(
- body.get("graphs").is_some(),
- "graph_topologies must return a `graphs` object: {body}"
- );
+ // `is_some()` would accept `null` or a scalar, so a schema regression that
+ // dropped the object could still pass. Require the object itself.
+ body.get("graphs")
+ .and_then(Value::as_object)
+ .unwrap_or_else(|| panic!("graph_topologies must return a `graphs` object: {body}"));
let serialized = body.to_string();
for leaked in ["system_prompt", "prompt_text", "api_key", "tool_arguments"] {
@@ -747,7 +748,14 @@ async fn agent_registry_snapshot_counts_agree_with_the_component_inventory() {
// Check the two claims separately — that is stronger than one sum anyway,
// because it catches `total` and the per-kind breakdown disagreeing with
// each other as well as with `components`.
- if let Some(counts) = body.get("counts").and_then(Value::as_object) {
+ // NOT `if let`: a missing or non-object `counts` would silently skip every
+ // assertion below and the case would still pass on `components` alone,
+ // which is precisely the agreement this test exists to pin.
+ {
+ let counts = body
+ .get("counts")
+ .and_then(Value::as_object)
+ .unwrap_or_else(|| panic!("registry_snapshot must return a `counts` object: {body}"));
let per_kind: u64 = counts
.iter()
.filter(|(key, _)| key.as_str() != "total")