Skip to content

Backport fixes to 3.2-rc.1#1476

Merged
SteveL-MSFT merged 22 commits intoPowerShell:release/v3.2from
SteveL-MSFT:3.2-rc.1
Apr 10, 2026
Merged

Backport fixes to 3.2-rc.1#1476
SteveL-MSFT merged 22 commits intoPowerShell:release/v3.2from
SteveL-MSFT:3.2-rc.1

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

SteveL-MSFT and others added 22 commits April 9, 2026 20:01
Prior to this change, the clippy invocation in `Build-RustProject` never
actually invoked clippy because the check required _all_ projects to
be set to require clippy with this check:

```powershell
$Clippy -and !$Project.ClippyUnclean
```

However, this _never_ evaluated to true because the function invokes against
the full list of packages.

This change addresses the problem by:

1. Defining a new self-contained `Test-Clippy` function, which encapsulates
   the logic for arranging and invoking clippy against DSC rust projects.

   It now invokes clippy twice, once for general (non-pedantic) projects
   and again for pedantic projects. This can potentially be optimized in
   the future by adding linting configuration to project cargo manifests.
1. Updates the `Build-RustProject` function to use `Test-Clippy`.
1. Defines a new field in `.project.data.json`, `RustPackageName`, which
   is needed to specify specific packages for `cargo` commands when the
   containing folder for a crate has a different name from the value of
   the `package.name` field in a cargo manifest.

   This change required updating the validating JSON schema for the data
   files and updating the type definition in build helpers to match.
1. Adds a new instance method, `ToPackageFlags()`, to `DscProjectDefinition`
   to enable quickly emitting the `-p <package_name>` pair for use in
   invoking cargo commands.

Now that the clippy checks are applying, the build will fail locally and in
CI. Follow up changes will be made to separately fix each crate.
Prior to this change, the `exe_exists()` test for the `tryWhich()`
configuration function looked for `dsc`, which may not exist when
the project has not successfully built yet.

This change uses `cargo` instead, which is guaranteed to be available
when this test is executed.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 backports a set of fixes into the 3.2-rc.1 release branch, spanning Rust resource behavior fixes, build/lint tooling updates (Clippy + project metadata), and crate/version bumps to produce 3.2.0-rc.1 artifacts.

Changes:

  • Backports multiple resource/runtime fixes (Windows Firewall, Windows Service, DISM arm64, SSHDConfig behavior + tests, etc.).
  • Updates build tooling to correctly target Rust packages (adds RustPackageName metadata and refactors Clippy invocation).
  • Bumps DSC CLI version to 3.2.0-rc.1 and updates Rust dependency versions (e.g., tokio).

Reviewed changes

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

Show a summary per file
File Description
tools/dsctest/src/refresh_env.rs Simplifies registry env var read logic via pattern matching.
tools/dsctest/src/copy_resource.rs Uses next_back() for type-name suffix extraction.
resources/WindowsUpdate/src/windows_update/set.rs Adjusts error construction and some control-flow patterns.
resources/WindowsUpdate/src/windows_update/get.rs Aligns error construction patterns with updated Windows error API usage.
resources/WindowsUpdate/src/windows_update/export.rs Refactors filter checks and error construction; minor formatting cleanup.
resources/WindowsUpdate/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/windows_service/src/service.rs Refactors conditional logic and error handling patterns.
resources/windows_firewall/src/main.rs Exposes write_error for internal module use.
resources/windows_firewall/src/firewall.rs Fixes VARIANT lifetime handling (RAII) and improves default handling for empty profile/interface-type lists.
resources/sshdconfig/tests/sshdconfigRepeat.tests.ps1 Adds coverage for _exist defaulting behavior.
resources/sshdconfig/src/repeat_keyword.rs Changes _exist default to true; refactors helper functions/conditions.
resources/sshdconfig/src/parser.rs Refactors validation/argument parsing control-flow.
resources/sshdconfig/src/get.rs Refactors defaults detection loop conditionals.
resources/sshdconfig/src/formatter.rs Simplifies invalid-array checks.
resources/sshdconfig/src/export.rs Refactors canonical filtering logic.
resources/sshdconfig/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/runcommandonset/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/registry/src/main.rs Refactors what-if delete routing logic.
resources/registry/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/process/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/osinfo/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/dscecho/src/main.rs Refactors secure-value detection logic.
resources/dscecho/.project.data.json Adds RustPackageName for correct cargo -p targeting.
resources/dism_dsc/src/optional_feature/export.rs Refactors wildcard filter check.
resources/dism_dsc/src/feature_on_demand/export.rs Refactors wildcard filter check.
resources/dism_dsc/src/dism.rs Fixes packed struct alignment for Windows arm64 compatibility.
lib/dsc-lib/src/types/wildcard_type_name.rs Adjusts error construction and iterator usage in parsing.
lib/dsc-lib/src/types/semantic_version.rs Derives PartialEq, tweaks string comparisons and ordering behavior.
lib/dsc-lib/src/types/semantic_version_req.rs Derives Default/PartialEq, removes manual Default impl, tweaks string comparisons.
lib/dsc-lib/src/types/resource_version.rs Refactors helpers, adds manual Hash implementation.
lib/dsc-lib/src/types/resource_version_req.rs Refactors helpers, adds manual Hash implementation.
lib/dsc-lib/src/types/fully_qualified_type_name.rs Derives Default and removes manual default impl; minor call-site tweak.
lib/dsc-lib/src/types/exit_codes_map.rs Refactors default map initialization and comparisons.
lib/dsc-lib/src/types/exit_code.rs Moves Hash to a manual implementation.
lib/dsc-lib/src/types/date_version.rs Moves Hash to a manual implementation; minor logic simplifications.
lib/dsc-lib/src/lib.rs Removes #[must_use] on find_resource.
lib/dsc-lib/src/functions/try_which.rs Makes test less environment-dependent by using cargo instead of dsc.
lib/dsc-lib/src/functions/data_uri_to_string.rs Uses strip_prefix for safer charset parsing.
lib/dsc-lib/src/functions/contains.rs Refactors nested conditionals into let-chains.
lib/dsc-lib/src/dscresources/dscresource.rs Refactors adapter invocation and manifest checks; small formatting changes.
lib/dsc-lib/src/dscresources/command_resource.rs Refactors option handling and what-if routing; reduces cloning.
lib/dsc-lib/src/discovery/mod.rs Avoids allocation by using std::slice::from_ref; removes #[must_use].
lib/dsc-lib/src/discovery/discovery_trait.rs Fixes doc comment indentation.
lib/dsc-lib/src/discovery/command_discovery.rs Adds clippy allow; refactors adapter lookup and resource filtering.
lib/dsc-lib/src/configure/parameters.rs Refactors secure-value detection and parameter import flow.
lib/dsc-lib/src/configure/mod.rs Refactors metadata/security-context logic and various control-flow patterns.
lib/dsc-lib/src/configure/depends_on.rs Refactors dependency validation conditional.
lib/dsc-lib-jsonschema/src/vscode/transforms/vscodify_refs_and_defs.rs Updates API usage for new &str signature.
lib/dsc-lib-jsonschema/src/schema_utility_extensions.rs Changes schema defs-key lookup API to accept &str and updates call sites.
lib/dsc-lib-jsonschema/src/dsc_repo/mod.rs Simplifies schema id parsing using ? and char-based operations.
lib/dsc-lib-jsonschema/src/dsc_repo/dsc_repo_schema.rs Adds #[must_use] annotations; minor string-splitting adjustments.
lib/dsc-lib-jsonschema/build.rs Improves panic message formatting on version-data parse failure.
helpers.build.psm1 Adds RustPackageName, adds ToPackageFlags(), introduces Test-Clippy, and wires it into Build-RustProject.
dsc/src/util.rs Refactors trace-level override logic.
dsc/src/subcommand.rs Refactors what-if execution-type selection; simplifies parse mapping.
dsc/src/resource_command.rs Refactors conditional for passthrough output formatting.
dsc/Cargo.toml Bumps CLI version to 3.2.0-rc.1.
dsc-bicep-ext/src/main.rs Minor refactors in struct init and a unit-returning method body.
Cargo.toml Updates dependency version (e.g., tokio).
Cargo.lock Locks updated crate versions consistent with dependency bumps and new CLI version.
build.ps1 Adjusts ordering of Windows build-tools installation.
.vscode/schemas/definitions.json Updates schema to include RustPackageName in project metadata.

@SteveL-MSFT SteveL-MSFT merged commit 4b9e0ae into PowerShell:release/v3.2 Apr 10, 2026
23 checks passed
@SteveL-MSFT SteveL-MSFT deleted the 3.2-rc.1 branch April 10, 2026 13:44
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.

4 participants