Skip to content

Add read-only package broker policy inspector - #5292

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

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

Conversation

@CBenoit

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/PolicyJson from the frozen contract in Add active package policy inspection contract now-libraries#93 (961e833c929793116b697e0943a7573ad6e21398)
  • 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 package operations retain the same transport/elevation behavior

Validation

  • Windows solution: 1,244 tests passed
  • post-review broker inspector tests: 31 passed
  • post-review UI/search tests: 18 passed
  • win-x64 NativeAOT publish succeeded; no inspector-specific trim/AOT diagnostics
  • frozen 0.4.0 Model/API/Client package SHA-256 values matched the supplied artifacts

Dependency blocker

This PR intentionally remains draft. Devolutions.Now.Policy.Model, .Api, and .Client 0.4.0 are not yet published to the configured public feed. Validation used the supplied matching local artifacts through command-line RestoreAdditionalProjectSources; no local path or NuGet configuration is committed. Final readiness is blocked on publishing those exact packages from Devolutions/now-libraries#93 and rerunning restore/validation from the published feed.

The portable runtime matrix also still requires non-Windows CI/runners; the Windows-hosted portable solution graph selects Windows-only manager targets. Non-Windows guards and search filtering are covered by unit tests.

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.

Comment on lines +40 to +51
<Grid ColumnDefinitions="*,Auto" Margin="40,0,40,8">
<TextBlock Text="{t:Translate Active package broker policy}"
FontSize="20"
FontWeight="SemiBold"
VerticalAlignment="Center"
automation:AutomationProperties.HeadingLevel="1"/>
<Button Grid.Column="1"
Command="{Binding RefreshCommand}"
IsEnabled="{Binding !IsLoading}"
Content="{t:Translate Refresh}"
automation:AutomationProperties.Name="{t:Translate Refresh active policy}"/>
</Grid>
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