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

オープン 初心者向け
#776 コメント 0 件 リアクション 0 件 担当者 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分
マージ済み PR(30日)
37

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QuantConnect/lean-cli のほかの issue

QuantConnect/lean-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。