Repository navigation
refactor: delete the keep-awake service abstraction nothing ever wired - #235
Conversation
Services/KeepAwake/ holds a four-file abstraction — IKeepAwakeService, a platform factory, a Windows SetThreadExecutionState backend and a no-op fallback — that no code path reaches. AbstractStreamingDevice.InitializeStreaming and StopStreaming call the same kernel32 API through their own local NativeMethods shim instead, so the repo ships two copies of the Windows keep-awake logic and only the inline one runs. Proof, per symbol: - KeepAwakeServiceFactory: the string occurs exactly once repo-wide, its own declaration. Nothing calls Create(), so nothing can reach either backend. - WindowsKeepAwakeService / NoOpKeepAwakeService: constructed only inside that unreachable factory. - IKeepAwakeService: referenced only by the factory, its two backends and a prose comment in AbstractStreamingDevice. - No XAML binding — grepped every .axaml for each type name, the member names PreventSleep/AllowSleep, and StaticResource/DynamicResource/x:Key. - No DI registration — App.cs is the only ServiceCollection and never registers the interface. - No reflection or serialization path: no EF entity, no converter, no JSON contract, not named in any .csproj, .json or .xml. The one outside mention was a comment in InitializeStreaming pointing at the abstraction as the 'proper wiring'; it is reworded so it no longer names deleted types. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
/agentic_review |
PR Summary by QodoRemove unreachable keep-awake service abstraction
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1.
|
Qodo round 1: the reworded comment claimed non-Windows heads log and skip, but the guard has no else branch and emits no log when OperatingSystem.IsWindows() is false. The old comment attributed 'log-and-skip' to NoOpKeepAwakeService (which also only returned true); restating it as a claim about this code made it directly misleading. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 74829dd |
Not merging — for review.
Services/KeepAwake/is a four-file abstraction that no code path can reach. Deleting it removes the second, dead copy of the Windows keep-awake logic the app already performs inline.5 files changed, 2 insertions(+), 79 deletions(-) — net −77 lines, 4 files removed.
Why it is dead
AbstractStreamingDevice.InitializeStreamingandStopStreamingcallSetThreadExecutionStatethrough their own file-localNativeMethodsshim (lines 1537 and 1680). That is the live path.WindowsKeepAwakeServicewraps the same kernel32 API, and nothing calls it — so the repo carries two implementations of one behaviour and only the inline one ever runs. This deletes the copy that does not.Proof, per symbol
KeepAwakeServiceFactoryWindowsKeepAwakeServicenew-ed inside that unreachable factoryNoOpKeepAwakeServicenew-ed inside that unreachable factoryIKeepAwakeServiceHow each column was checked:
grep -rnfor every type name and for the member namesPreventSleep/AllowSleepacross the whole repo excluding.git,obj,binandthird_party/. The complete set of hits outsideServices/KeepAwake/was two prose comment lines inAbstractStreamingDevice.cs. Since nothing callsCreate(), the factory is the only entry point into the cluster and it is unreachable, so the whole graph is closed..axamlfor each type name, forPreventSleep/AllowSleep, and forx:Key/StaticResource/DynamicResourcementions. Zero hits. (Worth stating explicitly: views here withoutx:DataTypebind by reflection, so a zero-C#-reference member can still be live. Not the case for any of these — none is a view-model member and none is named in markup.)App.csholds the onlyServiceCollectionin the app; it never registersIKeepAwakeService. No otherAddSingleton/AddTransient/AddScopedsite exists outsidetools/and the per-platform icon providers..csproj,.jsonor.xml. The project uses default compile globbing, so no build file lists them individually.The one outside mention was a comment in
InitializeStreamingcalling the abstraction the "proper wiring". It is reworded so it no longer names deleted types; the surrounding behaviour is untouched.Verification
build: 235 → 235 warnings, 0 errors. Per-code tallies are byte-identical before and after (both measured cold with--no-incrementalin this worktree against merge-base5414c07). No delta to attribute — the deleted files were warning-free.iossimulator-arm64: 236 warnings, 0 errors, measured cold. A warm rebuild reports 216; the 20-warning gap is the vendored oxyplot re-emitting only when its ownobj/is cold, not a real change. Both figures were reproduced here to confirm that is all it is.dotnet test: 462 passed, 0 failed.Restore introduced no
packages.lock.jsonchanges.Scope
Touches only
Services/KeepAwake/and one comment inAbstractStreamingDevice.cs— disjoint from every open PR (#224/#225/#226/#233 tests + DiskSpace + PlotLogger, #227 converters, #229tools/+docs/, #232SummaryFlyout.axaml), each checked withgh pr diff --name-only.Review history
Qodo round 1 flagged that the reworded comment claimed non-Windows heads "log-and-skip" while the guard has no
elsebranch and logs nothing. Correct, and worth recording where it came from: the original comment attributed that behaviour toNoOpKeepAwakeService, which also only returnedtruewithout logging — so the claim was already wrong, and rewording it into a statement about this code made it directly misleading. Fixed in74829dd; the comment now says other heads skip the block entirely and log nothing.Noted, not acted on
DaqifiViewModel.LatestFirmwareVersionText(line 1593) also has zero C# and zero XAML references. Left alone — it belongs to a live class rather than this cluster, and folding an unrelated one-off into a deletion PR would weaken the argument. Flagging it for whoever picks up the next pass.