Skip to content

fix(test): CLI init test patching not triggered#1846

Merged
jonathanpwang merged 1 commit into
mainfrom
fix/cli-test-patch
Jul 10, 2025
Merged

fix(test): CLI init test patching not triggered#1846
jonathanpwang merged 1 commit into
mainfrom
fix/cli-test-patch

Conversation

@jonathanpwang

Copy link
Copy Markdown
Contributor

The patching doesn't work because cargo still tries to fetch from git first before doing the patch, so instead we use a find replace approach. I have tested this with v1.4.0-rc.0 to ensure it works.

The patching doesn't work because cargo still tries to fetch from git
first before doing the patch, so instead we use a find replace approach.
I have tested this with v1.4.0-rc.0 to ensure it works.
Copilot AI review requested due to automatic review settings July 10, 2025 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the CLI init test by replacing the previous patch-appending strategy with an in-place find-and-replace of the OpenVM dependency in Cargo.toml, ensuring local paths are used without Cargo fetching from Git.

  • Switched from appending a [patch] block to replacing the dependency line directly
  • Updated imports and added itertools::Itertools for joining lines
  • Renamed and re-implemented append_patch_to_cargo_toml as replace_with_local_openvm

let new_content = lines
.iter()
.map(|line| {
if line.starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") {

Copilot AI Jul 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check with starts_with won’t match if the openvm line is indented. Consider using line.trim_start().starts_with(...) to handle leading whitespace.

Suggested change
if line.starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") {
if line.trim_start().starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") {

Copilot uses AI. Check for mistakes.
Comment thread crates/cli/tests/app_e2e.rs
Comment thread crates/cli/tests/app_e2e.rs
@jonathanpwang jonathanpwang merged commit bee97a7 into main Jul 10, 2025
4 checks passed
@jonathanpwang jonathanpwang deleted the fix/cli-test-patch branch July 10, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants