Skip to content

[Repo Assist] test(tray): add WindowsFactAttribute; skip DPAPI test on non-Windows#265

Merged
shanselman merged 1 commit intomasterfrom
repo-assist/eng-windows-fact-attr-2026-05-03-7974804fd29f70f3
May 5, 2026
Merged

[Repo Assist] test(tray): add WindowsFactAttribute; skip DPAPI test on non-Windows#265
shanselman merged 1 commit intomasterfrom
repo-assist/eng-windows-fact-attr-2026-05-03-7974804fd29f70f3

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 3, 2026

🤖 This is an automated pull request from Repo Assist.

Summary

Adds WindowsFactAttribute — a custom xUnit FactAttribute that automatically skips the test on non-Windows platforms — and applies it to the one Tray test that calls the Windows Data Protection API (DPAPI).

Problem

SettingsManager_ProtectsElevenLabsApiKeyForStorage calls SettingsManager.ProtectSettingSecret, which intentionally throws PlatformNotSupportedException on non-Windows:

if (!OperatingSystem.IsWindows())
    throw new PlatformNotSupportedException("Windows Data Protection API is required...");

The test had no platform guard, so it caused a spurious failure (not a skip) on every Linux run:

Failed OpenClaw.Tray.Tests.SettingsRoundTripTests.SettingsManager_ProtectsElevenLabsApiKeyForStorage
  System.PlatformNotSupportedException: Windows Data Protection API is required for protected settings secrets.

Fix

Adds WindowsFactAttribute following the exact same pattern as the existing IntegrationFactAttribute:

public sealed class WindowsFactAttribute : FactAttribute
{
    public WindowsFactAttribute()
    {
        if (!OperatingSystem.IsWindows())
            Skip = "Windows-only: requires a Windows platform API.";
    }
}

Replaces [Fact] with [WindowsFact] on the DPAPI test. On Windows CI (windows-latest), the test runs and asserts fully. On Linux the test is skipped rather than failing.

Related

This is a companion to #(PR for canvas fix) which fixed the two pre-existing failures in OpenClaw.Shared.Tests (also Linux cross-platform issues). Together these make the full test suite clean on Linux.

Test Status

Suite Before After
OpenClaw.Shared.Tests 1152 passed / 0 failed / 20 skipped ✅ unchanged
OpenClaw.Tray.Tests 406 passed / 1 failed / 0 skipped ✅ 406 passed / 0 failed / 1 skipped

./build.ps1 was not run (Linux environment). This change only touches test infrastructure — no production source files modified.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

SettingsManager_ProtectsElevenLabsApiKeyForStorage calls
ProtectSettingSecret, which intentionally throws PlatformNotSupportedException
on non-Windows (DPAPI is Windows-only). The test had no platform guard, so
it produced a spurious failure on every Linux CI run.

Adds WindowsFactAttribute following the same pattern as IntegrationFactAttribute:
a custom FactAttribute subclass that sets Skip automatically when the test runs
on a non-Windows platform. Applies it to the one DPAPI test.

The test continues to run and assert fully on Windows CI (windows-latest).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman shanselman marked this pull request as ready for review May 5, 2026 17:20
@shanselman shanselman merged commit 1615554 into master May 5, 2026
3 checks passed
@shanselman shanselman deleted the repo-assist/eng-windows-fact-attr-2026-05-03-7974804fd29f70f3 branch May 5, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant