Skip to content

Add read-only package broker policy inspector - #5292

Draft
Benoît Cortier (CBenoit) wants to merge 5 commits into
mainfrom
cbenoit-plan-policy-inspector-ui
Draft

Add read-only package broker policy inspector#5292
Benoît Cortier (CBenoit) wants to merge 5 commits into
mainfrom
cbenoit-plan-policy-inspector-ui

Conversation

@CBenoit

@CBenoit Benoît Cortier (CBenoit) commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

  • add a Windows-only Administrator entry and dedicated read-only active package-broker policy inspector
  • consume BrokerClient.GetPolicy and shared PolicyDocument/PolicySerializer without raw transport, duplicate DTOs, filesystem access, or mutation
  • present Agent reachability/compatibility states, server and policy metadata, enforcement, ordered rules, all matches/constraints, and canonical JSON with clipboard copy
  • keep inspection independent of UseAgentBroker, cancellable, stale-safe, localized, searchable, accessible, and NativeAOT-safe
  • centralize broker client construction so existing brokered package operations retain their transport/elevation behavior
  • validate required/defaulted policy data against shared schema constraints and classify malformed nested, unknown-property, numeric-enum, and noncanonical-enum payloads as InvalidResponse

Coordinated Phase 1 work

Published dependency evidence

This branch consumes the official NuGet.org packages Devolutions.Now.Policy.Api and .Client version 2026.9.3; .Model version 2026.9.3 is resolved transitively. A forced restore of src/UniGetUI.Windows.slnx used a new empty package cache and only https://api.nuget.org/v3/index.json.

Package Restored nupkg SHA-256
Devolutions.Now.Policy.Model.2026.9.3.nupkg 968001b5ac049c02e94ed3c8a60e57d82112480c010d82180659f0acb3add47d
Devolutions.Now.Policy.Api.2026.9.3.nupkg ebc532fb751a2e3d1c03ea7a685ac75f436d67126afb57cbdabd6245bf105163
Devolutions.Now.Policy.Client.2026.9.3.nupkg 59157e8f7f3558c75ce404110842c0cc48f290c12004627a6e24f70f1823319c

Compatibility changes are limited to the official version pins, the published PolicySerializer/BrokerSerializer API names, and strict-valid test fixture construction. Phase 1 remains read-only.

Validation

  • focused inspector, broker request, and existing broker-operation tests: 160 passed on each PackageEngine target (net10.0 and net10.0-windows10.0.26100.0), 320 executions total
  • inspector view-model/settings-search tests: 18 passed
  • Windows solution build: passed
  • portable Avalonia solution build: passed
  • win-x64 NativeAOT publish: passed; diagnostics are limited to pre-existing Avalonia DataGrid trim/AOT warnings

This PR remains draft for coordinated stack finalization; the unpublished-package blocker is cleared. Phase 2 PR #5335 will restack after this base advances. The non-Windows runtime matrix remains a runner gap; defensive platform guards and Windows-only settings-search filtering are unit-tested.

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

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 Windows-only, read-only Devolutions Agent package-policy inspector integrated into Administrator settings.

Changes:

  • Adds broker policy retrieval, validation, status mapping, and centralized client creation.
  • Adds searchable, localized UI for policy metadata, rules, constraints, and canonical JSON.
  • Adds coverage for broker responses, cancellation, stale refreshes, and search visibility.

The unpublished 0.4.0 dependencies remain a merge blocker.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/UniGetUI.Tests/UniGetUI.Tests.csproj Adds inspector test dependencies.
src/UniGetUI.Tests/SettingsSearchIndexTests.cs Tests platform-aware search.
src/UniGetUI.Tests/AgentPolicyInspectorViewModelTests.cs Tests presentation and refresh behavior.
src/UniGetUI.PackageEngine.Tests/BrokerPolicyInspectorTests.cs Tests policy transport and validation.
src/UniGetUI.PackageEngine.Operations/PackageOperations.cs Uses centralized broker creation.
src/UniGetUI.PackageEngine.AgentBroker/UniGetUI.PackageEngine.AgentBroker.csproj Updates policy dependencies.
src/UniGetUI.PackageEngine.AgentBroker/BrokerPolicyInspector.cs Implements policy inspection.
src/UniGetUI.PackageEngine.AgentBroker/BrokerClientFactory.cs Centralizes broker configuration.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/SettingsBasePage.axaml.cs Registers the inspector page.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/AgentPolicyInspector.axaml.cs Connects view model and clipboard.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/AgentPolicyInspector.axaml Defines the inspector UI.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/Administrator.axaml.cs Forwards inspector navigation.
src/UniGetUI.Avalonia/Views/Pages/SettingsPages/Administrator.axaml Adds the Windows-only entry.
src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/AgentPolicyInspectorViewModel.cs Formats policy data and manages refreshes.
src/UniGetUI.Avalonia/ViewModels/Pages/SettingsPages/AdministratorViewModel.cs Adds navigation command.
src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj References the broker project.
src/UniGetUI.Avalonia/InternalsVisibleTo.cs Exposes internals to tests.
src/UniGetUI.Avalonia/Infrastructure/SettingsSearchIndex.cs Indexes the Windows-only inspector.
src/Languages/lang_en.json Adds inspector localization strings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Reject malformed required policy data using schema-aligned validation and cover missing, defaulted, nested, and wire-invalid responses.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the settings shell as the single page-level heading for assistive technologies.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the repository formatter so the code-style CI check passes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update the package broker inspector to the official 2026.9.3 API and Client packages and adopt the renamed source-generated serializers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants