feat(unigetui): add package broker policy libraries#1826
feat(unigetui): add package broker policy libraries#1826Vladyslav Nikonov (vnikonov-devolutions) wants to merge 4 commits into
Conversation
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>
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
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-policycontaining policy document models, schema generation tooling, and sample/validation tests. - Adds new .NET library
Devolutions.UniGetUI.Broker.Policywith 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.
There was a problem hiding this comment.
NOTE: Generated from rust model
|
Opened PR for discussion/schema review; do not merge yet, potentially will be moved to a separate repo |
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