Fix November selfhost integration compatibility

Retain chart-stack localization, align CPU sampling and test wrappers with the combined APIs, and verify the WinExt telemetry identity.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mike GrieseandCopilot App committed 2026-11-03 16:54:22 -06:00
1 parent 73cae7f0d2
commit 4f6d8b5f64
6 files changed
+54 -4

No files matched your search

@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CmdPal.AdaptiveCards.Polyfills;
/// <summary>Gets the strings that charts show from the host, which owns the resources.</summary>
internal static class ChartStrings
{
private static Func<string, string> _getString = static name => name;
public static string Get(string name) => _getString(name);
public static void SetLookup(Func<string, string> getString) => _getString = getString;
}
@@ -1,5 +1,15 @@
# Adaptive Cards polyfills
> [!WARNING]
> Here be basilisks!
>
> This entire library is maintained by LLMs. Humans didn't write the code, and
> no human actually owns this code.
>
> We're using this library to fill gaps in the WinUI 3 Adaptive Cards renderer.
> Ideally, the upstream renderer will support these in the fullness of time, and
> we'll be able to delete this library.
The WinUI 3 Adaptive Cards renderer doesn't support everything in the current Adaptive Cards schema. This library fills the gaps until it does:
- The `Chart.Line`, `Chart.Gauge`, `Chart.Donut`, `Chart.Pie`, `Chart.VerticalBar`, `Chart.HorizontalBar`, `Chart.HorizontalBar.Stacked`, `ProgressBar`, `Badge`, and `Icon` elements.
@@ -16,6 +16,7 @@ using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Windows.System;
using RS_ = Microsoft.CmdPal.UI.Helpers.ResourceLoaderInstance;
namespace Microsoft.CmdPal.UI.Controls;
@@ -8,7 +8,9 @@ using System.Threading.Tasks;
using Microsoft.CmdPal.Common.Text;
using Microsoft.CmdPal.UI.ViewModels.MainPage;
using Microsoft.CmdPal.UI.ViewModels.Messages;
using Microsoft.CmdPal.UI.ViewModels.Models;
using Microsoft.CmdPal.UI.ViewModels.Services;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -40,7 +42,7 @@ public sealed class MainListPageRefreshTests
matcherProvider.SetupGet(provider => provider.Current).Returns(new PrecomputedFuzzyMatcher());
using var commands = new TopLevelCommandManager(services.Object, []);
var aliases = new AliasManager(commands, settingsService.Object);
using var page = new MainListPage(commands, aliases, matcherProvider.Object, settingsService.Object, appStateService.Object, new ListPage());
using var page = new MainListPage(commands, aliases, matcherProvider.Object, settingsService.Object, appStateService.Object, new InProcObject<IListPage>(new ListPage()));
var refreshed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
page.ItemsChanged += (_, _) => refreshed.TrySetResult();
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Telemetry.Events;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.CmdPal.UI.ViewModels.UnitTests;
[TestClass]
public sealed class TelemetryEventBaseTests
{
[TestMethod]
public void EventBase_ContainsRequiredWinExtIdentity()
{
var telemetryEvent = new EventBase();
Assert.AreEqual((ushort)13, telemetryEvent.PartA_PrivacyProduct);
Assert.AreEqual((ushort)1, telemetryEvent.PartA_PrivacyDataCategory);
}
}
@@ -4,6 +4,7 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using Microsoft.CmdPal.Ext.PerformanceMonitor;
using Timer = System.Timers.Timer;
@@ -80,13 +81,13 @@ internal sealed partial class DataManager : IDisposable
}
}
private void GetCPUData(bool includeTopProcesses)
private void GetCPUData()
{
lock (_systemData.CpuStats)
{
if (ShouldSample(_systemData.CpuStats))
{
_systemData.CpuStats.GetData(includeTopProcesses);
_systemData.CpuStats.GetData();
}
}
}
@@ -132,7 +133,7 @@ internal sealed partial class DataManager : IDisposable
case DataType.CPU:
{
// CPU
GetCPUData(_dataType == DataType.CpuWithTopProcesses);
GetCPUData();
break;
}