Skip to content

Commit 7dbd4ea

Browse files
fix: remove unused imports and handle symlinks in manifest
Remove unused `get_project_path` imports from features.py and schedules.py (ruff F401). Add symlink detection in detach manifest creation to prevent is_dir() from following symlinks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cc7fc1b commit 7dbd4ea

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

detach.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_autoforge_version() -> str:
113113
class FileEntry(TypedDict):
114114
"""Type for manifest file entry."""
115115
path: str
116-
type: str # "file" or "directory"
116+
type: str # "file", "directory", or "symlink"
117117
size: int
118118
checksum: str | None # MD5 for files, None for directories
119119
file_count: int | None # Number of files for directories
@@ -391,7 +391,17 @@ def create_backup(
391391
for file_path in files:
392392
relative_path = file_path.relative_to(project_dir)
393393

394-
if file_path.is_dir():
394+
if file_path.is_symlink():
395+
# Handle symlinks before is_dir() which follows symlinks
396+
manifest_files.append({
397+
"path": str(relative_path),
398+
"type": "symlink",
399+
"size": 0,
400+
"checksum": None,
401+
"file_count": None,
402+
})
403+
total_file_count += 1
404+
elif file_path.is_dir():
395405
size, count = get_directory_info(file_path)
396406
manifest_files.append({
397407
"path": str(relative_path),

server/routers/features.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
FeatureResponse,
2626
FeatureUpdate,
2727
)
28-
from ..utils.project_helpers import get_project_path as _get_project_path
2928
from ..utils.validation import validate_project_name
3029

3130
# Lazy imports to avoid circular dependencies

server/routers/schedules.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
ScheduleResponse,
2727
ScheduleUpdate,
2828
)
29-
from ..utils.project_helpers import get_project_path as _get_project_path
3029
from ..utils.validation import validate_project_name
3130

3231
if TYPE_CHECKING:

0 commit comments

Comments
 (0)