Add active package policy inspection contract - #93
Open
Benoît Cortier (CBenoit) wants to merge 7 commits into
Open
Add active package policy inspection contract#93Benoît Cortier (CBenoit) wants to merge 7 commits into
Benoît Cortier (CBenoit) wants to merge 7 commits into
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>
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.
Summary
GET /v1/policyRust DTO, server-template trait/route/mock, and structured unsupported/failure behaviorPolicyDocument, namespace its OpenAPI-only component schemas to preserve existing component names, and add a shared cross-language response fixturePolicyResponsesupport andBrokerClient.GetPolicy(CancellationToken)with strict successful-response validation and legacy/structured 404 continuitypolicy-compatfor OpenAPI generation and exercise all-feature policy crates in repository CICoordinated integration
Release note
Adds a read-only, versioned active-policy inspection API and .NET client method.
GET /v1/policyreturnsPolicyResponseversion1.0; 404 means inspection is unsupported, while supported brokers return structured non-404 errors when an active policy cannot be supplied.Expected Rust release-plz bumps:
now-policy-api0.4.0 andnow-policy-server-template0.4.0. The policy model is unchanged. NuGet Model/API/Client artifacts were smoke-tested together at normalized version 0.4.0.Validation
cargo xtask ci -vwith .NET major roll-forward: 137 Rust tests and 558 .NET tests passed; formatting, Clippy, builds, lock checks, and typos passedBrokerClient.GetPolicyexecution passed, including rejection of missing, null, unknown, numeric-enum, and noncanonical-case successful response valuesErrorResponsecompatibility remains coverednow-policy-apicrate package verification passed; server-template package was built with--no-verifybecause its matching API crate is intentionally unpublished, then compiled/executed through the path consumer