Skip to content

refactor(cargo-wdk): share project directory iteration - #722

Open
ITSMESB (ITSMERNB) wants to merge 1 commit into
microsoft:mainfrom
ITSMERNB:refactor/cargo-project-iterator
Open

refactor(cargo-wdk): share project directory iteration#722
ITSMESB (ITSMERNB) wants to merge 1 commit into
microsoft:mainfrom
ITSMERNB:refactor/cargo-project-iterator

Conversation

@ITSMERNB

Copy link
Copy Markdown

Summary

  • add a shared CargoProjectIterator for immediate subdirectories containing Cargo.toml
  • use the same project discovery logic in both build and clean actions
  • avoid the build action's previous duplicate Cargo.toml probing
  • add focused iterator tests for filtering files and non-Rust directories

Fixes #644

Testing

  • cargo test -p cargo-wdk --bin cargo-wdk --locked (104/104 pass)
  • cargo clippy -p cargo-wdk --locked --all-targets -- -D warnings
  • git diff --check
  • the full package test command reaches integration tests, but the AURON service test session does not expose cargo on child-process PATH; the unit/action coverage above is green.

Copilot AI lite review requested due to automatic review settings August 18, 2026 12:05

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors “emulated workspace” detection/iteration logic by introducing a shared iterator that yields immediate subdirectories containing a Cargo.toml, and then reuses it in both the build and clean actions.

Changes:

  • Added a shared CargoProjectIterator for enumerating Rust package directories under a working directory.
  • Updated build and clean actions to use the iterator for validation and per-package processing.
  • Added unit tests for the new iterator.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/cargo-wdk/src/actions/mod.rs Registers the new internal cargo_project_iterator module.
crates/cargo-wdk/src/actions/clean/mod.rs Replaces manual directory scanning with CargoProjectIterator for emulated workspace clean.
crates/cargo-wdk/src/actions/cargo_project_iterator.rs Implements and tests a reusable iterator over Cargo project subdirectories.
crates/cargo-wdk/src/actions/build/mod.rs Replaces manual directory scanning with CargoProjectIterator for emulated workspace build.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Signed-off-by: ITSMESB <131141975+ITSMERNB@users.noreply.github.com>
@ITSMERNB
ITSMESB (ITSMERNB) force-pushed the refactor/cargo-project-iterator branch from 598ff3f to 5199e09 Compare September 2, 2026 05:07
Copilot AI review requested due to automatic review settings September 2, 2026 05:07

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.

🟢 Approval recommended

The refactor is localized, removes duplicated logic, preserves existing behavior, and is backed by targeted unit tests for the new iterator.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ITSMERNB

Copy link
Copy Markdown
Author

Rebased this onto the current main and resolved the clean-action overlap while preserving the newer logging behavior. The branch is mergeable again at 5199e09. Locally, the 109 cargo-wdk unit tests pass and cargo clippy -p cargo-wdk --locked --all-features --all-targets -- -D warnings is clean. The GitHub workflow runs are currently waiting for maintainer approval.

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.

Refactor directory walk into an iterator pattern

2 participants