Skip to content

Add environment path variable resource - #1726

Merged
Steve Lee (SteveL-MSFT) merged 3 commits into
mainfrom
stevel-msft-envvar-ispath-support
Sep 18, 2026
Merged

Steve Lee (SteveL-MSFT) merged 3 commits into
mainfrom
stevel-msft-envvar-ispath-support

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Microsoft.Windows/EnvironmentVariable currently mixes scalar and path semantics, so callers cannot reliably retrieve variables such as PATH as arrays. This implements the working-group decision to separate those contracts while preserving mixed list operations.

  • Keep Microsoft.Windows/EnvironmentVariable scalar-only.
  • Add Microsoft.Windows/EnvironmentPathVariable with array-valued value, write-only delimiter, and write-only setAction.
  • Allow Microsoft.Windows/EnvironmentVariableList to get, set, and test mixed scalar/path items.
  • Add list export across current-user and all-users scopes. Export uses scalar items by default and path items when requested by a path-shaped filter.
  • Support AND semantics within filters, OR semantics across filters, and case-insensitive * wildcard matching for names.
  • Add Rust and Pester coverage for path operations, mixed lists, filtering, and export representation.

Fixes: #1724

Split scalar and path environment variable contracts, retain mixed list operations, and add filterable list export with wildcard name matching.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 18, 2026 04:50

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.

🟡 Changes recommended

The manifest must require name for scalar list items to match executable validation.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a dedicated path environment-variable resource while extending mixed list operations, filtering, export support, and test coverage.

Changes:

  • Introduces EnvironmentPathVariable.
  • Supports mixed scalar/path list operations and filtered exports.
  • Adds Rust and Pester coverage.
  • Retains required-name validation for scalar list items.
File summaries
File Summary
resources/environment_variable/tests/environment_variable_test.tests.ps1 Updates mixed-list tests.
resources/environment_variable/tests/environment_variable_single_test.tests.ps1 Updates scalar tests.
resources/environment_variable/tests/environment_variable_set.tests.ps1 Tests scalar/path setting.
resources/environment_variable/tests/environment_variable_get.tests.ps1 Tests scalar/path retrieval.
resources/environment_variable/tests/environment_variable_export.tests.ps1 Tests export and filtering.
resources/environment_variable/tests/environment_path_variable.tests.ps1 Tests the new path resource.
resources/environment_variable/src/types.rs Defines scalar/path types and validation.
resources/environment_variable/src/main.rs Handles path and export inputs.
resources/environment_variable/src/environment.rs Implements mixed operations and export filtering.
resources/environment_variable/locales/en-us.toml Adds validation and export messages.
resources/environment_variable/environment_variable.dsc.manifests.json Defines resource schemas and operations.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Keep scalar and path list schemas aligned with executable validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown

😊 Code Coverage Report

Changed Code Coverage

86% (80%+ coverage)

Metric Value
Changed lines analyzed 718
Lines covered by tests 623
Coverage percentage 86%

🔵 Full Codebase Coverage

82% (good)

Metric Value
Total executable lines 19475
Lines covered by tests 16145
Coverage percentage 82%

Changed code coverage measures only Rust lines added/modified in this PR.
Full codebase coverage measures all instrumented Rust lines across the project.

Add registry-backed tests for scalar, path, export, removal, and unsupported values. Refactor CLI parsing and result serialization into testable helpers and cover valid and invalid input shapes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

The missing-operation message advertises unsupported export syntax and incorrectly presents filter input as mandatory.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

resources/environment_variable/locales/en-us.toml:4

  • This usage advertises export --path and makes --input appear mandatory, but export is accepted only with --list and its filter input is optional. Please show the export syntax separately so the error directs callers to a valid command.
  • Files reviewed: 11/11 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@SteveL-MSFT
Steve Lee (SteveL-MSFT) merged commit 5f9b4a1 into main Sep 18, 2026
25 checks passed
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the stevel-msft-envvar-ispath-support branch September 18, 2026 19:07
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.

EnvVar resource needs isPath property

2 participants