The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(e2e): address review on #5888 — fail loudly instead of skipping to green
M3gA-Mind8e9762ec3726
diff --git a/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts b/app/test/playwright/specs/brain-embedding-truthfulness.spec.tsindex 0a77f8c19e..9bca3f8b9c 100644--- a/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts+++ b/app/test/playwright/specs/brain-embedding-truthfulness.spec.ts@@ -1,5 +1,5 @@import { expect, type Page, test } from '@playwright/test';-import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';@@ -64,9 +64,22 @@ async function openSources(page: Page, user: string): Promise<void> {await expect(page.getByTestId('memory-sources')).toBeVisible({ timeout: 20_000 });}+/**+ * Every corpus this file creates, so none is left behind in the OS temp+ * directory. Each run would otherwise leak a directory of generated markdown.+ */+const createdCorpora: string[] = [];++test.afterAll(() => {+ for (const root of createdCorpora.splice(0)) {+ rmSync(root, { recursive: true, force: true });+ }+});+/** Absolute path on purpose — see the note above. */function makeCorpus(files: number): string {const root = mkdtempSync(join(tmpdir(), 'openhuman-pw-brain-'));+ createdCorpora.push(root);mkdirSync(join(root, 'notes'), { recursive: true });for (let i = 0; i < files; i += 1) {writeFileSync(@@ -90,10 +103,46 @@ async function addAndSync(label: string, files = 3): Promise<{ id: string; root:if (!id) throw new Error(`source ${label} was not created`);// `source_id`, not `id` — the core rejects the latter with// "missing required param 'source_id'". Cost the first run of this spec.- await callCoreRpc('openhuman.memory_sources_sync', { source_id: id });+ try {+ await callCoreRpc('openhuman.memory_sources_sync', { source_id: id });+ } catch (error) {+ throw classifyModuleFailure(error);+ }return { id, root };}+/**+ * The memory engine is a downloaded cdylib, and the Playwright web harness does+ * not stage it — `e2e-web-session.sh` packages and starts `openhuman-core` only,+ * unlike the Rust E2E job which installs the checksum-pinned tinymemory module.+ * With a cold module cache and no GitHub release access, `memory_sources_sync`+ * fails with `module 'tinymemory' could not be loaded` before any UI assertion+ * runs.+ *+ * That is infrastructure, not the behaviour under test, so it must not fail a+ * developer's offline run. It must equally not pass silently in CI, where a+ * missing module means this spec asserted nothing — the same void this file+ * exists to close. So: skip locally, fail loudly in CI, and say which.+ */+function classifyModuleFailure(error: unknown): Error {+ const message = error instanceof Error ? error.message : String(error);+ const moduleUnavailable = /module '[^']*' could not be loaded|github-release refused/.test(+ message+ );++ if (moduleUnavailable && !process.env.CI) {+ test.skip(true, `memory module unavailable in this lane: ${message}`);+ }+ if (moduleUnavailable) {+ return new Error(+ 'the tinymemory module is not staged in this lane, so the embedding-state ' ++ 'render cannot be exercised. Provision the checksum-pinned module here as ' ++ `the Rust E2E job does, or move this spec to that lane. Underlying: ${message}`+ );+ }+ return error instanceof Error ? error : new Error(message);+}+async function statusFor(id: string): Promise<SourceStatus | undefined> {const res = await callCoreRpc<{ statuses: SourceStatus[] }>('openhuman.memory_sources_status_list',@@ -102,6 +151,34 @@ async function statusFor(id: string): Promise<SourceStatus | undefined> {return res.statuses.find(s => s.source_id === id);}+/**+ * Gate a test on the degraded precondition — loud in CI, quiet locally.+ *+ * `test.skip` alone is not safe here. If a lane has a working embeddings+ * provider (or the sync settles before the poll), `chunks_pending` is 0, all+ * three tests skip, and the file reports success having asserted nothing about+ * the render path. That is the same shape as the incident this spec exists for:+ * the incident was a correct verdict rendered into a void; a silently skipped+ * spec is a correct assertion executed into a void.+ *+ * So in CI the absence of the precondition is a FAILURE — a lane that stops+ * producing the degraded state must be fixed or the spec moved, not quietly+ * passed. Locally it still skips, because the memory engine is a downloaded+ * cdylib and a developer without release access genuinely cannot reach the+ * state.+ */+function requireDegraded(status: SourceStatus | undefined): void {+ const degraded = (status?.chunks_pending ?? 0) > 0;+ if (!degraded && process.env.CI) {+ throw new Error(+ 'no unembedded chunks: this lane cannot exercise the degraded-state render. ' ++ 'Stage the memory module without an embeddings provider, or move this spec ' ++ 'to a lane that can.'+ );+ }+ test.skip(!degraded, 'this core embedded every chunk, so there is no degraded state to surface');+}+test.describe('Brain — the UI tells the truth about embedding state', () => {test('a source whose chunks were never embedded is visibly flagged, not shown as healthy', async ({page,@@ -124,10 +201,7 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {).toBeGreaterThan(0);- test.skip(- (status?.chunks_pending ?? 0) === 0,- 'this core embedded every chunk, so there is no degraded state to surface'- );+ requireDegraded(status);await openSources(page, 'pw-brain-unembedded');@@ -152,12 +226,15 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {let status: SourceStatus | undefined;await expect- .poll(async () => {- status = await statusFor(id);- return status?.chunks_synced ?? 0;- }, { timeout: 60_000 })+ .poll(+ async () => {+ status = await statusFor(id);+ return status?.chunks_synced ?? 0;+ },+ { timeout: 60_000 }+ ).toBeGreaterThan(0);- test.skip((status?.chunks_pending ?? 0) === 0, 'no degraded state on this core');+ requireDegraded(status);await openSources(page, 'pw-brain-reload');const warning = page.getByTestId(`memory-source-pipeline-warning-${id}`);@@ -180,12 +257,15 @@ test.describe('Brain — the UI tells the truth about embedding state', () => {let status: SourceStatus | undefined;await expect- .poll(async () => {- status = await statusFor(id);- return status?.chunks_synced ?? 0;- }, { timeout: 60_000 })+ .poll(+ async () => {+ status = await statusFor(id);+ return status?.chunks_synced ?? 0;+ },+ { timeout: 60_000 }+ ).toBeGreaterThan(0);- test.skip((status?.chunks_pending ?? 0) === 0, 'no degraded state on this core');+ requireDegraded(status);await openSources(page, 'pw-brain-health');await expect(page.getByTestId(`memory-source-pipeline-warning-${id}`)).toBeVisible({diff --git a/app/test/playwright/specs/notifications-feed-interaction.spec.ts b/app/test/playwright/specs/notifications-feed-interaction.spec.tsindex 804aad3b0f..71c66c153a 100644--- a/app/test/playwright/specs/notifications-feed-interaction.spec.ts+++ b/app/test/playwright/specs/notifications-feed-interaction.spec.ts@@ -230,6 +230,31 @@ test.describe.skip('Notifications — read state', () => {timeout: 10_000,});+ // `toBeDisabled()` above only proves in-memory state. redux-persist queues+ // its writes through an async `userScopedStorage.setItem`, so reloading+ // immediately can race the write and re-read the pre-mark blob — which+ // would look like "read state does not survive a reload" when in fact the+ // reload simply happened first. Wait for the persisted payload to show the+ // item as read before reloading.+ const user = await page.evaluate(() => localStorage.getItem('OPENHUMAN_ACTIVE_USER_ID'));+ await expect+ .poll(+ async () =>+ page.evaluate(key => {+ const raw = window.localStorage.getItem(key);+ if (!raw) return false;+ try {+ const blob = JSON.parse(raw) as { items?: string };+ const items = JSON.parse(blob.items ?? '[]') as Array<{ read?: boolean }>;+ return items.length > 0 && items.every(item => item.read === true);+ } catch {+ return false;+ }+ }, `${user}:persist:notifications`),+ { timeout: 10_000, message: 'the read state was never persisted' }+ )+ .toBe(true);+await page.reload();await waitForAppReady(page);await dismissWalkthroughIfPresent(page);diff --git a/app/test/playwright/specs/onboarding-required-step-gate.spec.ts b/app/test/playwright/specs/onboarding-required-step-gate.spec.tsindex a0b21cee88..7706498467 100644--- a/app/test/playwright/specs/onboarding-required-step-gate.spec.ts+++ b/app/test/playwright/specs/onboarding-required-step-gate.spec.ts@@ -31,11 +31,17 @@ import { bootAuthenticatedPage, callCoreRpc, waitForAppReady } from '../helpers/const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;async function resetMock(): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {+ // Deliberately NOT swallowed. A failed reset leaves shared mock state from a+ // previous test, and onboarding then runs against a fixture nobody chose —+ // which surfaces as an unrelated assertion failure further down.+ const response = await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({}),- }).catch(() => undefined);+ });+ if (!response.ok) {+ throw new Error(`mock admin reset failed with HTTP ${response.status}`);+ }}async function bootIntoOnboarding(page: Page, userId: string): Promise<void> {@@ -133,7 +139,12 @@ test.describe('Onboarding — the runtime choice is a required step', () => {'openhuman.config_get_onboarding_completed',{});- const value = typeof completed === 'boolean' ? completed : Boolean(completed?.result);+ // `Boolean(completed?.result)` alone would turn a malformed response — one+ // with no `result` at all — into `false` and quietly satisfy the assertion.+ // Require an actual boolean first, so a shape change fails loudly here+ // instead of being read as "onboarding is incomplete".+ const value = typeof completed === 'boolean' ? completed : completed?.result;+ expect(typeof value).toBe('boolean');expect(value).toBe(false);});});diff --git a/app/test/playwright/specs/rewards-invites-reload-persistence.spec.ts b/app/test/playwright/specs/rewards-invites-reload-persistence.spec.tsindex d86dbaa594..748b905820 100644--- a/app/test/playwright/specs/rewards-invites-reload-persistence.spec.ts+++ b/app/test/playwright/specs/rewards-invites-reload-persistence.spec.ts@@ -35,11 +35,17 @@ test.describe.configure({ timeout: 150_000 });const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;async function mockAdmin(path: string, body: unknown): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}${path}`, {+ // Errors propagate on purpose. Swallowing them lets a failed reset leave the+ // shared mock stale, and the persistence result this file reports would then+ // be about the previous test's fixture rather than this one's.+ const response = await fetch(`${MOCK_ADMIN_BASE}${path}`, {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify(body),- }).catch(() => undefined);+ });+ if (!response.ok) {+ throw new Error(`mock admin ${path} failed with HTTP ${response.status}`);+ }}const resetMock = () => mockAdmin('/__admin/reset', {});