From d081ab283e5f3e036bfbb6c4941a77afe08486a3 Mon Sep 17 00:00:00 2001 From: Waleed Date: Thu, 7 May 2026 12:54:42 -0700 Subject: [PATCH] fix(logs): relax fileSchema so execution logs with files render again (#4495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(logs): relax fileSchema so execution logs with files render again * improvement(logs): align fileSchema with shared UserFile type - contracts/logs.ts: replace local fileSchema with mediaUserFileSchema (the established UserFile boundary schema with .passthrough()) - file-download.tsx: drop local FileData interface, use UserFile from @/executor/types * improvement(contracts): promote userFileSchema to primitives Move the canonical UserFile boundary schema out of tools/media/shared.ts (where it didn't belong — logs aren't media tools) into primitives.ts as userFileSchema. Update logs, stt, and video contracts to import from the shared primitive. Co-Authored-By: Claude Opus 4.7 --------- Co-authored-by: Claude Opus 4.7 --- .../file-download/file-download.tsx | 23 +++++-------------- apps/sim/lib/api/contracts/logs.ts | 16 ++----------- apps/sim/lib/api/contracts/primitives.ts | 20 ++++++++++++++++ .../lib/api/contracts/tools/media/shared.ts | 13 ----------- apps/sim/lib/api/contracts/tools/media/stt.ts | 5 ++-- .../lib/api/contracts/tools/media/video.ts | 5 ++-- 6 files changed, 34 insertions(+), 48 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx index 23670cf2c0..9a2e09ce47 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/file-download/file-download.tsx @@ -5,31 +5,20 @@ import { createLogger } from '@sim/logger' import { ArrowDown } from 'lucide-react' import { useRouter } from 'next/navigation' import { Button, Loader } from '@/components/emcn' +import { cn } from '@/lib/core/utils/cn' import { extractWorkspaceIdFromExecutionKey, getViewerUrl } from '@/lib/uploads/utils/file-utils' +import type { UserFile } from '@/executor/types' const logger = createLogger('FileCards') -interface FileData { - id?: string - name: string - size: number - type: string - key: string - url: string - uploadedAt: string - expiresAt: string - storageProvider?: 's3' | 'blob' | 'local' - bucketName?: string -} - interface FileCardsProps { - files: FileData[] + files: UserFile[] isExecutionFile?: boolean workspaceId?: string } interface FileCardProps { - file: FileData + file: UserFile isExecutionFile?: boolean workspaceId?: string } @@ -157,7 +146,7 @@ export function FileDownload({ className, workspaceId, }: { - file: FileData + file: UserFile isExecutionFile?: boolean className?: string workspaceId?: string @@ -220,7 +209,7 @@ export function FileDownload({ return (