Skip to content

chore: update package dependencies and fix schema relations#42

Merged
Vamsi-o merged 1 commit into
mainfrom
workflow-steup
Dec 28, 2025
Merged

chore: update package dependencies and fix schema relations#42
Vamsi-o merged 1 commit into
mainfrom
workflow-steup

Conversation

@TejaBudumuru3

@TejaBudumuru3 TejaBudumuru3 commented Dec 28, 2025

Copy link
Copy Markdown
Contributor
  • Added @prisma/adapter-pg dependency to db package.
  • Updated schema.prisma to correct AvailableNode relation and added isEmpty field to Workflow model.
  • Adjusted tsconfig build info version.
  • Updated pnpm-lock.yaml to reflect new versions for prettier, turbo, and added new dependencies including redux and immer.
  • Updated various packages and their versions in pnpm-lock.yaml to ensure compatibility and stability.

Summary by CodeRabbit

  • New Features

    • Streamlined workflow creation and initialization process with improved empty workflow retrieval for authenticated users
    • Enhanced node and trigger creation workflows with improved validation and data handling
    • Better workflow data fetching capabilities with related triggers and nodes included in responses
  • Chores

    • Updated development dependencies and package manager versions

✏️ Tip: You can customize this high-level summary in your review settings.

- Added @prisma/adapter-pg dependency to db package.
- Updated schema.prisma to correct AvailableNode relation and added isEmpty field to Workflow model.
- Adjusted tsconfig build info version.
- Updated pnpm-lock.yaml to reflect new versions for prettier, turbo, and added new dependencies including redux and immer.
- Updated various packages and their versions in pnpm-lock.yaml to ensure compatibility and stability.
@coderabbitai

coderabbitai Bot commented Dec 28, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request refactors workflow, trigger, and node creation flows by moving execution logic from client-side to backend APIs. It introduces new dedicated endpoints for trigger and node creation, removes client-side Google Sheets route handlers, extends Redux state to track triggers and nodes, and updates database schema field naming for consistency.

Changes

Cohort / File(s) Summary
Backend Route Refactoring
apps/http-backend/src/routes/userRoutes/userRoutes.ts
Renamed routes (/createNode/createAvaliableNode, /createTriggers/createAvaliableTriggers); added new endpoints: POST /create/trigger, POST /create/node, GET /empty/workflow; enhanced existing endpoints to include related Trigger and nodes; integrated GoogleSheetsNodeExecutor for credentials retrieval.
Removed Client-Side Routes
apps/web/app/api/google-sheets/documents/route.ts, apps/web/app/api/google-sheets/tabs/route.ts
Deleted POST endpoint handlers for retrieving Google Sheets documents and tabs; logic migrated to backend.
Frontend Workflow Component Updates
apps/web/app/components/nodes/CreateWorkFlow.tsx
Changed node ID format from "trigger-<id>" to "trigger~<id>" and "action-<id>-<ts>" to "action~<id>"; added workflow initialization flow with getWorkflowData and getEmptyWorkflow; integrated Redux selectors for userId, workflowId, trigger, and nodes; added state tracking for Google Sheet node ID (nodeIDType) and credentials form toggle.
Google Sheets Form Client
apps/web/app/components/nodes/GoogleSheetFormClient.tsx
Extended props to include nodeType; extracted nodeId from nodeType split on "~"; added Redux integration for workflowId; extended config payload with userId, node_Trigger, workflowId, type, and name fields.
Node Action Logic
apps/web/app/components/nodes/actions.ts
Replaced GoogleSheetsNodeExecutor with backend API calls (createTrigger/createNode); updated SaveConfigFormData interface to remove userId and add type, position, name, node_Trigger, workflowId; added conditional flow for trigger vs. node creation.
Workflow API Helpers
apps/web/app/workflow/lib/config.ts
Added new exported functions: createWorkflow, createTrigger, createNode, getEmptyWorkflow, getworkflowData; introduced Triggercontext and Nodecontext interfaces; implemented backend API integration with error handling and logging.
Workflow State Management
apps/web/app/components/nodes/dbHandler.ts, apps/web/store/slices/workflowSlice.ts
Removed getEmptyWorkflow from dbHandler.ts; extended workflowSlice.ts with new Trigger and NodeItem types; added reducers: setWorkflowTrigger, setWorkflowNodes, addWorkflowNode; updated initialState to include trigger and nodes.
Database Schema Updates
packages/db/prisma/schema.prisma
Renamed AvailabeNodeId to AvailableNodeId in Node model; renamed nodes relation to Node in AvailableNode; added isEmpty field (Boolean with default true) to Workflow model.
Type Definitions
packages/common/src/index.ts
Fixed typo in NodeSchema: AvailabeNodeIdAvailableNodeId; removed AvailableTriggerId and AvailableNodes from WorkflowSchema.
Build & Dependency Updates
apps/http-backend/tsconfig.tsbuildinfo, packages/db/tsconfig.tsbuildinfo, apps/web/package.json, packages/db/package.json, package.json
Updated tsconfig build info paths; added immer@^11.1.0 to web dependencies; added @prisma/adapter-pg@^7.2.0 to db dependencies; updated dev dependencies (prettier, turbo) and packageManager in root.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Client as Frontend<br/>(React)
    participant API as Backend API<br/>(userRoutes)
    participant DB as Database<br/>(Prisma)

    autonumber
    User->>Client: Open CreateWorkFlow
    Client->>API: GET /user/empty/workflow
    API->>DB: Query isEmpty=true workflow
    DB-->>API: Return workflow or null
    API-->>Client: Return workflow data
    alt No workflow exists
        Client->>API: POST /user/create/workflow
        API->>DB: Create new Workflow
        DB-->>API: Return created workflow
        API-->>Client: Return workflow_id
    end
    Client->>+Redux: Update workflow state<br/>(id, isEmpty)
    
    User->>Client: Select Google Sheet node
    Client->>Client: Capture nodeIDType<br/>(format: "trigger~id")
    Client->>Client: Show credentials form
    
    User->>Client: Save sheet config
    Client->>Client: Build context<br/>(type, name, workflowId, config)
    alt Type is "trigger"
        Client->>API: POST /user/create/trigger
    else Type is "node"
        Client->>API: POST /user/create/node
    end
    API->>DB: Create Trigger/Node record
    DB-->>API: Return created entity
    API-->>Client: Return { success, data }
    Client->>+Redux: setWorkflowTrigger/<br/>addWorkflowNode
    Client->>User: Show success
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

This PR involves heterogeneous changes across multiple layers (backend routes, frontend components, Redux state, database schema, type definitions). It requires careful review of: (1) backend endpoint contracts and validation, (2) frontend state management and Redux integration, (3) node ID format consistency across client/server, (4) config payload structure changes and their downstream effects, (5) database schema renaming and relation updates, and (6) interaction between multiple new/modified components.

Possibly related PRs

Suggested reviewers

  • Vamsi-o

Poem

🐰 Workflows now flow from server to screen,
Node IDs dance with tildes in between,
Redux remembers triggers and nodes with care,
Empty workflows materialize from thin air!
A schema so clean, a creation so keen!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: update package dependencies and fix schema relations' accurately reflects the main changes: dependency updates (prettier, turbo, immer, @prisma/adapter-pg) and schema relation fixes (AvailableNode field corrections, isEmpty field addition).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch workflow-steup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
apps/web/app/components/nodes/CreateWorkFlow.tsx (1)

122-150: Race condition in useEffect workflow initialization.

The getWorkflowData() call on line 149 uses the workflowId from the closure, which will be null on the first render even after getEmptyWorkflowID() dispatches a new ID. The Redux state update won't be reflected until the next render cycle.

Additionally, there's no cleanup for the async operations, which could cause state updates on unmounted components.

🔎 Proposed fix
   useEffect(()=>{
+    let cancelled = false;
+    
     async function getEmptyWorkflowID(){
       const workflow = await getEmptyWorkflow()
       
-      if(workflow){
+      if(cancelled) return;
+      if(workflow){
         const {id, isEmpty} = workflow
         dispatch(workflowActions.setWorkflowId(id))
         dispatch(workflowActions.setWorkflowStatus(isEmpty))
+        // Fetch workflow data immediately with the known ID
+        if(!isEmpty) {
+          await fetchWorkflowData(id);
+        }
       }
       else{
         if (!userId) return
         const newWorkflow = await createWorkflow(userId)
+        if(cancelled) return;
         dispatch(workflowActions.setWorkflowId(newWorkflow.id))
         dispatch(workflowActions.setWorkflowStatus(newWorkflow.isEmpty))
       }
     }
-    async function getWorkflowData(){
-      if(!workflowId) return
-      const workflow = await getworkflowData(workflowId)
+    async function fetchWorkflowData(id: string){
+      const workflow = await getworkflowData(id)
+      if(cancelled) return;
       if(workflow.success){
         dispatch(workflowActions.setWorkflowStatus(false))
         dispatch(workflowActions.setWorkflowNodes(workflow.data.nodes))
         dispatch(workflowActions.setWorkflowTrigger(workflow.data.Trigger))
       }
     }
-    if(!workflowId) getEmptyWorkflowID()
-    getWorkflowData();
+    if(!workflowId) {
+      getEmptyWorkflowID()
+    } else {
+      fetchWorkflowData(workflowId);
+    }
+    
+    return () => { cancelled = true; }
   },[dispatch, userId, workflowId])
packages/db/package.json (1)

21-25: Upgrade @prisma/client and prisma to v7 to match @prisma/adapter-pg.

@prisma/adapter-pg at v7.2.0 is incompatible with @prisma/client and prisma at v6.19.0. Prisma v7 introduced breaking changes to client instantiation and adapter requirements; using a v7 adapter with v6 client will cause runtime errors.

Upgrade both dependencies to v7:

  "dependencies": {
    "@prisma/adapter-pg": "^7.2.0",
-   "@prisma/client": "^6.19.0",
+   "@prisma/client": "^7.2.0",
    "@types/dotenv": "^8.2.3",
    "dotenv": "^17.2.3",
-   "prisma": "^6.19.0"
+   "prisma": "^7.2.0"
  }
apps/http-backend/src/routes/userRoutes/userRoutes.ts (3)

40-69: Route missing authentication middleware.

The /createAvaliableNode route (line 40) does not use userMiddleware, unlike /createAvaliableTriggers (line 96) which does. This inconsistency could be a security gap if this route should also be protected.

Also, "Avaliable" is misspelled (should be "Available").

🔎 Suggested fix
-router.post("/createAvaliableNode", async (req: AuthRequest, res: Response) => {
+router.post("/createAvailableNode", userMiddleware, async (req: AuthRequest, res: Response) => {

317-320: Incorrect HTTP status code for authorization failure.

Line 319 returns BAD_GATEWAY (502) when the user is not logged in. This should be UNAUTHORIZED (401) to properly indicate an authentication/authorization issue. BAD_GATEWAY indicates an upstream server error, which is misleading here.

🔎 Suggested fix
       if (!req.user)
         return res
-          .status(statusCodes.BAD_GATEWAY)
+          .status(statusCodes.UNAUTHORIZED)
           .json({ message: "User isnot logged in /not authorized" });

134-138: Same status code issue: BAD_GATEWAY used for auth failure.

Similar to the workflow route, this should use UNAUTHORIZED (401) instead of BAD_GATEWAY (502).

🔎 Suggested fix
       if (!req.user)
         return res
-          .status(statusCodes.BAD_GATEWAY)
+          .status(statusCodes.UNAUTHORIZED)
           .json({ message: "User isnot logged in /not authorized" });
🧹 Nitpick comments (12)
packages/common/src/index.ts (1)

4-4: Hardcoded localhost URL.

The BACKEND_URL is hardcoded to http://localhost:3002. Consider using an environment variable to support different deployment environments (development, staging, production).

🔎 Suggested improvement
-export const BACKEND_URL="http://localhost:3002";
+export const BACKEND_URL = process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:3002";
apps/web/store/slices/workflowSlice.ts (1)

3-18: Well-structured type definitions.

The new Trigger and NodeItem interfaces properly model the workflow data structure. The Nodes type alias provides clarity.

Consider replacing config: any with a more specific type or Record<string, unknown> for better type safety:

 interface Trigger {
     dbId: string;
     name: string;
     type: string;
-    config: any;
+    config: Record<string, unknown>;
 }
packages/db/prisma/schema.prisma (1)

57-57: Relation field naming convention.

The relation field was renamed from nodes to Node. While this works, Prisma conventions typically use camelCase for relation fields (e.g., nodes) and PascalCase for model names. Consider keeping nodes for consistency with other relations in the schema (e.g., triggers, credentials, workflows).

apps/web/app/components/nodes/CreateWorkFlow.tsx (1)

246-248: Toggle pattern may cause unexpected behavior.

Using setLoadSheet(!loadSheet) toggles the sheet visibility, but clicking the same Google Sheet node twice will hide the form. If the intent is to always show the form when a Google Sheet node is clicked, consider using setLoadSheet(true) instead.

               setNodeIDType(node.id)
               setCredType(node.data.type === "google_sheet" ? "google_oauth" : "")
-              setLoadSheet(!loadSheet)
+              setLoadSheet(true)
apps/web/app/components/nodes/actions.ts (2)

4-17: Clean up commented code.

The commented userId field and other remnants should be fully removed rather than left as comments. This improves code readability and maintenance.

🔎 Proposed cleanup
 interface SaveConfigFormData {
-  // userId: string;
   type: string
   credentialId: string;
   spreadsheetId: string;
   sheetName: string;
   operation: string;
   range: string;
   position?: number;
   name: string;
   node_Trigger: string;
   workflowId: string;
-
 }

54-63: Remove commented-out code.

The old executor implementation should be removed rather than left commented. Version control preserves history if this code is needed later.

-  // const result = await executor.execute(context);
-  
-  // // Return plain object (not class instance)
-  // return {
-  //   success: result.success,
-  //   output: result.output || null,
-  //   error: result.error || null,
-  //   authUrl: result.authUrl || null,
-  //   requiresAuth: result.requiresAuth || false,
-  // };
apps/web/app/components/nodes/GoogleSheetFormClient.tsx (3)

15-25: Unused interface and unconventional parameter naming.

The GoogleSheetFormClientProps interface (lines 15-23) is defined but never used since the function signature at line 25 uses a different parameter structure. This is dead code that should be removed or the function should be updated to use the interface.

Additionally, the parameter naming type:{type: string, nodeType: string} is confusing as type is used both as the parameter name and a property name.

🔎 Suggested cleanup
-interface GoogleSheetFormClientProps {
-  initialData: {
-    credentials: Array<{ id: string }>;
-    authUrl?: string;
-    hasCredentials: boolean;
-  };
-  userId: string;
-  nodeId: string;
-}
+interface GoogleSheetFormClientProps {
+  type: string;
+  nodeType: string;
+}

-export function GoogleSheetFormClient(type:{type: string, nodeType: string}) {
+export function GoogleSheetFormClient({ type, nodeType }: GoogleSheetFormClientProps) {

149-153: Error toast displays raw error data.

On line 152, res.data is displayed in the error toast. Based on the createTrigger/createNode return shape in config.ts, this will show the error message string. However, the variable name res.data is misleading since it contains an error message on failure. Consider using a more descriptive property name or extracting a user-friendly message.

🔎 Suggested improvement
      if (res.success) {
        toast.success("Configuration saved!");
      } else {
-       toast.error(res.data);
+       toast.error(res.error || "Failed to save configuration");
      }

This would require updating the return type in actions.ts to use error instead of data for failure cases.


40-40: Remove debug console.log statements before merging.

Multiple console.log statements are present for debugging purposes (lines 40, 48, 50-51, and others throughout the file). These should be removed or converted to a proper logging utility before merging to production.

Also applies to: 48-48, 50-51

apps/web/app/workflow/lib/config.ts (2)

50-72: Inconsistent error handling patterns across functions.

The functions have inconsistent error handling:

  • createWorkflow, getEmptyWorkflow: throw errors
  • createTrigger, createNode, getworkflowData: return {success, data} objects

This inconsistency forces callers to handle errors differently depending on which function they call. Consider standardizing on one approach (preferably the {success, data} pattern for better error propagation to the UI).

Also applies to: 87-116, 132-161, 163-176


74-86: Consider exporting interfaces for reuse.

The Triggercontext and Nodecontext interfaces are defined but not exported. If these types are needed by consumers of createTrigger and createNode, they should be exported.

🔎 Suggested change
-interface Triggercontext{
+export interface Triggercontext{
-interface Nodecontext{
+export interface Nodecontext{

Also applies to: 118-131

apps/http-backend/src/routes/userRoutes/userRoutes.ts (1)

96-128: Typo in route name: "Avaliable" should be "Available".

For API consistency and discoverability, consider fixing the typo.

🔎 Suggested fix
-router.post("/createAvaliableTriggers",
+router.post("/createAvailableTriggers",
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae2bc6a and 81945da.

⛔ Files ignored due to path filters (2)
  • packages/db/package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • apps/http-backend/src/routes/userRoutes/userRoutes.ts
  • apps/http-backend/tsconfig.tsbuildinfo
  • apps/web/app/api/google-sheets/documents/route.ts
  • apps/web/app/api/google-sheets/tabs/route.ts
  • apps/web/app/components/nodes/CreateWorkFlow.tsx
  • apps/web/app/components/nodes/GoogleSheetFormClient.tsx
  • apps/web/app/components/nodes/actions.ts
  • apps/web/app/workflow/lib/config.ts
  • apps/web/app/workflow/lib/dbHandler.ts
  • apps/web/package.json
  • apps/web/store/slices/workflowSlice.ts
  • package.json
  • packages/common/src/index.ts
  • packages/db/package.json
  • packages/db/prisma/schema.prisma
  • packages/db/tsconfig.tsbuildinfo
💤 Files with no reviewable changes (3)
  • apps/web/app/workflow/lib/dbHandler.ts
  • apps/web/app/api/google-sheets/documents/route.ts
  • apps/web/app/api/google-sheets/tabs/route.ts
🧰 Additional context used
🧬 Code graph analysis (4)
apps/web/app/components/nodes/actions.ts (1)
apps/web/app/workflow/lib/config.ts (2)
  • createTrigger (87-116)
  • createNode (132-161)
apps/web/app/components/nodes/GoogleSheetFormClient.tsx (1)
apps/web/app/hooks/redux.ts (1)
  • useAppSelector (7-7)
apps/http-backend/src/routes/userRoutes/userRoutes.ts (3)
apps/http-backend/src/routes/userRoutes/userMiddleware.ts (2)
  • AuthRequest (8-10)
  • userMiddleware (18-42)
packages/common/src/index.ts (3)
  • AvailableNodes (13-18)
  • TriggerSchema (20-26)
  • NodeSchema (28-34)
packages/db/src/index.ts (1)
  • prismaClient (17-18)
apps/web/app/components/nodes/CreateWorkFlow.tsx (3)
apps/web/app/hooks/redux.ts (1)
  • useAppSelector (7-7)
apps/web/app/workflow/lib/config.ts (2)
  • createWorkflow (50-72)
  • getworkflowData (178-194)
apps/web/app/components/nodes/GoogleSheetFormClient.tsx (1)
  • GoogleSheetFormClient (25-308)
🔇 Additional comments (9)
packages/db/tsconfig.tsbuildinfo (1)

1-1: No action required. The tsbuildinfo version 5.7.3 correctly matches the TypeScript version specified in the root package.json, confirming the downgrade is intentional and consistent with the project's compiler configuration.

package.json (1)

14-18: LGTM!

Standard dev tooling version bumps for prettier, turbo, and pnpm. These updates should improve developer experience and maintain compatibility with latest features.

apps/web/store/slices/workflowSlice.ts (1)

36-55: LGTM!

The reducers are well-implemented. Redux Toolkit's Immer integration allows the mutable syntax (e.g., state.nodes.push()) while maintaining immutability under the hood. The clearWorkflow reducer correctly returns initialState to reset state.

packages/db/prisma/schema.prisma (1)

60-71: LGTM! Schema field naming corrected.

The AvailableNodeID field name fix aligns with the common package schema changes. The relation setup between Node and AvailableNode is correctly configured.

apps/web/app/components/nodes/actions.ts (1)

19-33: LGTM! Clean refactoring to backend-driven workflow.

The context object construction properly maps form data to the backend API expectations. The separation of trigger vs node creation logic is clear.

packages/common/src/index.ts (2)

37-42: No action needed—removed fields are not referenced in the codebase.

The AvailableTriggerId and AvailableNodes fields have been successfully removed from WorkflowSchema. A comprehensive search confirms no remaining code attempts to access these fields on workflow objects. WorkflowSchema is currently used only for validation in the backend user routes with the correct fields (Name, UserId, Config).


28-34: Typo fix confirmed: Field name AvailabeNodeIdAvailableNodeId is complete and all consumers updated.

All instances of the old misspelled field name have been corrected. The schema uses AvailableNodeId consistently across AvailableNodes (line 15) and NodeSchema (line 30), and the web app consumer at apps/web/app/workflow/lib/config.ts:139 correctly references the fixed field name.

Note: The backend code at apps/http-backend/src/routes/userRoutes/userRoutes.ts:420 uses AvailableNodeID (uppercase ID) instead of AvailableNodeId. Verify this capitalization inconsistency is intentional, or align it with the schema.

apps/web/app/components/nodes/CreateWorkFlow.tsx (1)

79-79: ID format change is consistent across the codebase.

The node ID format change from trigger-${id} to trigger~${id} is properly applied. Both trigger nodes (line 79) and action nodes (line 160) use the new tilde separator, and the parsing code in GoogleSheetFormClient.tsx correctly splits on the tilde character. No active code references the old dash separator format.

apps/http-backend/src/routes/userRoutes/userRoutes.ts (1)

329-332: Good addition: Including related data in workflow query.

The inclusion of Trigger and nodes (ordered by position) in the workflow query is a good optimization, reducing the need for multiple API calls to fetch related data.

Comment on lines +377 to +388
if(createdTrigger){
return res.status(statusCodes.CREATED).json({
message: "Trigger created",
data: createdTrigger
})
}
}catch(e){
console.log("This is the error from Trigger creatig", e);
return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
message: "Internal server Error from Trigger creation ",
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing response when trigger creation returns falsy value.

If createdTrigger is falsy (e.g., null or undefined), the route handler doesn't send a response, leaving the client hanging. While Prisma typically throws on failure, this is still a defensive coding gap.

🔎 Suggested fix
       if(createdTrigger){
         return res.status(statusCodes.CREATED).json({
           message: "Trigger created",
           data: createdTrigger
         })
       }
+      return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
+        message: "Failed to create trigger"
+      });
     }catch(e){
🤖 Prompt for AI Agents
In apps/http-backend/src/routes/userRoutes/userRoutes.ts around lines 377 to
388, the handler returns a response only when createdTrigger is truthy and
leaves the client hanging when it's falsy; add an explicit else branch (or an
early return after the if) that sends an appropriate HTTP response (e.g., 500
INTERNAL_SERVER_ERROR or 400/404 with a clear message) when createdTrigger is
null/undefined, and ensure the catch block still logs the error and returns a
500 — keep responses consistent with existing statusCodes.

Comment on lines +427 to +437
if(createdNode)
return res.status(statusCodes.CREATED).json({
message: "Node created",
data: createdNode
})
}catch(e){
console.log("This is the error from Node creating", e);
return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
message: "Internal server Error from Node creation",
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing response when node creation returns falsy value.

Same issue as with trigger creation - if createdNode is falsy, no response is sent.

🔎 Suggested fix
     if(createdNode) 
       return res.status(statusCodes.CREATED).json({
         message: "Node created",
         data: createdNode
       })
+    return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
+      message: "Failed to create node"
+    });
   }catch(e){
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(createdNode)
return res.status(statusCodes.CREATED).json({
message: "Node created",
data: createdNode
})
}catch(e){
console.log("This is the error from Node creating", e);
return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
message: "Internal server Error from Node creation",
});
}
if(createdNode)
return res.status(statusCodes.CREATED).json({
message: "Node created",
data: createdNode
})
return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
message: "Failed to create node"
});
}catch(e){
console.log("This is the error from Node creating", e);
return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
message: "Internal server Error from Node creation",
});
}
🤖 Prompt for AI Agents
In apps/http-backend/src/routes/userRoutes/userRoutes.ts around lines 427-437,
the handler currently only returns a response when createdNode is truthy and
falls through silently when createdNode is falsy; update the control flow to
handle the falsy case by returning an appropriate HTTP response (e.g.,
res.status(statusCodes.BAD_REQUEST).json({ message: "Node not created" }) or
other domain-appropriate status) so the client always receives a response, and
optionally include minimal context or validation errors in the body; ensure you
do not leave an unhandled code path after the try block.

@@ -1 +1 @@
{"root":["./src/index.ts","./src/routes/nodes.routes.ts","./src/routes/userRoutes/userMiddleware.ts","./src/routes/userRoutes/userRoutes.ts"],"version":"5.7.3"} No newline at end of file
{"root":["./src/index.ts","./src/routes/google_callback.ts","./src/routes/nodes.routes.ts","./src/routes/userroutes/usermiddleware.ts","./src/routes/userroutes/userroutes.ts"],"version":"5.7.3"} No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# 1. Find any imports still referencing old casing patterns
echo "=== Checking for old casing in imports ==="
rg -i "from.*['\"].*userRoutes|from.*['\"].*userMiddleware|import.*['\"].*userRoutes|import.*['\"].*userMiddleware" --type=ts --type=js apps/http-backend/ 2>/dev/null || echo "No matches found for old casing"

echo ""
echo "=== Checking for imports of routes (any casing) ==="
rg "from.*['\"].*userroute|from.*['\"].*usermiddleware|import.*userroute|import.*usermiddleware" --type=ts --type=js apps/http-backend/ 2>/dev/null | head -20 || echo "No matches found"

# 2. Verify google_callback.ts exists
echo ""
echo "=== Checking for google_callback.ts ==="
fd "google_callback.ts" apps/http-backend/ 2>/dev/null || echo "google_callback.ts not found"

# 3. Verify the new userroutes directory structure
echo ""
echo "=== Checking userroutes directory structure ==="
fd "userroutes" apps/http-backend/src/ 2>/dev/null || echo "userroutes directory not found"

# 4. Check if old casing directory exists
echo ""
echo "=== Checking if old userRoutes directory still exists ==="
fd "userRoutes" apps/http-backend/src/ 2>/dev/null || echo "userRoutes directory not found"

# 5. List actual files in src/routes/
echo ""
echo "=== Contents of src/routes/ directory ==="
ls -la apps/http-backend/src/routes/ 2>/dev/null || echo "Directory not found"

Repository: Dev-Pross/BuildFlow

Length of output: 1344


🏁 Script executed:

#!/bin/bash

echo "=== Verifying source files referenced in tsconfig.tsbuildinfo ==="
cd apps/http-backend || exit

# Check each file mentioned in tsconfig.tsbuildinfo
echo "1. Checking ./src/index.ts:"
test -f src/index.ts && echo "✓ exists" || echo "✗ not found"

echo "2. Checking ./src/routes/google_callback.ts:"
test -f src/routes/google_callback.ts && echo "✓ exists" || echo "✗ not found"

echo "3. Checking ./src/routes/nodes.routes.ts:"
test -f src/routes/nodes.routes.ts && echo "✓ exists" || echo "✗ not found"

echo "4. Checking ./src/routes/userroutes/usermiddleware.ts:"
test -f src/routes/userroutes/usermiddleware.ts && echo "✓ exists" || echo "✗ not found"

echo "5. Checking ./src/routes/userroutes/userroutes.ts:"
test -f src/routes/userroutes/userroutes.ts && echo "✓ exists" || echo "✗ not found"

echo ""
echo "=== Full directory tree of src/routes ==="
find src/routes -type f -name "*.ts" | sort

Repository: Dev-Pross/BuildFlow

Length of output: 576


Critical: tsconfig.tsbuildinfo references non-existent file paths — build will fail.

The auto-generated tsconfig.tsbuildinfo declares source roots using lowercase paths (userroutes/usermiddleware.ts, userroutes/userroutes.ts) that do not exist in the actual source tree. The directories and files remain in the original camelCase (userRoutes/userMiddleware.ts). Additionally, all source file imports still reference the old camelCase paths:

  • nodes.routes.ts and google_callback.ts import from ./userRoutes/userMiddleware.js
  • userRoutes/userRoutes.ts imports from ./userMiddleware.js
  • index.ts imports from ./routes/userRoutes/userRoutes.js

This mismatch will cause TypeScript compilation to fail. Either rename the actual directories/files to lowercase and update all imports, or revert the case changes in tsconfig.tsbuildinfo to match the current source structure.

🤖 Prompt for AI Agents
In apps/http-backend/tsconfig.tsbuildinfo around line 1, the buildinfo lists
source root paths using lowercase `userroutes/*` that don't match the actual
camelCase files (`userRoutes/userMiddleware.ts`, `userRoutes/userRoutes.ts`),
causing the build to fail; fix by either (A) reverting the entries in
tsconfig.tsbuildinfo to the correct camelCase paths to match the real files, or
(B) delete tsconfig.tsbuildinfo and run a clean TypeScript build so the
.tsbuildinfo is regenerated with the correct paths; after that verify and, if
needed, update any import statements in src files to consistently use the actual
camelCase paths (or alternatively rename the filesystem to the lowercase names
if you prefer that canonicalization), then re-run the build to confirm the issue
is resolved.

Comment on lines +34 to +51
if(formData.type === 'trigger')
{
const trigger = await createTrigger(context)
console.log('triggger created using config backend: ',trigger)

return{
success: trigger.success,
data: trigger.data
}
}
else{
const node = await createNode({...context, position: formData.position ? formData.position : 0})
console.log('NOde created using config backend: ',node);
return {
success:node.success,
data: node.data
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug console.log statements.

The console.log statements on lines 37 and 46 should be removed or replaced with a proper logging mechanism for production.

   if(formData.type === 'trigger')
   {
     const trigger = await createTrigger(context)
-    console.log('triggger created using config backend: ',trigger)
     
       return{
         success: trigger.success,
         data: trigger.data
       }
   }
   else{
     const node = await createNode({...context, position: formData.position ? formData.position : 0})
-    console.log('NOde created using config backend: ',node);
     return {
       success:node.success,
       data: node.data 
     }
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(formData.type === 'trigger')
{
const trigger = await createTrigger(context)
console.log('triggger created using config backend: ',trigger)
return{
success: trigger.success,
data: trigger.data
}
}
else{
const node = await createNode({...context, position: formData.position ? formData.position : 0})
console.log('NOde created using config backend: ',node);
return {
success:node.success,
data: node.data
}
}
if(formData.type === 'trigger')
{
const trigger = await createTrigger(context)
return{
success: trigger.success,
data: trigger.data
}
}
else{
const node = await createNode({...context, position: formData.position ? formData.position : 0})
return {
success:node.success,
data: node.data
}
}
🤖 Prompt for AI Agents
In apps/web/app/components/nodes/actions.ts around lines 34 to 51, remove the
two debug console.log statements on lines 37 and 46 (the "triggger created..."
and "NOde created..." logs); either delete them or replace them with the app's
production logger call (e.g., logger.info/debug) consistent with the project's
logging utility, preserving existing return behavior and ensuring no leftover
debug prints remain.

const workflowId = useAppSelector(s=>s.workflow.workflow_id)
const existingTrigger = useAppSelector(s=>s.workflow.trigger?.name)
const existingNodes = useAppSelector(s=>s.workflow.nodes)
console.log(`workflow from redux, TRigger: ${existingTrigger}, Nodes: ${existingNodes}`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug console.log before merging.

This logging statement should be removed or guarded behind a debug flag for production builds.

-  console.log(`workflow from redux, TRigger: ${existingTrigger}, Nodes: ${existingNodes}`)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(`workflow from redux, TRigger: ${existingTrigger}, Nodes: ${existingNodes}`)
🤖 Prompt for AI Agents
In apps/web/app/components/nodes/CreateWorkFlow.tsx around line 49, there is a
debug console.log: remove this console.log statement (or wrap it behind a
development-only guard) before merging; replace with a logger that respects
environment (e.g., only run when process.env.NODE_ENV !== 'production') or
delete the line entirely to avoid leaking debug output in production.

Comment on lines +42 to +46
const nodeType = type.nodeType.split("~")[0] || ""
console.log('checking nodeType: ', nodeType);

const nodeId = type.nodeType.split("~")[1] || ""
console.log('checking node id: ',nodeId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Potential silent failure when parsing nodeType.

If type.nodeType doesn't contain a "~" character, split("~")[1] will return undefined, which then falls back to an empty string. This could lead to silent failures when creating nodes/triggers with an empty nodeId.

Consider adding validation or logging a warning when the expected format is not met.

🔎 Suggested improvement
  const nodeType = type.nodeType.split("~")[0] || ""
- console.log('checking nodeType: ', nodeType);
- 
- const nodeId = type.nodeType.split("~")[1] || ""
- console.log('checking node id: ',nodeId)
+ const nodeId = type.nodeType.split("~")[1] || ""
+ 
+ if (!nodeId) {
+   console.warn('nodeId could not be parsed from nodeType:', type.nodeType);
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const nodeType = type.nodeType.split("~")[0] || ""
console.log('checking nodeType: ', nodeType);
const nodeId = type.nodeType.split("~")[1] || ""
console.log('checking node id: ',nodeId)
const nodeType = type.nodeType.split("~")[0] || ""
const nodeId = type.nodeType.split("~")[1] || ""
if (!nodeId) {
console.warn('nodeId could not be parsed from nodeType:', type.nodeType);
}
🤖 Prompt for AI Agents
In apps/web/app/components/nodes/GoogleSheetFormClient.tsx around lines 42–46,
the code assumes type.nodeType contains a "~" and silently uses an empty string
when split("[~]")[1] is undefined; add a validation step that checks
type.nodeType includes("~") (or that split result has length >= 2) before
extracting nodeId, and if the format is invalid log a clear warning
(console.warn or the app logger) that includes the offending type.nodeType and
return/handle early or set nodeId to null so downstream code doesn't silently
proceed with an empty id.

Comment on lines +47 to +54
const date = new Date()


export const createWorkflow = async(userId: string)=>{
try{
const response = await axios.post(`${BACKEND_URL}/user/create/workflow`,
{
Name:`workflow-${date.getTime()}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Bug: Module-level date causes incorrect workflow names.

The date constant is defined at module load time (line 47), meaning all workflows created during the same session will have the same timestamp in their name. This should be moved inside the createWorkflow function.

🔎 Proposed fix
-const date = new Date()
-
-
 export const createWorkflow = async(userId: string)=>{
     try{
+      const date = new Date()
       const response = await axios.post(`${BACKEND_URL}/user/create/workflow`,
         {
           Name:`workflow-${date.getTime()}`,
🤖 Prompt for AI Agents
In apps/web/app/workflow/lib/config.ts around lines 47 to 54, the module-level
const date is created once at import time so every created workflow in the same
session gets the same timestamped name; move the date creation inside
createWorkflow so a fresh timestamp is generated per call (e.g., compute
Date.now() or new Date().getTime() just before building the Name), update the
axios.post payload to use that local timestamped name, and remove the now-unused
module-level date constant.

Comment on lines +188 to +192
}catch(e){
console.error("Error in creating Node:", e);
return {success: false,
data: e instanceof Error ? e.message : `unknown error ${e}`
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Copy-paste error in error message.

The error message at line 189 says "Error in creating Node" but this function is getworkflowData, which fetches workflow data. This appears to be a copy-paste error from the createNode function.

🔎 Proposed fix
   }catch(e){
-    console.error("Error in creating Node:", e);
+    console.error("Error in fetching workflow data:", e);
     return {success: false,
       data: e instanceof Error ? e.message : `unknown error ${e}` 
     };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
}catch(e){
console.error("Error in creating Node:", e);
return {success: false,
data: e instanceof Error ? e.message : `unknown error ${e}`
};
}catch(e){
console.error("Error in fetching workflow data:", e);
return {success: false,
data: e instanceof Error ? e.message : `unknown error ${e}`
};
🤖 Prompt for AI Agents
In apps/web/app/workflow/lib/config.ts around lines 188 to 192, the catch block
logs "Error in creating Node" which is a copy-paste leftover from createNode;
change the log and returned message to accurately reflect this function (e.g.,
"Error fetching workflow data" or "Error in getWorkflowData") and keep the
existing error object handling/return shape unchanged so the error message and
console output correctly describe the failure context.

Comment thread apps/web/package.json
"client-only": "^0.0.1",
"fetch": "link:@trpc/server/adapters/fetch",
"googleapis": "^166.0.0",
"immer": "^11.1.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for direct immer imports/usage outside of RTK
echo "=== Searching for direct immer imports ==="
rg -n "from ['\"]immer['\"]" --type ts --type tsx
echo "=== Searching for require immer ==="
rg -n "require\(['\"]immer['\"]" --type ts --type tsx
echo "=== Searching for produce() function calls ==="
rg -nP "\bproduce\s*\(" --type ts --type tsx -g '!node_modules/**'

Repository: Dev-Pross/BuildFlow

Length of output: 289


🏁 Script executed:

#!/bin/bash
# Search for direct immer imports/usage - broader approach
echo "=== Searching for immer imports in all files ==="
rg -n "from ['\"]immer['\"]"
echo "=== Searching for require immer ==="
rg -n "require\(['\"]immer['\"]"
echo "=== Searching for produce() function calls ==="
rg -n "\bproduce\s*\(" --type ts
echo "=== Check if immer is listed in package.json dependencies ==="
rg -n "immer" apps/web/package.json

Repository: Dev-Pross/BuildFlow

Length of output: 283


Remove redundant immer dependency.

immer is not used directly anywhere in the codebase. Redux Toolkit already provides Immer internally through createSlice reducers, making this a separate dependency unnecessary. Removing it will reduce bundle size and maintenance overhead.

🤖 Prompt for AI Agents
In apps/web/package.json at line 29, remove the redundant "immer": "^11.1.0"
dependency entry; then run your package manager (npm uninstall immer or yarn
remove immer) to update package.json and the lockfile, reinstall dependencies,
and run the test/build and a project-wide search to confirm no direct imports of
immer remain before committing.

config Json
updatedAt DateTime @updatedAt
status WorkflowStatus?
isEmpty Boolean? @default(true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's look at the schema.prisma file around line 82 to confirm the isEmpty field
echo "=== Checking schema.prisma around line 82 ==="
sed -n '75,95p' packages/db/prisma/schema.prisma

echo ""
echo "=== Checking for Prisma migrations directory ==="
ls -la packages/db/prisma/migrations/ 2>/dev/null | head -20

Repository: Dev-Pross/BuildFlow

Length of output: 995


🏁 Script executed:

#!/bin/bash
# Check for migration files and their content
echo "=== Finding migration files with isEmpty ==="
fd -t f . packages/db/prisma/migrations -e sql 2>/dev/null | while read file; do
  if rg -l "isEmpty" "$file" 2>/dev/null; then
    echo "Found in: $file"
    echo "Content:"
    cat "$file"
    echo ""
  fi
done

echo "=== Finding migration files with AvailableNodeID ==="
fd -t f . packages/db/prisma/migrations -e sql 2>/dev/null | while read file; do
  if rg -l "AvailableNodeID" "$file" 2>/dev/null; then
    echo "Found in: $file"
    echo "Content:"
    cat "$file"
    echo ""
  fi
done

Repository: Dev-Pross/BuildFlow

Length of output: 160


Prisma migration required for isEmpty field in Workflow model.

The isEmpty field has been added to the schema, but no corresponding Prisma migration file exists in packages/db/prisma/migrations/. The directory contains only migration_lock.toml with no SQL migration files. Create and apply a migration to add the isEmpty column to the Workflow table:

npx prisma migrate dev --name add_isEmpty_to_workflow

Without this migration, the database schema won't be updated and the application will fail when accessing the new field.

🤖 Prompt for AI Agents
In packages/db/prisma/schema.prisma around line 82 the optional Boolean field
`isEmpty` was added to the Workflow model but no migration exists; generate and
apply a Prisma migration to add the column to the database by running the
migration command (e.g., `npx prisma migrate dev --name
add_isEmpty_to_workflow`) from the packages/db directory, commit the new
migration folder under packages/db/prisma/migrations, and ensure any affected
TypeScript types are regenerated (e.g., `npx prisma generate`) and tests or
startup scripts run to verify the DB schema is updated.

@Vamsi-o
Vamsi-o merged commit 206d0ce into main Dec 28, 2025
2 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