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

未關閉 適合新手
#776 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@pcbeingused333 已經在處理了。

開始於 2026年11月27日。

  • #789 來自 @pcbeingused333 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
75/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
cli

研究方向

先執行重現片段,看到 get_local_project_path 傳回 /Strategy。然後閱讀專案管理器(lean/components/project_manager.py 或類似檔案)中的 _format_local_path,其中 : 會被取代並剝離,以及 PushManager._push_project 中消費它的 relative_to(Path.cwd()) 呼叫。完成意味著空的已清理元件會取得可用的本機名稱(或明確的驗證錯誤),並且涵蓋 :/Strategy 的測試通過。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
335
分支
172
平均合併
6 小時 54 分鐘
30 天內合併 PR
37

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

QuantConnect/lean-cli 的其他 Issue

查看 QuantConnect/lean-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。