Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

test(admin-api): keep Cloud ingestion projects stored as none (#19551)

Tobias Wochinger42d1b02b7454
diff --git a/web/src/__tests__/server/apiKeyCacheInvalidation.servertest.ts b/web/src/__tests__/server/apiKeyCacheInvalidation.servertest.ts
index f68789b6bc..0f9d757be0 100644
--- a/web/src/__tests__/server/apiKeyCacheInvalidation.servertest.ts
+++ b/web/src/__tests__/server/apiKeyCacheInvalidation.servertest.ts
@@ -398,6 +398,43 @@ describe("API-key cache invalidation on project/org lifecycle", () => {
).resolves.toMatchObject({ deletedAt: null });
});
+ it("admin project deletion keeps a Cloud project whose stored ingestion mode is NONE", async () => {
+ const orgId = await createOrg();
+ const projectId = await createProject(orgId);
+ const keys = await seedOrgScopedKey(orgId);
+ // A legacy Cloud row can still store NONE. It runs as USAGE, so deletion stays blocked.
+ const originalCloudRegion = env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION;
+ Object.assign(env, { NEXT_PUBLIC_LANGFUSE_CLOUD_REGION: "EU" });
+ try {
+ await prisma.gatewayConfig.create({
+ data: {
+ organizationId: orgId,
+ defaultIngestionProjectId: projectId,
+ ingestionMode: "NONE",
+ },
+ });
+
+ const res = makeRes();
+ await handleDeleteProject({} as any, res, projectId, {
+ orgId,
+ apiKeyId: "ADMIN_KEY",
+ } as any);
+
+ expect(res.statusCode).toBe(409);
+ expect(res.body).toEqual({
+ message: getGatewayIngestionProjectDeletionMessage(),
+ });
+ expect(await survivingKeys(keys)).toEqual(keys);
+ await expect(
+ prisma.project.findUnique({ where: { id: projectId } }),
+ ).resolves.toMatchObject({ deletedAt: null });
+ } finally {
+ Object.assign(env, {
+ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION: originalCloudRegion,
+ });
+ }
+ });
+
it("admin project soft deletion preserves user permissions and evicts cached keys", async () => {
const orgId = await createOrg();
const projectId = await createProject(orgId);