From eacd6e42fda76569dbe18164a8227a35fa3b4e64 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Tue, 10 Mar 2026 15:16:36 +0000 Subject: [PATCH] fix(typecheck): resolve TypeScript errors introduced by lint fixes - ExecutionMonitor: fix null checks, align metrics with ExecutionMetrics type - error-reporting: handle undefined match groups and status message lookups - multi-tenant-context.examples: use executionId instead of id, fix type casts - multi-tenant-context: add type assertion for request data - workflow-error-handler: spread ErrorContext to satisfy Record Co-Authored-By: Claude Opus 4.6 --- .../src/components/workflow/ExecutionMonitor.tsx | 9 +++++---- frontends/nextjs/src/lib/error-reporting.ts | 4 ++-- .../lib/workflow/multi-tenant-context.examples.ts | 14 ++++++-------- .../src/lib/workflow/multi-tenant-context.ts | 2 +- .../src/lib/workflow/workflow-error-handler.ts | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/frontends/nextjs/src/components/workflow/ExecutionMonitor.tsx b/frontends/nextjs/src/components/workflow/ExecutionMonitor.tsx index 2623753da..148bb0f82 100644 --- a/frontends/nextjs/src/components/workflow/ExecutionMonitor.tsx +++ b/frontends/nextjs/src/components/workflow/ExecutionMonitor.tsx @@ -109,7 +109,7 @@ export const ExecutionMonitor: React.FC = ({ - {listError !== undefined && ( + {listError != null && (

Error loading executions: {listError.message}

@@ -125,7 +125,7 @@ export const ExecutionMonitor: React.FC = ({ /> ))} - {executions.length === 0 && listError === undefined && ( + {executions.length === 0 && listError == null && (

No executions yet

)} @@ -380,8 +380,9 @@ const MetricsGrid: React.FC = ({ metrics }) => { - - + + + ) } diff --git a/frontends/nextjs/src/lib/error-reporting.ts b/frontends/nextjs/src/lib/error-reporting.ts index 1f8d9143c..08d0a734e 100644 --- a/frontends/nextjs/src/lib/error-reporting.ts +++ b/frontends/nextjs/src/lib/error-reporting.ts @@ -200,7 +200,7 @@ class ErrorReportingService { private extractStatusCode(error: Error | string): number | undefined { const message = typeof error === 'string' ? error : error.message const match = message.match(/(\d{3})/) - return match != null ? parseInt(match[1], 10) : undefined + return match?.[1] != null ? parseInt(match[1], 10) : undefined } /** @@ -254,7 +254,7 @@ class ErrorReportingService { 504: 'Gateway timeout. Please try again later.', } - return messages[statusCode] + return messages[statusCode] ?? 'An unexpected error occurred.' } /** diff --git a/frontends/nextjs/src/lib/workflow/multi-tenant-context.examples.ts b/frontends/nextjs/src/lib/workflow/multi-tenant-context.examples.ts index 6add8a086..fae140063 100644 --- a/frontends/nextjs/src/lib/workflow/multi-tenant-context.examples.ts +++ b/frontends/nextjs/src/lib/workflow/multi-tenant-context.examples.ts @@ -134,7 +134,7 @@ export async function manualWorkflowExecution(req: NextRequest) { timestamp: Date.now(), }, variables, - secrets, + secrets: secrets as Record | undefined, }) console.warn(`[${executionId}] Context built for user ${user.id}`) @@ -150,9 +150,8 @@ export async function manualWorkflowExecution(req: NextRequest) { // 6. Return result return NextResponse.json({ success: true, - executionId: record.id, + executionId: record.executionId, status: record.status, - duration: record.duration, }) } catch (error) { console.error(`[${executionId}] Execution failed:`, error) @@ -367,12 +366,11 @@ export async function executeScheduledWorkflow( // 4. Log to database const executionLogOps = db.entity('ExecutionLog') await executionLogOps.create({ - executionId: record.id, + executionId: record.executionId, tenantId, workflowId: workflow.id, triggeredBy: 'schedule', status: record.status, - duration: record.duration, createdAt: new Date(), }) @@ -530,7 +528,7 @@ export async function adminExecuteWorkflow(req: NextRequest) { return NextResponse.json({ success: true, - executionId: record.id, + executionId: record.executionId, status: record.status, note: 'Cross-tenant execution by super-admin', }) @@ -561,8 +559,8 @@ export async function logExecutionContext(context: ExtendedWorkflowContext) { workflow: sanitized.workflowId, tenant: sanitized.tenantId, user: sanitized.userId, - mode: sanitized.multiTenant.executionMode, - timestamp: sanitized.multiTenant.requestedAt, + mode: (sanitized.multiTenant as Record)?.executionMode, + timestamp: (sanitized.multiTenant as Record)?.requestedAt, // Variables listed as keys only, no values variables: sanitized.variables, // Limits included for monitoring diff --git a/frontends/nextjs/src/lib/workflow/multi-tenant-context.ts b/frontends/nextjs/src/lib/workflow/multi-tenant-context.ts index 5b92d64fb..bf1157b01 100644 --- a/frontends/nextjs/src/lib/workflow/multi-tenant-context.ts +++ b/frontends/nextjs/src/lib/workflow/multi-tenant-context.ts @@ -189,7 +189,7 @@ export class MultiTenantContextBuilder { triggerData: requestData?.triggerData ?? {}, variables: this.buildVariables(requestData?.variables), secrets: requestData?.secrets ?? {}, - request: this.options.captureRequestData ? requestData?.request : undefined, + request: this.options.captureRequestData ? requestData?.request as WorkflowContext['request'] : undefined, multiTenant: multiTenantMeta, requestMetadata: { ipAddress: this.requestContext.ipAddress, diff --git a/frontends/nextjs/src/lib/workflow/workflow-error-handler.ts b/frontends/nextjs/src/lib/workflow/workflow-error-handler.ts index 8734b6230..221e4145f 100644 --- a/frontends/nextjs/src/lib/workflow/workflow-error-handler.ts +++ b/frontends/nextjs/src/lib/workflow/workflow-error-handler.ts @@ -484,7 +484,7 @@ export class WorkflowErrorHandler { code: WorkflowErrorCode.NOT_FOUND, message: `${resource} not found`, statusCode: 404, - details: context, + details: { ...context }, }, diagnostics: { hint: ERROR_HINTS[WorkflowErrorCode.NOT_FOUND],