Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

waleedlatif1 and others added 10 commits October 1, 2025 19:09
…blished (#1522)

* improvement(db): enforce SSL everywhere where a DB connection is established

* remove extraneous comment
* feat(posthog): added posthog for analytics

* added envvars to env.ts
…code (#1524)

* fix(autolayout): type issue if workflow deployed

* remove dead code hasActiveWebhook field
…ition updates for blocks, edges, & subflows (#1531)

* improvement(performance): remove writes to workflow updated_at on position updates for blocks, edges, & subflows

* update query pattern for logs routes
…rectness (#1521)

* add state sending capability

* progress

* add ability to add title and description to workflow state

* progress in language

* fix

* cleanup code

* fix type issue

* fix subflow deletion case

* Workflow console tool

* fix lint

---------

Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com>
@vercel
Copy link

vercel bot commented Oct 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim (staging) Ready Ready Preview Comment Oct 2, 2025 11:59pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 2, 2025 11:59pm

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 Overview

Summary

This release (v0.4.3) implements significant infrastructure improvements, performance optimizations, and feature enhancements across the Sim platform. The changes span multiple key areas:

PostHog Analytics Integration: Added comprehensive analytics tracking with both client-side (posthog-js) and server-side (posthog-node) packages. The integration includes session recording, heatmaps, performance monitoring, and user identification tied to the session management system. URL rewrites are configured to proxy analytics requests through the application domain to circumvent ad blockers.

Database SSL Enforcement: Implemented SSL configuration across all database connection points in the codebase. The system now supports various PostgreSQL SSL modes (disable, prefer, require, verify-ca, verify-full) with base64-encoded CA certificate support via environment variables. This ensures secure database connections in production environments.

Workflow State Architecture Cleanup: Removed the deprecated hasActiveWebhook field from workflow state management throughout the application. This cleanup eliminates dead code and improves type consistency across workflow operations, including checkpoints, deployments, and collaborative editing.

Performance Optimizations: Enhanced database performance by conditionally updating workflow updated_at timestamps only for non-position operations, reducing database lock contention. The system now handles frequent position updates (during drag operations) without triggering unnecessary database writes.

Enhanced Search Modal: Significantly improved the command palette (Cmd+K) functionality by adding knowledge bases as searchable items, separating blocks from triggers into distinct categories, and removing template functionality. The modal now provides better organization and keyboard navigation.

Copilot Training Improvements: Refactored the JSON sanitization logic for copilot training to use a nested block structure instead of separate arrays/objects. Added comprehensive error tracking capabilities to execution logs, including specific error messages and failing block identification. Enhanced the workflow editing tool with support for subflow operations (insert/extract blocks from loops/parallels).

Knowledge Base Enhancements: Removed restrictive filename validation constraints, allowing more flexible document naming while maintaining essential content validations. Added knowledge bases to the search modal for improved discoverability.

Documentation Updates: Updated Fumadocs dependencies and fixed client-side export issues by switching to Next.js-specific provider imports.

User Experience Improvements: Added preemptive data loading on settings navigation hover, new user preference controls (showFloatingControls, showTrainingControls), and a 'Send Live State' feature in the training modal for direct workflow submission to the copilot training system.

Important Files Changed

Changed Files
Filename Score Overview
apps/sim/package.json 5/5 Added PostHog analytics dependencies and reordered existing packages
apps/sim/app/api/workflows/[id]/route.ts 5/5 Removed deprecated hasActiveWebhook field from workflow state
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/auto-layout.ts 4/5 Fixed type issue by filtering out UI-only deployment fields before database persistence
apps/sim/stores/copilot/store.ts 5/5 Removed hasActiveWebhook from workflow state in checkpoint revert functionality
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/settings-navigation/settings-navigation.tsx 5/5 Added preemptive data loading on hover for better performance
apps/sim/app/api/workflows/yaml/export/route.ts 5/5 Cleaned up workflow state by removing hardcoded hasActiveWebhook field
apps/sim/lib/copilot/registry.ts 4/5 Extended ExecutionEntry schema with error tracking fields for improved debugging
apps/docs/package.json 4/5 Updated Fumadocs dependencies to version 15.8.2
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow.ts 5/5 Removed hasActiveWebhook from CurrentWorkflow interface and hook
apps/sim/stores/workflows/workflow/types.ts 5/5 Removed deprecated hasActiveWebhook and setWebhookStatus from workflow types
apps/sim/app/api/users/me/settings/route.ts 5/5 Added user preference settings for floating and training controls
apps/sim/.env.example 5/5 Added SSL configuration variables for secure database connections
apps/sim/socket-server/rooms/manager.ts 4/5 Implemented SSL configuration for socket server database connections
apps/sim/app/api/copilot/training/examples/route.ts 4/5 New proxy endpoint for workflow training examples with secure authentication
apps/sim/stores/workflows/workflow/store.ts 5/5 Removed webhook-related state management code from workflow store
apps/sim/next.config.ts 5/5 Added PostHog analytics rewrites to proxy requests and avoid ad blockers
apps/docs/app/[lang]/layout.tsx 5/5 Updated Fumadocs import to Next.js-specific provider for build compatibility
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-controls/training-modal.tsx 4/5 Added 'Send Live State' tab for direct workflow submission to training system
apps/sim/lib/copilot/process-contents.ts 5/5 Removed redundant logging statement to reduce log noise
apps/sim/lib/workflows/db-helpers.test.ts 5/5 Cleaned up tests by removing hasActiveWebhook references and implementation details
apps/sim/hooks/use-collaborative-workflow.ts 4/5 Removed hasActiveWebhook from workflow state management during revert operations
apps/sim/app/api/copilot/checkpoints/revert/route.test.ts 4/5 Removed hasActiveWebhook from test mock data across multiple test cases
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/subscription.tsx 4/5 Refactored billing notifications to use centralized Zustand store
apps/sim/contexts/socket-context.tsx 4/5 Removed hasActiveWebhook from workflow state rehydration logic
apps/sim/tools/knowledge/create_document.ts 4/5 Removed restrictive filename validation constraints for document names
apps/sim/lib/env.ts 5/5 Added PostHog and database SSL configuration environment variables
apps/sim/lib/workflows/diff/use-workflow-diff.ts 4/5 Removed hasActiveWebhook from backup and restore operations
apps/sim/socket-server/database/operations.ts 4/5 Added SSL configuration and performance optimization for position updates
packages/db/scripts/deregister-sso-provider.ts 4/5 New administrative script with SSL configuration for SSO provider management
packages/db/scripts/migrate-deployment-versions.ts 4/5 Added SSL configuration support to database migration script
apps/sim/lib/session/session-context.tsx 4/5 Integrated PostHog user identification with session management
apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts 4/5 Enhanced workflow editing with subflow operations and better validation
apps/sim/app/api/copilot/checkpoints/revert/route.ts 5/5 Removed hasActiveWebhook from checkpoint restoration process
apps/sim/lib/copilot/tools/server/workflow/get-workflow-console.ts 4/5 Added comprehensive error handling and reporting capabilities
apps/sim/app/api/workflows/[id]/state/route.ts 4/5 Removed deployment-related fields from workflow state schema
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/diff-controls.tsx 4/5 Removed hasActiveWebhook from checkpoint creation in diff controls
apps/sim/lib/workflows/json-sanitizer.ts 4/5 Major refactor of copilot JSON sanitization with nested structure approach
apps/sim/instrumentation-client.ts 4/5 Added PostHog analytics initialization to client-side telemetry
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx 5/5 Integrated knowledge bases into search modal functionality
apps/sim/lib/workflows/training/compute-edit-sequence.ts 4/5 Refactored edit sequence computation to handle nested block structures
apps/sim/app/workspace/[workspaceId]/w/components/search-modal/search-modal.tsx 4/5 Major refactoring to remove templates and add knowledge bases support
apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts 5/5 Renamed terminology from commonParameters/inputs to inputSchema/inputDefinitions
apps/sim/lib/workflows/db-helpers.ts 4/5 Simplified database helpers and reduced logging noise
packages/db/index.ts 4/5 Added comprehensive SSL configuration for PostgreSQL connections
apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts 4/5 Removed hasActiveWebhook from deployment revert workflow state
apps/sim/lib/copilot/tools/client/workflow/edit-workflow.ts 4/5 Added diff store fallback logic for sequential workflow editing operations
packages/db/scripts/register-sso-provider.ts 5/5 Added SSL configuration support for secure database connections

Confidence score: 4/5

  • This PR includes significant architectural improvements with comprehensive SSL enforcement and performance optimizations that should enhance security and reduce database contention
  • Score reflects the complexity of changes across multiple systems (analytics, database security, workflow state management) which increases the surface area for potential issues
  • Pay close attention to files involving PostHog integration, SSL configuration logic, and workflow state management changes as these touch critical system functionality

Additional Comments (1)

  1. apps/sim/lib/workflows/json-sanitizer.ts, line 33 (link)

    style: CopilotEdge interface is still defined but no longer used after removing edges from CopilotWorkflowState

47 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

</div>
<Switch checked={enabled} onCheckedChange={(v: boolean) => update(v)} />
<Switch
checked={!!enabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The double negation !!enabled is unnecessary since Switch component handles falsy values correctly

Suggested change
checked={!!enabled}
checked={enabled}
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/subscription.tsx
Line: 551:551

Comment:
**style:** The double negation `!!enabled` is unnecessary since Switch component handles falsy values correctly

```suggestion
        checked={enabled}
```

How can I resolve this? If you propose a fix, please make it concise.

/**
* Helper to create a block state from operation params
*/
function createBlockFromParams(blockId: string, params: any, parentId?: string): 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: Function parameter params should have a proper type definition instead of any

Context Used: Context from dashboard - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts
Line: 28:28

Comment:
**style:** Function parameter `params` should have a proper type definition instead of `any`

**Context Used:** Context from `dashboard` - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used... ([source](https://app.greptile.com/review/custom-context?memory=c63aedff-69e6-48d8-81cf-9763416ee01c))

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +77 to +80
function addConnectionsAsEdges(
modifiedState: any,
blockId: string,
connections: Record<string, 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: Parameters modifiedState and connections should have proper type definitions instead of any

Context Used: Context from dashboard - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts
Line: 77:80

Comment:
**style:** Parameters `modifiedState` and `connections` should have proper type definitions instead of `any`

**Context Used:** Context from `dashboard` - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used... ([source](https://app.greptile.com/review/custom-context?memory=c63aedff-69e6-48d8-81cf-9763416ee01c))

How can I resolve this? If you propose a fix, please make it concise.

@waleedlatif1 waleedlatif1 merged commit cae0e85 into main Oct 3, 2025
18 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.

3 participants