An empty sanitized parent component gives cloud push a destination outside the workspace

Đang mở Phù hợp với người mới
#776 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@pcbeingused333 đang làm issue này rồi.

Từ ngày 27/11/2026.

  • #789 của @pcbeingused333 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Chạy đoạn tái hiện trước để thấy get_local_project_path trả về /Strategy. Sau đó đọc _format_local_path trong trình quản lý dự án (lean/components/project_manager.py hoặc tương tự), nơi : được thay thế và loại bỏ, và lời gọi relative_to(Path.cwd()) trong PushManager._push_project sử dụng nó. Hoàn thành nghĩa là một component đã được làm sạch rỗng nhận được tên cục bộ dùng được (hoặc một lỗi xác thực rõ ràng) và một test bao phủ :/Strategy chạy qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

priority:P2

Problem

A Linux directory component that becomes empty during project-name sanitization can make the computed destination absolute and outside the workspace. Bulk push then fails before uploading the project.

Reproduction

On master at 39a4d2f, using the real project manager and a fresh temporary working directory:

import os
import tempfile
from pathlib import Path
from lean.container import container

root = Path(tempfile.mkdtemp())
os.chdir(root)
project = root / ":" / "Strategy"
project.mkdir(parents=True)
(project / "config.json").write_text(
    '{"algorithm-language":"Python","cloud-id":20}'
)
(project / "main.py").write_text("# source\n")

destination = container.project_manager.get_local_project_path(
    ":/Strategy", cloud_id=20, source_path=project
)
print(destination)  # /Strategy, outside root

_format_local_path replaces : with a space and strips it, producing /Strategy. Joining that value to Path.cwd() discards the workspace. PushManager._push_project subsequently calls destination.relative_to(Path.cwd()), which raises ValueError, so lean cloud push cannot push this discovered project.

The sanitized destination must stay inside the workspace. Handle components that sanitize to an empty string explicitly, with a usable local name or a clear validation error rather than computing an absolute destination.

Ngôn ngữ chính
Python
Star
335
Fork
172
Merge trung bình
6 giờ 54 phút
Pull request đã merge (30 ngày)
37

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QuantConnect/lean-cli

Tất cả issue của QuantConnect/lean-cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.