πͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(blob-exporter): gate isEnrichedBlobExportAvailable on V4 env vars for self-hosted (#14098)
Niklas Semmlerba239be4dc61
diff --git a/packages/shared/src/features/analytics-integrations/blob-export-gate.ts b/packages/shared/src/features/analytics-integrations/blob-export-gate.tsindex 68c6eb7e09..2eaf732474 100644--- a/packages/shared/src/features/analytics-integrations/blob-export-gate.ts+++ b/packages/shared/src/features/analytics-integrations/blob-export-gate.ts@@ -39,8 +39,13 @@ export function isLegacyBlobExportAllowed(/*** Whether this deployment has the enriched events export path.- * Today equivalent to `isLangfuseCloud`; flip when self-hosted is provisioned with the migration.+ * True for Cloud, or for self-hosted instances that have opted into the V4 preview+ * via LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN (server-side only β pass the flag+ * from a server-computed context rather than reading it client-side).*/-export function isEnrichedBlobExportAvailable(isCloud: boolean): boolean {- return isCloud;+export function isEnrichedBlobExportAvailable(+ isCloud: boolean,+ isV4PreviewEnabled?: boolean,+): boolean {+ return isCloud || isV4PreviewEnabled === true;}diff --git a/web/src/__tests__/server/blob-storage-integration-trpc.servertest.ts b/web/src/__tests__/server/blob-storage-integration-trpc.servertest.tsindex 4859a6e9a0..8e71c54632 100644--- a/web/src/__tests__/server/blob-storage-integration-trpc.servertest.ts+++ b/web/src/__tests__/server/blob-storage-integration-trpc.servertest.ts@@ -420,7 +420,7 @@ describe("Blob Storage Integration tRPC Router", () => {const result = await caller.blobStorageIntegration.get({projectId: project.id,});- expect(result?.exportFieldGroups).toStrictEqual(["core", "io"]);+ expect(result?.config?.exportFieldGroups).toStrictEqual(["core", "io"]);});it("defaults to all groups when exportFieldGroups is omitted", async () => {@@ -502,7 +502,7 @@ describe("Blob Storage Integration tRPC Router", () => {const result = await caller.blobStorageIntegration.get({projectId: project.id,});- expect(result?.exportFieldGroups).toStrictEqual(["core", "io"]);+ expect(result?.config?.exportFieldGroups).toStrictEqual(["core", "io"]);});it("overwrites stored subset when a new subset is submitted", async () => {@@ -523,7 +523,7 @@ describe("Blob Storage Integration tRPC Router", () => {const result = await caller.blobStorageIntegration.get({projectId: project.id,});- expect(result?.exportFieldGroups).toStrictEqual([+ expect(result?.config?.exportFieldGroups).toStrictEqual(["core","io","metrics",@@ -620,4 +620,112 @@ describe("Blob Storage Integration tRPC Router", () => {}});});++ describe("get: isEnrichedExportAvailable flag", () => {+ const originalRegion = env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION;+ const originalV4Preview = env.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN;++ afterEach(() => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = originalRegion;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN =+ originalV4Preview;+ });++ it("returns true for Cloud deployments regardless of V4 flag", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = "us";+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "false";+ const { caller, project } = await prepare();+ const result = await caller.blobStorageIntegration.get({+ projectId: project.id,+ });+ expect(result.isEnrichedExportAvailable).toBe(true);+ });++ it("returns false for self-hosted without V4 preview opt-in", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "false";+ const { caller, project } = await prepare();+ const result = await caller.blobStorageIntegration.get({+ projectId: project.id,+ });+ expect(result.isEnrichedExportAvailable).toBe(false);+ });++ it("returns true for self-hosted with V4 preview opt-in enabled", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "true";+ const { caller, project } = await prepare();+ const result = await caller.blobStorageIntegration.get({+ projectId: project.id,+ });+ expect(result.isEnrichedExportAvailable).toBe(true);+ });+ });++ describe("update: enriched export source guard", () => {+ const originalRegion = env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION;+ const originalV4Preview = env.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN;++ afterEach(() => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = originalRegion;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN =+ originalV4Preview;+ });++ it("rejects EVENTS on self-hosted without V4 preview opt-in", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "false";+ const { caller, project } = await prepare();+ await expect(+ caller.blobStorageIntegration.update({+ projectId: project.id,+ ...baseConfig,+ exportSource: "EVENTS" as const,+ }),+ ).rejects.toMatchObject({ code: "BAD_REQUEST" });+ });++ it("rejects TRACES_OBSERVATIONS_EVENTS on self-hosted without V4 preview opt-in", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "false";+ const { caller, project } = await prepare();+ await prisma.project.update({+ where: { id: project.id },+ data: { createdAt: PRE_CUTOFF },+ });+ await expect(+ caller.blobStorageIntegration.update({+ projectId: project.id,+ ...baseConfig,+ exportSource: "TRACES_OBSERVATIONS_EVENTS" as const,+ }),+ ).rejects.toMatchObject({ code: "BAD_REQUEST" });+ });++ it("allows EVENTS on self-hosted with V4 preview opt-in", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "true";+ const { caller, project } = await prepare();+ await expect(+ caller.blobStorageIntegration.update({+ projectId: project.id,+ ...baseConfig,+ exportSource: "EVENTS" as const,+ }),+ ).resolves.not.toThrow();+ });++ it("allows EVENTS on Cloud regardless of V4 flag", async () => {+ (env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = "us";+ (env as any).LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN = "false";+ const { caller, project } = await prepare();+ await expect(+ caller.blobStorageIntegration.update({+ projectId: project.id,+ ...baseConfig,+ exportSource: "EVENTS" as const,+ }),+ ).resolves.not.toThrow();+ });+ });});diff --git a/web/src/__tests__/server/unit/assertEnrichedBlobExportSourceAllowed.servertest.ts b/web/src/__tests__/server/unit/assertEnrichedBlobExportSourceAllowed.servertest.tsnew file mode 100644index 0000000000..249ee657e5--- /dev/null+++ b/web/src/__tests__/server/unit/assertEnrichedBlobExportSourceAllowed.servertest.ts@@ -0,0 +1,122 @@+import { describe, it, expect } from "vitest";+import { assertEnrichedBlobExportSourceAllowed } from "@/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed";++describe("assertEnrichedBlobExportSourceAllowed", () => {+ it("Cloud + explicit EVENTS β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "EVENTS",+ isCloud: true,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });++ it("self-hosted + V4 preview + explicit EVENTS β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "EVENTS",+ isCloud: false,+ isV4PreviewEnabled: true,+ }),+ ).not.toThrow();+ });++ it("self-hosted without V4 preview + explicit EVENTS β reject", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "EVENTS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).toThrow("Enriched blob export is not available on this deployment");+ });++ it("self-hosted without V4 preview + explicit TRACES_OBSERVATIONS_EVENTS β reject", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "TRACES_OBSERVATIONS_EVENTS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).toThrow("Enriched blob export is not available on this deployment");+ });++ it("self-hosted without V4 preview + explicit TRACES_OBSERVATIONS β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "TRACES_OBSERVATIONS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });++ // Partial updates: the request omits exportSource, so the persisted value+ // stays in effect and must satisfy the gate too (V4-preview rollback case).+ it("self-hosted without V4 preview + omitted source + existing EVENTS β reject", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: undefined,+ existingExportSource: "EVENTS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).toThrow("Enriched blob export is not available on this deployment");+ });++ it("self-hosted without V4 preview + omitted source + existing TRACES_OBSERVATIONS_EVENTS β reject", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: undefined,+ existingExportSource: "TRACES_OBSERVATIONS_EVENTS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).toThrow("Enriched blob export is not available on this deployment");+ });++ it("self-hosted without V4 preview + omitted source + existing TRACES_OBSERVATIONS β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: undefined,+ existingExportSource: "TRACES_OBSERVATIONS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });++ it("self-hosted without V4 preview + omitted source + no existing row β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: undefined,+ existingExportSource: null,+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });++ it("Cloud + omitted source + existing EVENTS β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: undefined,+ existingExportSource: "EVENTS",+ isCloud: true,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });++ it("explicit legacy source overrides an existing enriched value β allow", () => {+ expect(() =>+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: "TRACES_OBSERVATIONS",+ existingExportSource: "EVENTS",+ isCloud: false,+ isV4PreviewEnabled: false,+ }),+ ).not.toThrow();+ });+});diff --git a/web/src/features/blobstorage-integration/blobstorage-integration-router.ts b/web/src/features/blobstorage-integration/blobstorage-integration-router.tsindex a79034b998..4594e35665 100644--- a/web/src/features/blobstorage-integration/blobstorage-integration-router.ts+++ b/web/src/features/blobstorage-integration/blobstorage-integration-router.ts@@ -13,6 +13,7 @@ import {} from "@/src/features/blobstorage-integration/validation";import { upsertBlobStorageIntegration } from "@/src/features/blobstorage-integration/service";import { assertLegacyBlobExportSourceAllowed } from "@/src/features/blobstorage-integration/server/assertLegacyBlobExportSourceAllowed";+import { assertEnrichedBlobExportSourceAllowed } from "@/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed";import { TRPCError } from "@trpc/server";import { env } from "@/src/env.mjs";import {@@ -28,6 +29,7 @@ import { decrypt } from "@langfuse/shared/encryption";import {BlobStorageIntegrationType,InvalidRequestError,+ isEnrichedBlobExportAvailable,} from "@langfuse/shared";const getAuditLogErrorType = (error: unknown) =>@@ -50,6 +52,12 @@ export const blobStorageIntegrationRouter = createTRPCRouter({scope: "integrations:CRUD",});try {+ const isCloud = Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION);+ const isEnrichedExportAvailable = isEnrichedBlobExportAvailable(+ isCloud,+ env.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN === "true",+ );+const config = await ctx.prisma.blobStorageIntegration.findFirst({where: {projectId: input.projectId,@@ -59,11 +67,7 @@ export const blobStorageIntegrationRouter = createTRPCRouter({},});- if (!config) {- return null;- }-- return config;+ return { config: config ?? null, isEnrichedExportAvailable };} catch (e) {logger.error(`Failed to get blob storage integration`, e);throw new TRPCError({@@ -89,6 +93,7 @@ export const blobStorageIntegrationRouter = createTRPCRouter({});if (input.exportSource) {+ const isCloud = Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION);const project = await ctx.prisma.project.findUniqueOrThrow({where: { id: input.projectId },select: { createdAt: true },@@ -96,7 +101,13 @@ export const blobStorageIntegrationRouter = createTRPCRouter({assertLegacyBlobExportSourceAllowed({project,nextInternalExportSource: input.exportSource,- isCloud: Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION),+ isCloud,+ });+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: input.exportSource,+ isCloud,+ isV4PreviewEnabled:+ env.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN === "true",});}diff --git a/web/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed.ts b/web/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed.tsnew file mode 100644index 0000000000..700408de2b--- /dev/null+++ b/web/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed.ts@@ -0,0 +1,41 @@+import {+ AnalyticsIntegrationExportSource,+ InvalidRequestError,+ isEnrichedBlobExportAvailable,+} from "@langfuse/shared";++/**+ * Rejects enriched export sources (EVENTS, TRACES_OBSERVATIONS_EVENTS) on+ * deployments where the enriched export path is unavailable (self-hosted+ * without the V4 preview opt-in).+ *+ * For partial updates that omit exportSource, the persisted value stays in+ * effect β pass it as existingExportSource so a stale enriched value left+ * behind by a V4-preview flag rollback is rejected instead of silently+ * driving the worker against unpopulated tables.+ */+export function assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource,+ existingExportSource,+ isCloud,+ isV4PreviewEnabled,+}: {+ nextInternalExportSource: AnalyticsIntegrationExportSource | undefined;+ existingExportSource?: AnalyticsIntegrationExportSource | null;+ isCloud: boolean;+ isV4PreviewEnabled: boolean;+}): void {+ const effectiveSource = nextInternalExportSource ?? existingExportSource;+ if (+ effectiveSource !== AnalyticsIntegrationExportSource.EVENTS &&+ effectiveSource !==+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS+ )+ return;++ if (isEnrichedBlobExportAvailable(isCloud, isV4PreviewEnabled)) return;++ throw new InvalidRequestError(+ "Enriched blob export is not available on this deployment",+ );+}diff --git a/web/src/pages/api/public/integrations/blob-storage/index.ts b/web/src/pages/api/public/integrations/blob-storage/index.tsindex 6190c43c5e..b4a7ba4e43 100644--- a/web/src/pages/api/public/integrations/blob-storage/index.ts+++ b/web/src/pages/api/public/integrations/blob-storage/index.ts@@ -16,9 +16,11 @@ import {UnauthorizedError,ForbiddenError,isLegacyBlobExportAllowed,+ isEnrichedBlobExportAvailable,} from "@langfuse/shared";import { upsertBlobStorageIntegration } from "@/src/features/blobstorage-integration/service";import { assertLegacyBlobExportSourceAllowed } from "@/src/features/blobstorage-integration/server/assertLegacyBlobExportSourceAllowed";+import { assertEnrichedBlobExportSourceAllowed } from "@/src/features/blobstorage-integration/server/assertEnrichedBlobExportSourceAllowed";import { auditLog } from "@/src/features/audit-logs/auditLog";import { env } from "@/src/env.mjs";@@ -159,16 +161,41 @@ async function handleUpsertBlobStorageIntegration(const isCloud = Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION);- if (validatedData.exportSource) {+ const isV4PreviewEnabled =+ env.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN === "true";+ const internalExportSource =+ validatedData.exportSource != null+ ? toInternalExportSource(validatedData.exportSource)+ : undefined;++ if (internalExportSource) {assertLegacyBlobExportSourceAllowed({project,- nextInternalExportSource: toInternalExportSource(- validatedData.exportSource,- ),+ nextInternalExportSource: internalExportSource,isCloud,});}+ // Partial PUTs that omit exportSource preserve the persisted value, so the+ // enriched gate must consider the existing row too β otherwise a stale+ // enriched source left behind by a V4-preview flag rollback keeps driving+ // the worker against unpopulated tables. The extra read only happens when+ // the gate could actually reject (enriched export unavailable).+ const existingIntegration =+ internalExportSource === undefined &&+ !isEnrichedBlobExportAvailable(isCloud, isV4PreviewEnabled)+ ? await prisma.blobStorageIntegration.findUnique({+ where: { projectId: validatedData.projectId },+ select: { exportSource: true },+ })+ : null;+ assertEnrichedBlobExportSourceAllowed({+ nextInternalExportSource: internalExportSource,+ existingExportSource: existingIntegration?.exportSource,+ isCloud,+ isV4PreviewEnabled,+ });+await auditLog({action: "update",resourceType: "blobStorageIntegration",@@ -201,10 +228,7 @@ async function handleUpsertBlobStorageIntegration(exportMode: validatedData.exportMode,exportStartDate: validatedData.exportStartDate ?? null,compressed: validatedData.compressed,- exportSource:- validatedData.exportSource != null- ? toInternalExportSource(validatedData.exportSource)- : undefined,+ exportSource: internalExportSource,exportFieldGroups: validatedData.exportFieldGroups ?? undefined,},});diff --git a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsxindex 72d6374413..978510f6cc 100644--- a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx@@ -56,7 +56,6 @@ import {OBSERVATION_FIELD_GROUPS_FULL,type ObservationFieldGroupFull,isLegacyBlobExportAllowed,- isEnrichedBlobExportAvailable,} from "@langfuse/shared";import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";import { useQueryProject } from "@/src/features/projects/hooks";@@ -81,16 +80,16 @@ export default function BlobStorageIntegrationSettings() {);const syncStatus =- state.isLoading || !hasAccess || !state.data+ state.isLoading || !hasAccess || !state.data?.config? undefined: deriveSyncStatus({- enabled: state.data.enabled,- lastError: state.data.lastError,- lastSyncAt: state.data.lastSyncAt- ? new Date(state.data.lastSyncAt)+ enabled: state.data.config.enabled,+ lastError: state.data.config.lastError,+ lastSyncAt: state.data.config.lastSyncAt+ ? new Date(state.data.config.lastSyncAt): null,- nextSyncAt: state.data.nextSyncAt- ? new Date(state.data.nextSyncAt)+ nextSyncAt: state.data.config.nextSyncAt+ ? new Date(state.data.config.nextSyncAt): null,});@@ -140,19 +139,19 @@ export default function BlobStorageIntegrationSettings() {reach out to your project admin or owner.</p>)}- {state.data && (+ {state.data?.config && (<><Header title="Status" />- {state.data.lastError && (+ {state.data.config.lastError && (<Alert variant="destructive" className="mb-4"><AlertTitle>Last export failed</AlertTitle><AlertDescription>- {state.data.lastError}- {state.data.lastErrorAt && (+ {state.data.config.lastError}+ {state.data.config.lastErrorAt && (<><br /><span className="text-xs opacity-70">- {new Date(state.data.lastErrorAt).toLocaleString()}+ {new Date(state.data.config.lastErrorAt).toLocaleString()}</span></>)}@@ -163,42 +162,45 @@ export default function BlobStorageIntegrationSettings() {<div className="grid grid-cols-[auto,1fr] gap-x-4 gap-y-1 text-sm"><span className="text-muted-foreground">Data exported up to</span><span>- {state.data.lastSyncAt- ? new Date(state.data.lastSyncAt).toLocaleString()+ {state.data.config.lastSyncAt+ ? new Date(state.data.config.lastSyncAt).toLocaleString(): "Never (pending)"}</span>- {state.data.nextSyncAt && (+ {state.data.config.nextSyncAt && (<><span className="text-muted-foreground">Next export scheduled</span><span>- {new Date(state.data.nextSyncAt).toLocaleString()}+ {new Date(state.data.config.nextSyncAt).toLocaleString()}</span></>)}<span className="text-muted-foreground">Export mode</span><span>- {state.data.exportMode === BlobStorageExportMode.FULL_HISTORY+ {state.data.config.exportMode ===+ BlobStorageExportMode.FULL_HISTORY? "Full history"- : state.data.exportMode === BlobStorageExportMode.FROM_TODAY+ : state.data.config.exportMode ===+ BlobStorageExportMode.FROM_TODAY? "From setup date"- : state.data.exportMode ===+ : state.data.config.exportMode ===BlobStorageExportMode.FROM_CUSTOM_DATE? "From custom date": "Unknown"}</span>- {(state.data.exportMode ===+ {(state.data.config.exportMode ===BlobStorageExportMode.FROM_CUSTOM_DATE ||- state.data.exportMode === BlobStorageExportMode.FROM_TODAY) &&- state.data.exportStartDate && (+ state.data.config.exportMode ===+ BlobStorageExportMode.FROM_TODAY) &&+ state.data.config.exportStartDate && (<><span className="text-muted-foreground">Export start date</span><span>{new Date(- state.data.exportStartDate,+ state.data.config.exportStartDate,).toLocaleDateString()}</span></>@@ -212,9 +214,12 @@ export default function BlobStorageIntegrationSettings() {<Header title="Configuration" className="mt-8" /><Card className="p-3"><BlobStorageIntegrationSettingsForm- state={state.data || undefined}+ state={state.data?.config || undefined}projectId={projectId}isLoading={state.isLoading}+ isEnrichedExportAvailable={+ state.data?.isEnrichedExportAvailable ?? false+ }/></Card></>@@ -227,10 +232,12 @@ const BlobStorageIntegrationSettingsForm = ({state,projectId,isLoading,+ isEnrichedExportAvailable,}: {state?: Partial<BlobStorageIntegration>;projectId: string;isLoading: boolean;+ isEnrichedExportAvailable: boolean;}) => {const capture = usePostHogClientCapture();const { isLangfuseCloud } = useLangfuseCloudRegion();@@ -247,7 +254,7 @@ const BlobStorageIntegrationSettingsForm = ({const isPostCutoffCloud =project?.createdAt != null &&!isLegacyBlobExportAllowed(new Date(project.createdAt), isLangfuseCloud);- const eventsExportAvailable = isEnrichedBlobExportAvailable(isLangfuseCloud);+ const eventsExportAvailable = isEnrichedExportAvailable;const showExportSourceField = eventsExportAvailable && !isPostCutoffCloud;const blobStorageForm = useForm({@@ -272,10 +279,18 @@ const BlobStorageIntegrationSettingsForm = ({exportStartDate: state?.exportStartDate || null,exportSource: isPostCutoffCloud? AnalyticsIntegrationExportSource.EVENTS- : state?.exportSource ||- (eventsExportAvailable- ? AnalyticsIntegrationExportSource.EVENTS- : AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS),+ : (() => {+ const persisted = state?.exportSource;+ const isEnriched =+ persisted === AnalyticsIntegrationExportSource.EVENTS ||+ persisted ===+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS;+ if (persisted && (!isEnriched || eventsExportAvailable))+ return persisted;+ return eventsExportAvailable+ ? AnalyticsIntegrationExportSource.EVENTS+ : AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS;+ })(),// Empty array in the DB means "export everything" (the worker falls back// to all groups), so surface it as the full selection in the form.exportFieldGroups: state?.exportFieldGroups?.length@@ -308,10 +323,18 @@ const BlobStorageIntegrationSettingsForm = ({exportStartDate: state?.exportStartDate || null,exportSource: isPostCutoffCloud? AnalyticsIntegrationExportSource.EVENTS- : state?.exportSource ||- (eventsExportAvailable- ? AnalyticsIntegrationExportSource.EVENTS- : AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS),+ : (() => {+ const persisted = state?.exportSource;+ const isEnriched =+ persisted === AnalyticsIntegrationExportSource.EVENTS ||+ persisted ===+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS;+ if (persisted && (!isEnriched || eventsExportAvailable))+ return persisted;+ return eventsExportAvailable+ ? AnalyticsIntegrationExportSource.EVENTS+ : AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS;+ })(),// Empty array in the DB means "export everything" (the worker falls back// to all groups), so surface it as the full selection in the form.exportFieldGroups: state?.exportFieldGroups?.length@@ -320,7 +343,7 @@ const BlobStorageIntegrationSettingsForm = ({compressed: state?.compressed ?? true,});// eslint-disable-next-line react-hooks/exhaustive-deps- }, [state]);+ }, [state, isEnrichedExportAvailable, isPostCutoffCloud]);const watchedExportMode = blobStorageForm.watch("exportMode");const watchedExportSource = blobStorageForm.watch("exportSource");