From c26f21fb4f5185a74cf17d048ce14ef092e7311a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 22 Oct 2026 02:31:55 +0200 Subject: [PATCH] test(e2e): import the insights cache cipher statically in the AI-optional fixture A dynamic import() of app code skips the runner's @/ path mapping for that module's own imports, so sealing the seeded briefing failed with "Cannot find module '@/lib/crypto'". --- e2e/setup/ai-optional-fixture.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/e2e/setup/ai-optional-fixture.ts b/e2e/setup/ai-optional-fixture.ts index 3b930fc38..8458667ea 100644 --- a/e2e/setup/ai-optional-fixture.ts +++ b/e2e/setup/ai-optional-fixture.ts @@ -18,6 +18,8 @@ */ import pg from "pg"; +import { sealInsightsCachedText } from "@/lib/insights/cached-text-cipher"; + import { E2E_AI_OPTIONAL } from "./global-setup"; function connect(): pg.Pool { @@ -81,8 +83,8 @@ export async function seedStoredBriefing(marker: string): Promise { briefingGeneratedAt: new Date().toISOString(), }; // Sealed the way the app writes it; there is no readable column to seed. - const { sealInsightsCachedText } = - await import("@/lib/insights/cached-text-cipher"); + // The import is static on purpose: a dynamic `import()` of app code bypasses + // the test runner's `@/` path mapping for that module's own imports. const sealed = Buffer.from(sealInsightsCachedText(JSON.stringify(insights))); await withAccount(async (pool, userId) => { await pool.query(