Skip to content

feat(unigetui): add package broker policy libraries#1826

Open
Vladyslav Nikonov (vnikonov-devolutions) wants to merge 4 commits into
masterfrom
feature/unigetui-package-broker-1-policy
Open

feat(unigetui): add package broker policy libraries#1826
Vladyslav Nikonov (vnikonov-devolutions) wants to merge 4 commits into
masterfrom
feature/unigetui-package-broker-1-policy

Conversation

@vnikonov-devolutions

@vnikonov-devolutions Vladyslav Nikonov (vnikonov-devolutions) commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Adds shared policy libraries for the UniGetUI package broker.

The new Rust policy crate defines the package broker policy document model, sample policies, validation tests, and JSON schema generation. A matching .NET policy library provides policy creation and parsing APIs, with tests that validate generated policies and sample fixtures against the Rust-generated schema.

This gives both Rust broker code and .NET consumers a shared policy contract without coupling policy definitions to broker server, request, response, or execution code.

Issue: ARC-481

Add the shared UniGetUI package broker policy model as a standalone Rust crate with schema generation, sample fixtures, and validation tests.

Add the matching .NET policy library and tests that parse/create policies and validate them against the Rust-generated schema.

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

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

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 shared “package broker policy” contract for UniGetUI across Rust and .NET by introducing a Rust policy-model crate (with schema generation + sample fixtures + validation tests) and a matching .NET policy library (models + JSON/YAML parsing + schema-validation tests).

Changes:

  • Introduces new Rust crate unigetui-broker-policy containing policy document models, schema generation tooling, and sample/validation tests.
  • Adds new .NET library Devolutions.UniGetUI.Broker.Policy with policy models + JSON/YAML parsing, plus tests validating against the Rust-generated JSON schema.
  • Adds sample policy fixtures and checks them into the repo; updates workspace configuration and linguist settings accordingly.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyModels.cs .NET policy document object model + JSON/YAML parsing helpers.
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyJson.cs Centralizes System.Text.Json serializer options (strict vs non-strict).
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/Enums.cs .NET enums representing policy-domain concepts (operations, managers, decisions, etc.).
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/Devolutions.UniGetUI.Broker.Policy.csproj New .NET policy library project definition + dependencies.
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy.Tests/PolicyTests.cs .NET tests validating fixtures and generated policies against Rust JSON schema.
unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy.Tests/Devolutions.UniGetUI.Broker.Policy.Tests.csproj New .NET test project + dependencies (xUnit, NJsonSchema).
unigetui/dotnet/Devolutions.UniGetUI.Broker.Client.slnx Solution entry for the new policy library + tests.
unigetui/dotnet/.gitignore Ignores dotnet bin/ and obj/ for the new subtree.
unigetui/crates/uniget-broker-policy/tools/generate_schema.rs Rust CLI tool to generate and write the JSON schema file.
unigetui/crates/uniget-broker-policy/tests/policy_samples.rs Rust tests ensuring samples deserialize and invalid fixtures fail.
unigetui/crates/uniget-broker-policy/src/schema.rs Rust schema helpers (generate schema JSON + parse helpers).
unigetui/crates/uniget-broker-policy/src/policy.rs Core Rust policy document model types and constraints.
unigetui/crates/uniget-broker-policy/src/newtypes.rs Rust validated newtypes used by the policy schema (IDs, URLs, semver, patterns).
unigetui/crates/uniget-broker-policy/src/markers.rs Rust marker types enforcing fixed-string constants (PolicyType, $schema).
unigetui/crates/uniget-broker-policy/src/lib.rs Rust crate module wiring and re-exports.
unigetui/crates/uniget-broker-policy/src/enums.rs Rust enums shared by the policy model and (future) broker requests.
unigetui/crates/uniget-broker-policy/schema/unigetui.package-policy.schema.json Generated JSON schema committed for cross-language validation.
unigetui/crates/uniget-broker-policy/Cargo.toml New Rust crate manifest and dependencies.
unigetui/crates/uniget-broker-policy/assets/samples/scenario-coverage.policy.json Sample policy fixture (coverage scenarios).
unigetui/crates/uniget-broker-policy/assets/samples/powershell-current-user.policy.json Sample policy fixture (PowerShell current-user scenario).
unigetui/crates/uniget-broker-policy/assets/samples/powershell-advanced.policy.json Sample policy fixture (PowerShell advanced scenarios).
unigetui/crates/uniget-broker-policy/assets/samples/invalid/policies/invalid-failure-decision.policy.json Invalid sample used to assert strict parsing behavior.
unigetui/crates/uniget-broker-policy/assets/samples/deny-risky-options.policy.json Sample policy fixture (deny-list for risky options).
unigetui/crates/uniget-broker-policy/assets/samples/corporate-allowlist.policy.yaml YAML sample policy fixture.
unigetui/crates/uniget-broker-policy/assets/samples/corporate-allowlist.policy.json JSON sample policy fixture.
Cargo.toml Adds UniGetUI crates to the workspace members list.
Cargo.lock Records the new Rust crate and its dependency resolution.
.gitattributes Marks UniGetUI policy assets as generated for linguist stats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread unigetui/crates/uniget-broker-policy/src/markers.rs Outdated
Comment thread unigetui/crates/uniget-broker-policy/src/policy.rs Outdated
Comment thread unigetui/crates/uniget-broker-policy/src/policy.rs
Comment thread unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyModels.cs
Comment thread unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyModels.cs Outdated
Comment thread unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyModels.cs Outdated
Comment thread .gitattributes
Comment thread unigetui/crates/uniget-broker-policy/schema/unigetui.package-policy.schema.json Outdated
Comment thread unigetui/dotnet/Devolutions.UniGetUI.Broker.Policy/PolicyModels.cs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE: Generated from rust model

@vnikonov-devolutions

Copy link
Copy Markdown
Contributor Author

Opened PR for discussion/schema review;

do not merge yet, potentially will be moved to a separate repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants