Skip to content

Add Microsoft/FileContent resource - #1676

Open
Steve Lee (SteveL-MSFT) wants to merge 3 commits into
mainfrom
stevel-msft-create-filecontent-resource
Open

Add Microsoft/FileContent resource#1676
Steve Lee (SteveL-MSFT) wants to merge 3 commits into
mainfrom
stevel-msft-create-filecontent-resource

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Adds a cross-platform DSC resource for managing UTF-8 file content and verifying file integrity without exposing content from normal get operations.

Summary

  • Implements Microsoft/FileContent in Rust with get, set, explicit test, and export operations.
  • Computes SHA-256 and SHA-512 hashes using streamed file reads.
  • Compares content-only test input by hashing the desired UTF-8 content.
  • Supports file removal through _exist: false.
  • Returns content only from export while get returns file identity, existence, and hashes.
  • Adds the executable and resource manifest to Linux, macOS, and Windows package payloads.

Testing

  • Rust formatting and pedantic Clippy checks
  • Rust package build and tests
  • 9 cross-platform Pester tests covering get, set, test, export, and deletion

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 23:26

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

Adds a new cross-platform DSC resource (Microsoft/FileContent) implemented in Rust to manage UTF-8 file content via set, verify integrity via get/test hash outputs, and emit full content only via export. This extends the resource catalog and updates packaging/build inputs so the new resource ships across Linux/macOS/Windows.

Changes:

  • Introduces the filecontent Rust resource executable with get/set/test/export operations, i18n strings, and a v3 resource manifest/schema.
  • Adds cross-platform Pester coverage for get/set/test/export and delete (_exist: false) behavior.
  • Registers the new resource in the workspace/build metadata and package payload lists.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
resources/filecontent/src/main.rs Resource CLI entrypoint and JSON input parsing for operations.
resources/filecontent/src/file.rs Core file I/O + hashing logic for get/set/test/export.
resources/filecontent/src/types.rs Input/output DTOs for resource operations.
resources/filecontent/locales/en-us.toml Localized user-facing strings via rust-i18n.
resources/filecontent/filecontent.dsc.resource.json Resource manifest + embedded JSON schema for Microsoft/FileContent.
resources/filecontent/Cargo.toml New resource crate definition and dependencies.
resources/filecontent/.project.data.json Build metadata for including the resource binary + manifest.
resources/filecontent/tests/filecontent_get.tests.ps1 Pester tests validating get hashes and no content leakage.
resources/filecontent/tests/filecontent_set.tests.ps1 Pester tests validating set writes and _exist: false deletion.
resources/filecontent/tests/filecontent_test.tests.ps1 Pester tests validating test hash-based desired state evaluation.
resources/filecontent/tests/filecontent_export.tests.ps1 Pester tests validating export returns content + hashes.
data.build.json Adds the new resource artifacts to platform payload lists and project catalog.
Cargo.toml Adds the new resource crate to workspace members/default members and introduces sha2 workspace dep.
Cargo.lock Records the new filecontent package and dependency linkage.

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

Comment thread resources/filecontent/src/main.rs
Comment thread resources/filecontent/locales/en-us.toml
Comment thread resources/filecontent/src/file.rs Outdated
Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 2 commits August 13, 2026 16:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

😐 Code Coverage Report

Changed Code Coverage

75% (70%+ coverage)

Metric Value
Changed lines analyzed 224
Lines covered by tests 170
Coverage percentage 75%

🔵 Full Codebase Coverage

82% (good)

Metric Value
Total executable lines 18972
Lines covered by tests 15601
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.

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