feat(policies): Add missing package managers to API - #83
feat(policies): Add missing package managers to API#83Vladyslav Nikonov (vnikonov-devolutions) wants to merge 4 commits into
Conversation
Add Apt, Bun, Cargo, Chocolatey, Dnf, Dotnet, Flatpak, Homebrew, Npm, Pacman, Pip, Scoop, Snap, and Vcpkg to the policy and broker API manager enums (Rust and .NET), bump the broker API version to 1.1, and regenerate the OpenAPI document and policy JSON schema. Managers introduced in 1.1 are version-gated: ManagerName exposes its minimum API version, CapabilitiesResponse gains manager support check methods distinguishing a protocol-version gap from a missing capability, and the .NET client refuses to send a too-new manager to an older broker with a distinct UnsupportedApiVersion error kind. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds UniGetUI package-manager parity and API-version-aware capability checks across Rust and .NET.
Changes:
- Adds 14 package managers across models, schemas, conversions, mocks, and fixtures.
- Bumps broker API to 1.1 and policy crates to 0.2.0.
- Adds tri-state manager support and .NET client preflight gating.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
policies/rust/now-policy/src/enums.rs |
Adds policy manager variants. |
policies/rust/now-policy/schema/devolutions.now-policy.schema.json |
Extends policy schema enum. |
policies/rust/now-policy/Cargo.toml |
Bumps crate version. |
policies/rust/now-policy-server-template/src/mock.rs |
Advertises all manager capabilities. |
policies/rust/now-policy-server-template/Cargo.toml |
Updates crate and dependency versions. |
policies/rust/now-policy-server-template/assets/samples/responses/health-ready.response.json |
Updates response versions. |
policies/rust/now-policy-server-template/assets/samples/responses/capabilities.response.json |
Adds manager capability fixtures. |
policies/rust/now-policy-server-template/assets/samples/requests/chocolatey-git-install.request.json |
Adds Chocolatey request fixture. |
policies/rust/now-policy-api/src/policy_compat.rs |
Adds manager conversions. |
policies/rust/now-policy-api/src/lib.rs |
Bumps API and adds version comparison. |
policies/rust/now-policy-api/src/enums.rs |
Adds managers and minimum versions. |
policies/rust/now-policy-api/src/capabilities.rs |
Adds manager support classification and tests. |
policies/rust/now-policy-api/openapi/now-policy-api.yaml |
Updates OpenAPI contract. |
policies/rust/now-policy-api/Cargo.toml |
Bumps crate dependencies. |
policies/dotnet/Devolutions.Now.Policy.Model/Enums.cs |
Adds policy manager variants. |
policies/dotnet/Devolutions.Now.Policy.Client/README.md |
Documents version gating. |
policies/dotnet/Devolutions.Now.Policy.Client/BrokerClientErrorKind.cs |
Adds version error kind. |
policies/dotnet/Devolutions.Now.Policy.Client/BrokerClient.cs |
Adds request preflight gating. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/BrokerClientTests.cs |
Tests distinct client errors. |
policies/dotnet/Devolutions.Now.Policy.Api/PolicyCompatibility.cs |
Adds manager conversions. |
policies/dotnet/Devolutions.Now.Policy.Api/MetaModels.cs |
Adds capability helper APIs. |
policies/dotnet/Devolutions.Now.Policy.Api/Enums.cs |
Adds API manager variants. |
policies/dotnet/Devolutions.Now.Policy.Api/BrokerApi.cs |
Adds version metadata and comparison. |
Cargo.lock |
Records Rust package bumps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Revert crate versions to 0.1.0 (managed by cargo-release) and fixture ServerVersion back to 0.1.0 - Add IncompatibleApiVersion to ManagerSupport (Rust + .NET) so a broker with a different major API version or malformed version is no longer misclassified as RequiresNewerApiVersion; client raises a distinct message for it - Version the policy schema: bump canonical URI to now-policy.schema.1.1.json, keep accepting the 1.0 URI on read (Rust marker + .NET consts), default PolicyVersion to 1.1.0, regenerate schema JSON - Strengthen version-gating test: old broker now advertises Chocolatey and the version gate still wins; add incompatible-major tests in both languages - Reword 'broker speaks version' to 'broker advertises version' Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A broker with a different major API version fails much earlier, when parsing the response envelope, so classifying it per-manager is not meaningful. Keep ManagerSupport focused on Supported / RequiresNewerApiVersion / NotAdvertised in both Rust and .NET. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
We are not in a release state, so breaking version compatibility is acceptable: the expanded manager set ships as part of the existing 1.0 contract. Removes the redundant versioning machinery: - API_VERSION_STR / BrokerApi.Version back to 1.0 (fixtures included) - Drop ManagerName::minimum_api_version / GetMinimumApiVersion, ApiVersion::supports / ApiVersionSupports and ManagerSupport - Drop the BrokerClient protocol-version gate and BrokerClientErrorKind.UnsupportedApiVersion - Policy schema URI and PolicyVersion defaults back to 1.0 / 1.0.0; regenerate schema and OpenAPI Capability checking stays via CapabilitiesResponse::supports_manager / manager_capability (SupportsManager / GetManagerCapability in .NET). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Copilot we have failing CI because of not allowed rust-cache version; Please create separate PR with rust cache fix, use devolutions-gateway PR as example: Devolutions/devolutions-gateway#1868 (Updates Swatinem/rust-cache@v2.8.2 to Swatinem/rust-cache@v2.9.1) |
|
Vladyslav Nikonov (@vnikonov-devolutions) I've opened a new pull request, #84, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
Changes were merged in #84 |
Adds the 14 package managers supported by UniGetUI that were missing from the policy/broker API, so policies and broker requests can cover the full manager set (including non-Windows ones): Apt, Bun, Cargo, Chocolatey, Dnf, Dotnet, Flatpak, Homebrew, Npm, Pacman, Pip, Scoop, Snap, Vcpkg.
Changes
now-policy,now-policy-api,now-policy-server-template): newManagerNamevariants in the policy model and API enums, policy-compat conversions, mock server capabilities for all 17 managers, and a new Chocolatey request fixture.Devolutions.Now.Policy.Model/.Api): mirrored enum variants and compatibility mappings.CapabilitiesResponse::manager_capability/supports_manager(Rust) andGetManagerCapability/SupportsManager(.NET) let callers check whether a broker advertises a manager before sending a request; the client preflight gate rejects unadvertised managers withUnsupportedCapability.Notes
Generic.NuGetfrom UniGetUI is intentionally excluded (shared base implementation, not a standalone manager).Validation
cargo test/cargo clippy/cargo fmtclean for all three crates (all features).dotnet testgreen (232 tests across net9.0/net10.0).