Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

emir-karabeg and others added 7 commits July 15, 2025 20:41
* fix: sidebar toggle

* feat: search complete
* fix: added cronExpression field and fixed formatting

* fix: modified the test.ts file #699

* added additional validation

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: Waleed Latif <walif6@gmail.com>
* fix(invitation): added ability for admins to remove members of their workspace

* lint

* remove references to workspace_member db table

* remove deprecated @next/font

* only allow admin to rename workspace

* bring workflow name change inline, remove dialog
)

* improvement(voice): interrupt UI + live transcription

* cleanup logs

* remove cross
* fix typo in docs file

* fix(subflows): fixed subflows executing irrespective of active path

* added routing strategy

* reorganized executor

* brought folder renaming inline

* cleanup
@vercel
Copy link

vercel bot commented Jul 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim (staging) ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2025 10:01pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 16, 2025 10:01pm

@delve-auditor
Copy link

delve-auditor bot commented Jul 16, 2025

No security or compliance issues detected. Reviewed everything up to 92fe353.

Security Overview
  • 🔎 Scanned files: 80 changed file(s)
Detected Code Changes

The diff is too large to display a summary of code changes.

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR (v0.3.2) introduces several major improvements and critical fixes across the codebase:

  1. Path-Aware Execution System: A significant architectural improvement that fixes subflow execution by ensuring blocks only execute when explicitly selected by router/condition blocks. This includes:

    • New PathTracker integration for loop and parallel handlers
    • Block categorization into routing, flow control, and regular blocks
    • Comprehensive test coverage for nested routing scenarios
  2. Code Organization & Type Safety:

    • Migration from relative imports to path aliases using '@/executor/*' pattern
    • Introduction of BlockType enum replacing string literals for block types
    • Improved folder structure with dedicated directories for core components
  3. Feature Improvements:

    • Sidebar toggle and global search (Cmd+K shortcut)
    • Voice interface interruption capability and audio sync
    • Custom cron expression validation
    • Enhanced workspace member management for admins
  4. Permission System Overhaul:

    • Consolidated access control using permissions table
    • Removed redundant workspaceMember table
    • Improved invitation system with better email matching

Confidence score: 4 /5

  1. This PR is generally safe to merge with careful testing of workflow execution paths
  2. While the changes are extensive, they are well-tested and improve system reliability. The lower score is due to the significant changes to core execution logic
  3. Key files needing attention:
    • apps/sim/executor/index.ts (core execution logic changes)
    • apps/sim/executor/routing/routing.ts (new path tracking system)
    • apps/sim/app/api/workspaces/* (permission system changes)

78 files reviewed, 16 comments
Edit PR Review Bot Settings | Greptile

const mockQuery = {
from: vi.fn().mockReturnThis(),
where: vi.fn().mockReturnThis(),
then: vi.fn((callback: (rows: any[]) => any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: consider adding type definition for callback parameter instead of using any[]

Comment on lines +137 to +145
const cronExpression = getSubBlockValue(starterBlock, 'cronExpression') || null

// Validate cron expression if provided
if (cronExpression) {
const validation = validateCronExpression(cronExpression)
if (!validation.isValid) {
throw new Error(`Invalid cron expression: ${validation.error}`)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider moving validation logic into its own function to keep getScheduleTimeValues more focused on value extraction

Comment on lines 289 to 291
wsInvitation.expiresAt &&
new Date().toISOString() <= wsInvitation.expiresAt.toISOString()
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: same date comparison issue here - use native Date objects instead of string conversion

Suggested change
wsInvitation.expiresAt &&
new Date().toISOString() <= wsInvitation.expiresAt.toISOString()
) {
wsInvitation.expiresAt &&
new Date() <= wsInvitation.expiresAt
) {

stars={template.stars}
icon={template.icon}
iconColor={template.color}
state={template.state as { blocks?: Record<string, { type: string; name?: string }> }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: type assertion to Record<string, { type: string; name?: string }> might be unsafe. Consider defining a proper type

Comment on lines 120 to +121
isOwner: eq(workspace.ownerId, memberId),
permissionType: permissions.permissionType,
joinedAt: workspaceMember.joinedAt,
createdAt: permissions.createdAt,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding an explicit alias for permissions.createdAt since it's used as both joinedAt and createdAt in the response

Comment on lines +379 to +415
const fetchTemplates = useCallback(async () => {
setIsTemplatesLoading(true)
try {
// Fetch templates from API, ordered by views (most popular first)
const response = await fetch('/api/templates?limit=8&offset=0')

if (!response.ok) {
throw new Error(`Failed to fetch templates: ${response.status}`)
}

const apiResponse = await response.json()

// Map API response to TemplateData format
const fetchedTemplates: TemplateData[] =
apiResponse.data?.map((template: any) => ({
id: template.id,
title: template.name,
description: template.description || '',
author: template.author,
usageCount: formatUsageCount(template.views || 0),
stars: template.stars || 0,
icon: template.icon || 'FileText',
iconColor: template.color || '#6B7280',
state: template.state,
isStarred: template.isStarred || false,
})) || []

setTemplates(fetchedTemplates)
logger.info(`Templates loaded successfully: ${fetchedTemplates.length} templates`)
} catch (error) {
logger.error('Error fetching templates:', error)
// Set empty array on error
setTemplates([])
} finally {
setIsTemplatesLoading(false)
}
}, [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Consider using a type-safe API response interface instead of 'any' for template mapping

Comment on lines +158 to +182
it('should test the full executor flow and see what happens', async () => {
// Mock the necessary functions to avoid actual API calls
const mockInput = {}

try {
// Execute the workflow
const result = await executor.execute('test-workflow-id')

// Check if it's an ExecutionResult (not StreamingExecution)
if ('success' in result) {
// Check if there are any logs that might indicate what happened
if (result.logs) {
}

// The test itself doesn't need to assert anything specific
// We just want to see what the executor does
expect(result.success).toBeDefined()
} else {
expect(result).toBeDefined()
}
} catch (error) {
console.error('Execution error:', error)
// Log the error but don't fail the test - we want to see what happens
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: First test is incomplete - empty if block and no specific assertions. Either add meaningful assertions or remove test.

Comment on lines +185 to +186
// Create a mock context in the exact state after the condition executes
const context = (executor as any).createExecutionContext('test-workflow', new Date())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Using 'as any' to access private method createExecutionContext. Consider making method protected or adding test utilities.

Comment on lines +88 to +93
const flowControlHandles = [
'parallel-start-source',
'parallel-end-source',
'loop-start-source',
'loop-end-source',
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider moving flowControlHandles to a constant or configuration object for better maintainability

Comment on lines +201 to +205
} catch (error) {
logger.warn(`PathTracker check failed for ${blockType} block ${block.id}:`, error)
// Default to true to maintain existing behavior if PathTracker fails
isInActivePath = true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Default to true in error case could mask issues. Consider adding error details to logs

@waleedlatif1 waleedlatif1 merged commit 8f71684 into main Jul 16, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants