fix(automations): remap all branch path IDs in ImportFlowModal and guard deleteFolder against parentId cycles

Abierto
#54 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript

Línea de trabajo

Start in ImportFlowModal.tsx at handlePerformImport and in automations.service.ts at deleteFolder. Trace the existing idMap remapping and recursive folder traversal, then check how branch references and folder children are represented. Done means every listed branch target is remapped and folder deletion safely handles cycles and the stated depth limit.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

backend bug good first issue ui web
Problem Description
  1. ImportFlowModal leaves dangling node IDs on imported flows:
    In apps/web/app/dashboard/[companyId]/automation/[automationId]/components/ImportFlowModal.tsx (lines 261-287), handlePerformImport generates new node IDs (idMap) and remaps conditionPaths, randomPaths, and splitBranches.
    However, it fails to remap buttonPaths, defaultPath, agentBranchPaths, scoringPaths, vipNextNodeId, and normalNextNodeId. Any imported flow using buttons, AI Agent branches, or profile scoring branches retains stale node IDs and breaks when executed.

  2. deleteFolder lacks cycle/depth protection:
    In apps/api/src/automations/automations.service.ts (deleteFolder, lines 88-100), findChildrenRecursive traverses child folders without a visited set or depth limit. If any parentId cycle exists in the database, deleting a folder enters an infinite async loop.


Expected Behavior
  1. All branch target references in an imported flow (buttonPaths, defaultPath, agentBranchPaths, scoringPaths, vipNextNodeId, normalNextNodeId, as well as conditionPaths, randomPaths, and splitBranches) are remapped via idMap.
  2. findChildrenRecursive in deleteFolder tracks visited folder IDs and enforces a max depth so cycles cannot hang the API.

Where to Look
  • apps/web/app/dashboard/[companyId]/automation/[automationId]/components/ImportFlowModal.tsx (handlePerformImport, lines 261-287)
  • apps/api/src/automations/automations.service.ts (deleteFolder, lines 88-100)

Solution / Implementation Guide
  1. In ImportFlowModal.tsx:
    • Remap buttonPaths, agentBranchPaths, and scoringPaths (mapping each path's target node ID through idMap).
    • Remap defaultPath, vipNextNodeId, and normalNextNodeId through idMap when present.
  2. In automations.service.ts (deleteFolder):
    • Pass a visited = new Set<string>() and depth = 0 (e.g., max depth 50) into findChildrenRecursive, skipping any folder ID already in visited.
Lenguaje dominante
TypeScript
Estrellas
2
Forks
1
Merge medio
6 min
PR fusionados (30 d)
27

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sumamakhan761/tryinstance

Todos los issues de sumamakhan761/tryinstance

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.