feat: add active package policy inspection contract - #93
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a feature-gated active-policy inspection contract across Rust, OpenAPI, and .NET.
Changes:
- Adds
GET /v1/policy, DTOs, routing, mocks, and structured errors. - Adds .NET serialization and client support.
- Adds shared fixtures, tests, CI coverage, and documentation.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
xtask/src/rust.rs |
Tests and lints policy features. |
policies/rust/now-policy-server-template/tests/sample_documents.rs |
Tests policy fixtures and routing. |
policies/rust/now-policy-server-template/src/server.rs |
Implements route and OpenAPI schema registration. |
policies/rust/now-policy-server-template/src/mock.rs |
Adds configurable policy responses. |
policies/rust/now-policy-server-template/README.md |
Documents policy endpoint support. |
policies/rust/now-policy-server-template/Cargo.toml |
Requires policy feature for generation. |
policies/rust/now-policy-server-template/assets/samples/responses/policy.response.json |
Adds shared response fixture. |
policies/rust/now-policy-api/src/policy.rs |
Defines Rust policy response DTO. |
policies/rust/now-policy-api/src/lib.rs |
Exports policy contract types. |
policies/rust/now-policy-api/README.md |
Documents the Rust DTO. |
policies/rust/now-policy-api/openapi/now-policy-api.yaml |
Publishes endpoint and schemas. |
policies/dotnet/Devolutions.Now.Policy.Client/README.md |
Documents client behavior. |
policies/dotnet/Devolutions.Now.Policy.Client/BrokerClient.cs |
Adds GetPolicy. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/TestData.cs |
Discovers policy fixtures. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/SchemaValidationTests.cs |
Validates policy schemas. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/MetaModelTests.cs |
Tests response discriminator validation. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/DtoRoundTripTests.cs |
Tests DTO round trips. |
policies/dotnet/Devolutions.Now.Policy.Client.Tests/BrokerClientTests.cs |
Tests requests, errors, and cancellation. |
policies/dotnet/Devolutions.Now.Policy.Api/ResponseModels.cs |
Defines .NET policy response DTO. |
policies/dotnet/Devolutions.Now.Policy.Api/README.md |
Documents active-policy DTOs. |
policies/dotnet/Devolutions.Now.Policy.Api/BrokerJson.cs |
Adds source-generated serialization. |
policies/dotnet/Devolutions.Now.Policy.Api/BrokerApi.cs |
Adds policy response discriminator. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Aug 17, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated no new comments.
Suppressed comments (2)
policies/dotnet/Devolutions.Now.Policy.Client/README.md:48
- The method returns
PolicyResponse, notPolicyDocument; the policy document is itsPolicyproperty. Describing the wrapper accurately prevents callers from expecting the wrong public return type.
- `GetPolicy` sends `GET /v1/policy` and returns the active parsed `PolicyDocument` after strict source-generated validation of the successful response.
policies/dotnet/Devolutions.Now.Policy.Api/BrokerJson.cs:124
RespectNullableAnnotationsdoes not validate nullability of collection elements.GetPolicytherefore still accepts contract-invalid payloads such as"Rules":[null]or"Sources":[null], placing nulls into non-nullable lists even though Rust and the OpenAPI schema reject them; consumers can then hit null-reference failures. Add element-level converters or post-deserialization validation (with coverage) before returningPolicyResponse.
RespectNullableAnnotations = true,
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Benoît Cortier (CBenoit)
added a commit
to Devolutions/devolutions-gateway
that referenced
this pull request
Aug 18, 2026
Return a generic policy-unavailable message so clients cannot infer whether the active policy is file-backed, missing, or corrupt. Issue: Devolutions/now-libraries#93 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve the schemars 0.9 OpenAPI schema registration conflict while preserving namespaced policy components. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the policy-compat feature and conversion implementations. The API now composes the canonical policy document directly, while runtime adapters remain owned by broker implementations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rename the server trait method to active_policy so it remains distinct from a future replace_policy operation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Benoît Cortier (CBenoit)
enabled auto-merge (squash)
August 28, 2026 12:54
Richard Markiewicz (thenextman)
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /v1/policysupport across the Rust server contract, generated OpenAPI, C# DTOs, andBrokerClient.GetPolicy(CancellationToken)PolicyDocumentinside a versionedPolicyResponse, with structured404 NotFoundbehavior when no active policy is configuredpolicy-compatand its cross-model conversion impls, and keep runtime mapping ownership in broker implementationsactive_policy, leaving clear room for a future explicitreplace_policyoperation backed by a separate policy-store abstractionPolicyModel…API changes
Rust
now-policy-apiadds publicPolicyResponseandPolicyResponseKind;now-policyis now a normal dependency becausePolicyDocumentis part of the permanent wire contractPackageBrokerServeradds the required method:now-policy-server-templateregisters the route unconditionally and extends its mock with policy response/error builderspolicy-compatand itsFrom/TryFromconversions are removedC#
Devolutions.Now.Policy.ApiaddsPolicyResponse, embeddingDevolutions.Now.Policy.Model.PolicyDocumentDevolutions.Now.Policy.ClientaddsGetPolicy(CancellationToken)with strict validation of successful response bodiesHTTP
GET /v1/policy200:PolicyResponse404: structuredErrorResponsewhen no active policy is configuredErrorResponsecontract