Pull-induced rename leaves an in-project encryption key path pointing at the old directory

未关闭 适合新手
#761 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli

调研方向

从lean/components/cloud/pull_manager.py开始,重点查看_pull_project及其对ProjectManager.rename_project_and_contents的调用;阅读与#742相关的修复,并检查ProjectManager.get_path_after_project_rename。查看 pull manager 中有关重命名行为的测试,并添加覆盖项目内一个键路径和项目外一个键路径的测试。完成标准是:内部键路径指向重命名后的目录,而外部键路径保持不变。

由索引模型根据 Issue 内容生成。

描述

priority:P2

Problem

When lean cloud pull finds a project on disk under a name the cloud project no longer has, it renames the local directory with ProjectManager.rename_project_and_contents (lean/components/cloud/pull_manager.py, _pull_project). A key file stored inside the project directory moves with it, but the project's encryption-key-path keeps the old location. The next lean cloud push of the project then fails to open the key.

This is the pull side of #742, which fixes the same case for push.

Reproduction

  1. Create a project Project A, copy a registered encryption key into it as Project A/key.txt, run lean encrypt "Project A" --key "<abs path>/Project A/key.txt" and lean cloud push --project "Project A".
  2. Rename the cloud project to Project B (in the web IDE, or projects/update).
  3. lean cloud pull --project "Project B": the local directory becomes Project B, with key.txt inside, but Project B/config.json still has "encryption-key-path": "<abs path>/Project A/key.txt".
  4. lean cloud push --project "Project B" prints Cannot push 'Project B': [Errno 2] No such file or directory: '<abs path>/Project A/key.txt'.

Expected result

After the rename, a configured key inside the project directory is found at its new location, so the next push works. Keys outside the project directory keep their path. The fix for #742 adds ProjectManager.get_path_after_project_rename, which pull could reuse (suggestion).

主要语言
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 摘要。