Skip to content

Commit f173476

Browse files
committed
Remove logs
1 parent e37f362 commit f173476

File tree

6 files changed

+37
-124
lines changed

6 files changed

+37
-124
lines changed

apps/sim/app/api/workflows/[id]/route.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
111111
loops: normalizedData.loops,
112112
})
113113

114-
// Debug: Log sample block data from normalized tables
115-
const sampleBlockId = Object.keys(normalizedData.blocks)[0]
116-
if (sampleBlockId) {
117-
logger.debug(`[${requestId}] Sample block from normalized tables:`, {
118-
blockId: sampleBlockId,
119-
block: normalizedData.blocks[sampleBlockId],
120-
subBlocks: normalizedData.blocks[sampleBlockId]?.subBlocks,
121-
})
122-
}
114+
123115
// Use normalized table data - reconstruct complete state object
124116
// First get any existing state properties, then override with normalized data
125117
const existingState =

apps/sim/app/api/workflows/[id]/state/route.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,6 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
8686
}
8787

8888
// Save to normalized tables
89-
logger.info(`[${requestId}] Saving workflow ${workflowId} state to normalized tables`)
90-
91-
// Debug: Log sample block data being received
92-
const sampleBlockId = Object.keys(state.blocks)[0]
93-
if (sampleBlockId) {
94-
logger.debug(`[${requestId}] Sample block data received:`, {
95-
blockId: sampleBlockId,
96-
block: state.blocks[sampleBlockId],
97-
subBlocks: state.blocks[sampleBlockId]?.subBlocks,
98-
})
99-
}
100-
10189
// Ensure all required fields are present for WorkflowState type
10290
const workflowState = {
10391
blocks: state.blocks,

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/import-controls/import-controls.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,18 @@ export function ImportControls({ disabled = false }: ImportControlsProps) {
107107
}
108108

109109
// Create a new workflow
110-
logger.info('Creating new workflow for YAML import')
110+
111111
const newWorkflowId = await createWorkflow({
112112
name: `Imported Workflow - ${new Date().toLocaleString()}`,
113113
description: 'Workflow imported from YAML',
114114
workspaceId,
115115
})
116116

117117
// Import the YAML into the new workflow BEFORE navigation (creates complete state and saves directly to DB)
118-
// This avoids timing issues with workflow reload during navigation
119-
logger.info('Importing YAML into new workflow before navigation')
120-
const result = await importWorkflowFromYaml(
121-
yamlContent,
122-
{
118+
// This avoids timing issues with workflow reload during navigation
119+
const result = await importWorkflowFromYaml(
120+
yamlContent,
121+
{
123122
addBlock: collaborativeAddBlock,
124123
addEdge: collaborativeAddEdge,
125124
applyAutoLayout: () => {

apps/sim/lib/workflows/db-helpers.ts

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,7 @@ export async function loadWorkflowFromNormalizedTables(
7070
extent,
7171
}
7272

73-
// Debug: Log sample block subBlocks from database
74-
if (block.type === 'agent') {
75-
logger.debug(`Loaded ${block.type} block from database:`, {
76-
blockId: block.id,
77-
subBlocks: block.subBlocks,
78-
})
79-
}
73+
8074
})
8175

8276
// Convert edges to the expected format
@@ -101,23 +95,19 @@ export async function loadWorkflowFromNormalizedTables(
10195
id: subflow.id,
10296
...config,
10397
}
104-
logger.debug(
105-
`[DB-HELPERS] Loaded loop ${subflow.id} with iterations: ${loopConfig.iterations || 'unknown'}`
106-
)
98+
10799
} else if (subflow.type === SUBFLOW_TYPES.PARALLEL) {
108100
parallels[subflow.id] = {
109101
id: subflow.id,
110102
...config,
111103
}
112-
logger.debug(`[DB-HELPERS] Loaded parallel ${subflow.id}`)
104+
113105
} else {
114106
logger.warn(`Unknown subflow type: ${subflow.type} for subflow ${subflow.id}`)
115107
}
116108
})
117109

118-
logger.info(
119-
`Loaded workflow ${workflowId} from normalized tables: ${blocks.length} blocks, ${edges.length} edges, ${subflows.length} subflows`
120-
)
110+
121111

122112
return {
123113
blocks: blocksMap,
@@ -170,14 +160,7 @@ export async function saveWorkflowToNormalizedTables(
170160
extent: block.data?.extent || null,
171161
}))
172162

173-
// Debug: Log sample block insert data
174-
if (blockInserts.length > 0) {
175-
logger.debug(`Saving ${blockInserts.length} blocks. Sample block:`, {
176-
blockId: blockInserts[0].id,
177-
type: blockInserts[0].type,
178-
subBlocks: blockInserts[0].subBlocks,
179-
})
180-
}
163+
181164

182165
await tx.insert(workflowBlocks).values(blockInserts)
183166
}
@@ -240,7 +223,7 @@ export async function saveWorkflowToNormalizedTables(
240223
hasActiveWebhook: state.hasActiveWebhook,
241224
}
242225

243-
logger.info(`Successfully saved workflow ${workflowId} to normalized tables`)
226+
244227

245228
return {
246229
success: true,
@@ -298,7 +281,7 @@ export async function migrateWorkflowToNormalizedTables(
298281
const result = await saveWorkflowToNormalizedTables(workflowId, workflowState)
299282

300283
if (result.success) {
301-
logger.info(`Successfully migrated workflow ${workflowId} to normalized tables`)
284+
302285
return { success: true }
303286
}
304287
return { success: false, error: result.error }

apps/sim/stores/workflows/registry/store.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,23 +474,13 @@ export const useWorkflowRegistry = create<WorkflowRegistry>()(
474474
})
475475
})
476476

477-
// Debug: Log what values are being extracted from the database
478-
logger.debug(
479-
`Extracted subblock values from database for workflow ${id}:`,
480-
subblockValues
481-
)
482-
483-
// Update subblock store for this workflow
477+
// Update subblock store for this workflow
484478
useSubBlockStore.setState((state) => ({
485479
workflowValues: {
486480
...state.workflowValues,
487481
[id]: subblockValues,
488482
},
489483
}))
490-
491-
// Debug: Verify SubBlockStore was updated
492-
const updatedValues = useSubBlockStore.getState().workflowValues[id]
493-
logger.debug(`SubBlockStore updated for workflow ${id}:`, updatedValues)
494484
} else {
495485
// If no state in DB, use empty state - server should have created start block
496486
workflowState = {

apps/sim/stores/workflows/yaml/importer.ts

Lines changed: 23 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export async function importWorkflowFromYaml(
351351
},
352352
targetWorkflowId?: string
353353
): Promise<{ success: boolean; errors: string[]; warnings: string[]; summary?: string }> {
354-
logger.info('Starting YAML workflow import (complete state creation)')
354+
355355

356356
try {
357357
// Parse YAML
@@ -368,13 +368,7 @@ export async function importWorkflowFromYaml(
368368
return { success: false, errors, warnings }
369369
}
370370

371-
logger.info(
372-
`Creating complete workflow state with ${blocks.length} blocks and ${edges.length} edges`
373-
)
374-
logger.debug(
375-
'Blocks to import:',
376-
blocks.map((b) => `${b.id} (${b.type}): ${b.name}`)
377-
)
371+
378372

379373
// Get the existing workflow state (to preserve starter blocks if they exist)
380374
let existingBlocks: Record<string, any> = {}
@@ -386,23 +380,19 @@ export async function importWorkflowFromYaml(
386380
if (response.ok) {
387381
const workflowData = await response.json()
388382
existingBlocks = workflowData.data?.state?.blocks || {}
389-
logger.debug(
390-
`Fetched existing blocks for target workflow ${targetWorkflowId}:`,
391-
Object.keys(existingBlocks)
392-
)
383+
393384
}
394-
} catch (error) {
395-
logger.warn(`Failed to fetch existing blocks for workflow ${targetWorkflowId}:`, error)
385+
} catch (error) {
386+
logger.warn(`Failed to fetch existing blocks for workflow ${targetWorkflowId}:`, error)
387+
}
388+
} else {
389+
// For active workflow, use from store
390+
existingBlocks = workflowActions.getExistingBlocks()
396391
}
397-
} else {
398-
// For active workflow, use from store
399-
existingBlocks = workflowActions.getExistingBlocks()
400-
}
401-
402-
const existingStarterBlocks = Object.values(existingBlocks).filter(
403-
(block: any) => block.type === 'starter'
404-
)
405-
logger.debug(`Found ${existingStarterBlocks.length} existing starter blocks`)
392+
393+
const existingStarterBlocks = Object.values(existingBlocks).filter(
394+
(block: any) => block.type === 'starter'
395+
)
406396

407397
// Get stores and current workflow info
408398
const { useWorkflowStore } = require('@/stores/workflows/workflow/store')
@@ -417,9 +407,7 @@ export async function importWorkflowFromYaml(
417407
return { success: false, errors: ['No active workflow'], warnings: [] }
418408
}
419409

420-
logger.info(
421-
`Importing YAML into workflow: ${activeWorkflowId} ${targetWorkflowId ? '(specified target)' : '(active workflow)'}`
422-
)
410+
423411

424412
// Build complete blocks object
425413
const completeBlocks: Record<string, any> = {}
@@ -456,7 +444,7 @@ export async function importWorkflowFromYaml(
456444
...starterBlock.inputs, // Override with YAML values
457445
}
458446

459-
logger.debug(`Using existing starter block: ${existingStarter.id}`)
447+
460448
} else {
461449
// Create new starter block
462450
starterBlockId = crypto.randomUUID()
@@ -491,7 +479,7 @@ export async function importWorkflowFromYaml(
491479
// Set starter block values
492480
completeSubBlockValues[starterBlockId] = { ...starterBlock.inputs }
493481

494-
logger.debug(`Created new starter block: ${starterBlockId}`)
482+
495483
}
496484
}
497485
}
@@ -500,7 +488,7 @@ export async function importWorkflowFromYaml(
500488
let blocksProcessed = 0
501489
for (const block of blocks) {
502490
if (block.type === 'starter') {
503-
logger.debug(`Skipping starter block: ${block.id} (already handled)`)
491+
504492
continue // Already handled above
505493
}
506494

@@ -528,7 +516,6 @@ export async function importWorkflowFromYaml(
528516

529517
completeSubBlockValues[blockId] = { ...block.inputs }
530518
blocksProcessed++
531-
logger.debug(`Prepared ${block.type} block: ${blockId} -> ${block.name}`)
532519
} else if (blockConfig) {
533520
// Handle regular blocks
534521
const subBlocks: Record<string, any> = {}
@@ -557,15 +544,12 @@ export async function importWorkflowFromYaml(
557544
// Set block input values
558545
completeSubBlockValues[blockId] = { ...block.inputs }
559546
blocksProcessed++
560-
logger.debug(`Prepared ${block.type} block: ${blockId} -> ${block.name}`)
561547
} else {
562548
logger.warn(`No block config found for type: ${block.type} (block: ${block.id})`)
563549
}
564550
}
565551

566-
logger.info(
567-
`Processed ${blocksProcessed} non-starter blocks, total blocks in state: ${Object.keys(completeBlocks).length}`
568-
)
552+
569553

570554
// Create complete edges using the ID mapping
571555
const completeEdges: any[] = []
@@ -579,14 +563,13 @@ export async function importWorkflowFromYaml(
579563
source: sourceId,
580564
target: targetId,
581565
})
582-
logger.debug(`Prepared edge: ${sourceId} -> ${targetId}`)
566+
583567
} else {
584568
logger.warn(`Skipping edge - missing blocks: ${edge.source} -> ${edge.target}`)
585569
}
586570
}
587571

588572
// Create complete workflow state with values already set in subBlocks
589-
logger.info('Creating complete workflow state with embedded values...')
590573

591574
// Merge subblock values directly into block subBlocks
592575
for (const [blockId, blockData] of Object.entries(completeBlocks)) {
@@ -596,9 +579,6 @@ export async function importWorkflowFromYaml(
596579
for (const [subBlockId, subBlockData] of Object.entries(blockData.subBlocks || {})) {
597580
if (blockValues[subBlockId] !== undefined && blockValues[subBlockId] !== null) {
598581
;(subBlockData as any).value = blockValues[subBlockId]
599-
logger.debug(
600-
`Embedded value in block: ${blockId}.${subBlockId} = ${blockValues[subBlockId]}`
601-
)
602582
}
603583
}
604584
}
@@ -617,14 +597,7 @@ export async function importWorkflowFromYaml(
617597
hasActiveWebhook: false,
618598
}
619599

620-
// Save directly to database via API
621-
logger.info('Saving complete workflow state directly to database...')
622-
logger.debug('Sample block being saved:', {
623-
firstBlockId: Object.keys(completeBlocks)[0],
624-
firstBlock: Object.values(completeBlocks)[0],
625-
firstBlockSubBlocks: Object.values(completeBlocks)[0]?.subBlocks,
626-
})
627-
600+
// Save directly to database via API
628601
const response = await fetch(`/api/workflows/${activeWorkflowId}/state`, {
629602
method: 'PUT',
630603
headers: {
@@ -644,42 +617,30 @@ export async function importWorkflowFromYaml(
644617
}
645618

646619
const saveResponse = await response.json()
647-
logger.info('Successfully saved to database:', saveResponse)
648620

649621
// Update local state for immediate UI display (only if importing into active workflow)
650622
if (!targetWorkflowId) {
651-
logger.info('Updating local state for immediate display (active workflow)...')
652623
useWorkflowStore.setState(completeWorkflowState)
653624

654-
// Set subblock values in local store
655-
logger.debug('Setting SubBlockStore with values:', completeSubBlockValues)
625+
// Set subblock values in local store
656626
useSubBlockStore.setState((state: any) => ({
657627
workflowValues: {
658628
...state.workflowValues,
659629
[activeWorkflowId]: completeSubBlockValues,
660630
},
661631
}))
662-
663-
// Verify SubBlockStore was updated
664-
const subBlockStoreValues = useSubBlockStore.getState().workflowValues[activeWorkflowId]
665-
logger.debug('SubBlockStore after update:', subBlockStoreValues)
666-
} else {
667-
logger.info('Skipping local state update (importing into non-active workflow)')
668-
}
632+
}
669633

670634
// Brief delay for UI to update
671635
await new Promise((resolve) => setTimeout(resolve, 100))
672636

673637
// Apply auto layout
674-
logger.info('Applying auto layout...')
675638
workflowActions.applyAutoLayout()
676639

677640
const totalBlocksCreated =
678641
Object.keys(completeBlocks).length - (existingStarterBlocks.length > 0 ? 1 : 0)
679642

680-
logger.info(
681-
`Successfully imported workflow: ${totalBlocksCreated} blocks created, ${completeEdges.length} edges, values set for ${Object.keys(completeSubBlockValues).length} blocks`
682-
)
643+
683644

684645
return {
685646
success: true,

0 commit comments

Comments
 (0)