Repository navigation
Description
Problem
A cloud command given a project ID and --push can silently skip an existing local copy after its directory is renamed. The local config.json still identifies the same cloud project, but the resolver looks only under the cloud project's current name. It then returns the cloud project without uploading local changes.
Reproduction
- Create
Examplelocally and push it, recording its cloud ID. - Rename its local directory to
Renamed Example, preservingconfig.jsonand itscloud-id. - Edit the local algorithm.
- From the workspace root, run
lean cloud backtest <cloud-id> --push.
The command can proceed with the older cloud files instead of pushing the local copy. The same resolver serves cloud optimization and live deployment.
Evidence
Reproduced with the real CloudProjectManager, ProjectManager and local configuration handling, using a mocked API, on master commit f3deb21:
- The cloud project was named
Python Project, with ID 20. - The local directory was renamed to
Renamed Projectand retainedcloud-id: 20. get_cloud_project("20", push=True)returned the cloud project successfully.projects.updatewas never called.
In lean/components/cloud/cloud_project_manager.py, the ID/name fallback calls get_local_project_path(cloud_project.name, cloud_project.projectId). That helper searches the cloud name and its numeric-suffix variants, not all local projects with the matching cloud ID. When the guessed path does not exist, the resolver treats the local counterpart as absent.
Expected behavior
An ID-based command with --push should find an existing local project with that cloud ID before deciding that there is no local copy to upload. It must not silently execute outdated files in this case.
Suggestion: resolve the local counterpart by its stored cloud ID and add a regression test for a renamed local directory. Passing the new local directory name to the command, or explicitly pushing it first, is a workaround.
Activity