Repository navigation
feat: diagnostics screen with a copyable report - #159
Conversation
Settings gets a Diagnostics card that shows what the app sees on this PC (version and channel, Windows and .NET, screens with HDR and roles, audio outputs, controllers, Steam/Playnite/RTSS/ControlFS, the end of the log) and copies it as a plain-text report. Data is gathered off the UI thread; a section that throws reads "unavailable". The report is built and redacted (user name in paths, keys and tokens) in DiagnosticsReport, which is unit tested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
c72e0b7 to
f71e1a1
Compare
There was a problem hiding this comment.
Important
The path redaction misses UNC profile paths, so the copied report can expose a Windows account name on systems using roaming/network profiles.
Reviewed changes The initial review covers the diagnostics screen, its collectors and report redaction, localization, documentation, and formatter tests.
- Diagnostics collection Adds an expandable Settings card that gathers app/runtime, display, audio, controller, launcher, and recent log information off the UI thread.
- Report formatting and privacy Adds a plain-text report with section-level unavailable/empty states, user-path and secret redaction, and unit tests.
- Supporting updates Adds localized UI strings, changelog entries, and manual validation steps.
gpt-6-luna | 𝕏
| if (!any) sb.AppendLine("(none)"); | ||
| } | ||
|
|
||
| private static readonly Regex UserPath = new(@"(?i)\b([a-z]:[\\/]+(?:users|documents and settings)[\\/]+)[^\\/\r\n""']+", RegexOptions.Compiled); |
There was a problem hiding this comment.
This only matches drive-letter profile paths. A roaming or network profile can produce a UNC path such as \\server\Users\alice\... in an app path or log line, leaving the account name visible in the copied report despite the privacy guarantee. Please redact UNC Users / Documents and Settings profile prefixes too and cover that form with a test.
Technical details
# UNC profile paths retain account names
## Affected sites
- `src/ConsoleMode/Services/DiagnosticsReport.cs:108` — `UserPath` requires a drive letter, so UNC profile paths are not matched.
- `tests/ConsoleMode.Tests/DiagnosticsReportTests.cs` — add coverage for a UNC path and verify only the profile name is replaced.
## Required outcome
- Redact the account component in both drive-letter and UNC profile paths before the report is displayed or copied.
What
A Diagnóstico / Diagnostics expander in Settings → "Atalho, ajuda e dados", next to "Test controller". It shows, read-only, a plain-text report with Atualizar / Refresh and Copiar relatório / Copy report buttons:
MonitorService: name, resolution @ Hz, HDR on/off/unsupported (CCD), and marks for the game screen, the screens hidden in console mode, primary and off.AudioService), marking the Windows default and the one chosen in the app.RawGameController): name, VID:PID and type (Xbox / PlayStation / Nintendo / Other, plus "gamepad").FullscreenMode).consolemode.log(read withFileShare.ReadWrite, since AppLog may be writing).Why
Issues about screens/audio/controllers usually need several rounds of questions. One button that copies everything the app sees makes a bug report self-contained.
How
Services/DiagnosticsReport.cs(pure, linked in the test project): simple records (DiagnosticsSystem,DiagnosticsDisplay,DiagnosticsAudio,DiagnosticsController,DiagnosticsApp) → text. Anullsection printsunavailable, an empty one(none). Everything goes throughRedact:C:\Users\<name>\→C:\Users\…\,dpapi:blobs (SecretProtector), PEM private keys (the ADB key) andtoken=/password=/pairingKey:/Authorization:-style values.ViewModels/MainViewModel.Diagnostics.cs: gathers the data inTask.Run, each section in its own try/catch (logged in Portuguese). Opening the expander loads it the first time.DiagnosticsController(string Name, string Type, string? Detail = null);Detailis printed after the type (e.g. a battery level) and is filled inMainViewModel.CollectControllers(). Battery isn't implemented here.docs/TESTING.md.Testing
dotnet test tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj: all green, including newDiagnosticsReportTests(formatting, unavailable/empty sections, log tail, path and secret redaction) and the localization tests.docs/TESTING.md.🤖 Generated with Claude Code