Skip to content

Commit 512c6e0

Browse files
author
Agent-Planner
committed
Fix CodeRabbit AI issues and line endings
- Add arrow function export detection in react_analyzer.py - Preserve NOT NULL/DEFAULT constraints in migrations.py - Add DuckDNS subdomain validation in deploy.sh - Add directory existence check in cicd.py - Fix missing logger import and unsorted imports in projects.py - Remove trailing whitespace in process_manager.py and websocket.py - Add 'error' to Step type in ImportProjectModal.tsx - Convert deploy.sh to Unix LF line endings
1 parent dd9be6b commit 512c6e0

8 files changed

Lines changed: 35 additions & 15 deletions

File tree

analyzers/react_analyzer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,11 @@ def _parse_app_router_api(self, route_file: Path, api_dir: Path) -> list[Endpoin
362362
methods = []
363363
if content:
364364
for method in ["GET", "POST", "PUT", "PATCH", "DELETE"]:
365-
if f"export async function {method}" in content or \
366-
f"export function {method}" in content:
365+
# Match: export function METHOD, export async function METHOD
366+
# Match: export const METHOD = (async )?(
367+
if (f"export async function {method}" in content or
368+
f"export function {method}" in content or
369+
f"export const {method}" in content):
367370
methods.append(method)
368371

369372
if not methods:

api/migrations.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,19 @@ def migrate_add_testing_columns(engine) -> None:
9393
optional_columns = []
9494
for col_name, col_info in columns.items():
9595
if col_name not in core_columns:
96-
# Preserve the column with its type
97-
col_type = col_info["type"]
98-
optional_columns.append((col_name, col_type))
96+
# Preserve full column definition
97+
optional_columns.append((col_name, col_info))
9998

10099
# Build dynamic column definitions for optional columns
101100
optional_col_defs = ""
102101
optional_col_names = ""
103-
for col_name, col_type in optional_columns:
104-
optional_col_defs += f",\n {col_name} {col_type}"
102+
for col_name, col_info in optional_columns:
103+
col_def = f"{col_name} {col_info['type']}"
104+
if col_info["notnull"]:
105+
col_def += " NOT NULL"
106+
if col_info.get("dflt_value") is not None:
107+
col_def += f" DEFAULT {col_info['dflt_value']}"
108+
optional_col_defs += f",\n {col_def}"
105109
optional_col_names += f", {col_name}"
106110

107111
# Step 1: Create new table without NOT NULL on testing columns

deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ derive_duckdns_subdomain() {
7171
else
7272
DUCKDNS_SUBDOMAIN="${DOMAIN}"
7373
fi
74+
75+
# Validate subdomain contains only allowed characters (alphanumeric and hyphens)
76+
if ! [[ "${DUCKDNS_SUBDOMAIN}" =~ ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$ ]]; then
77+
echo "Invalid DuckDNS subdomain '${DUCKDNS_SUBDOMAIN}'. Must be alphanumeric with optional hyphens." >&2
78+
exit 1
79+
fi
80+
7481
export DUCKDNS_SUBDOMAIN
7582
}
7683

server/routers/cicd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ async def get_workflow_content(project_name: str, filename: str):
241241
if not project_dir:
242242
raise HTTPException(status_code=404, detail="Project not found")
243243

244+
if not project_dir.exists():
245+
raise HTTPException(status_code=404, detail="Project directory not found")
246+
244247
# Security: validate filename
245248
if ".." in filename or "/" in filename or "\\" in filename:
246249
raise HTTPException(status_code=400, detail="Invalid filename")

server/routers/projects.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Uses project registry for path lookups instead of fixed generations/ directory.
77
"""
88

9+
import logging
910
import os
1011
import re
1112
import shutil
@@ -15,6 +16,8 @@
1516

1617
from fastapi import APIRouter, HTTPException
1718

19+
logger = logging.getLogger(__name__)
20+
1821
from ..schemas import (
1922
DatabaseHealth,
2023
KnowledgeFile,
@@ -370,8 +373,8 @@ async def delete_project(name: str, delete_files: bool = False):
370373
logger.warning(f"Error disconnecting WebSocket connections for project '{name}': {e}")
371374

372375
# Step 2: Stop agent process manager for this project
373-
from .services.process_manager import cleanup_manager as cleanup_process_manager
374376
from .services.dev_server_manager import get_devserver_manager
377+
from .services.process_manager import cleanup_manager as cleanup_process_manager
375378
try:
376379
await cleanup_process_manager(name, project_dir)
377380
logger.info(f"Stopped agent process manager for project '{name}'")

server/services/process_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ async def cleanup_all_managers() -> None:
635635

636636
async def cleanup_manager(project_name: str, project_dir: Path) -> None:
637637
"""Stop and remove a specific project's agent process manager.
638-
638+
639639
Args:
640640
project_name: Name of the project
641641
project_dir: Absolute path to the project directory
@@ -644,7 +644,7 @@ async def cleanup_manager(project_name: str, project_dir: Path) -> None:
644644
# Use composite key to match get_manager
645645
key = (project_name, str(project_dir.resolve()))
646646
manager = _managers.pop(key, None)
647-
647+
648648
if manager:
649649
try:
650650
if manager.status != "stopped":

server/websocket.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,18 +620,18 @@ def get_connection_count(self, project_name: str) -> int:
620620

621621
async def disconnect_all_for_project(self, project_name: str) -> int:
622622
"""Disconnect all WebSocket connections for a specific project.
623-
623+
624624
Args:
625625
project_name: Name of the project
626-
626+
627627
Returns:
628628
Number of connections that were disconnected
629629
"""
630630
async with self._lock:
631631
connections = list(self.active_connections.get(project_name, set()))
632632
if project_name in self.active_connections:
633633
del self.active_connections[project_name]
634-
634+
635635
# Close connections outside the lock to avoid deadlock
636636
closed_count = 0
637637
for connection in connections:
@@ -640,7 +640,7 @@ async def disconnect_all_for_project(self, project_name: str) -> int:
640640
closed_count += 1
641641
except Exception as e:
642642
logger.warning(f"Error closing WebSocket connection for project {project_name}: {e}")
643-
643+
644644
return closed_count
645645

646646

ui/src/components/ImportProjectModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { useCreateProject, useDeleteProject, useProjects } from '../hooks/usePro
3535
import { FolderBrowser } from './FolderBrowser'
3636
import { ConfirmDialog } from './ConfirmDialog'
3737

38-
type Step = 'folder' | 'analyzing' | 'detected' | 'features' | 'register' | 'complete'
38+
type Step = 'folder' | 'analyzing' | 'detected' | 'features' | 'register' | 'complete' | 'error'
3939

4040
interface ImportProjectModalProps {
4141
isOpen: boolean

0 commit comments

Comments
 (0)