Skip to content

chore(core): route finder traces through SafeTrace and fix WiFi comment - #806

Draft
tylerkron wants to merge 1 commit into
mainfrom
cursor/core-hygiene-safetrace-wifi-comment-abac
Draft

tylerkron wants to merge 1 commit into
mainfrom
cursor/core-hygiene-safetrace-wifi-comment-abac

Conversation

@tylerkron

@tylerkron tylerkron commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two Core hygiene leftovers, behavior unchanged aside from routing the existing diagnostic line through the shared guard.

  • refactor(core): extract shared SafeLog/SafeTrace helper #763 leftover. DeviceFinderBase.RaiseIsolated still logged a throwing subscriber with Trace.WriteLine inside an empty catch. AllTransportsDeviceFinder already uses DiagnosticGuard.SafeTrace. This copy now does too. The line is composed inside the guard so a throwing ToString on the subscriber exception cannot escape. The outer catch that swallows subscriber exceptions stays — SafeTrace only replaces the inner logging try/catch.
  • fix(core): WiFi failure restore honors PostUsbTransparentModeExitDelay #788 comment drift. The mayBeInLanUpdateMode comment still said only the success path leaves LAN/USB-transparent mode, and that a failed or canceled flash strands the device. Cancel and failure both call TryLeaveLanUpdateModeAfterFailureAsync: best-effort SetUsbTransparencyMode(0), PostUsbTransparentModeExitDelay, then LAN:APPLY. That sequence does not persist LAN:ENAbled/SAVE. Comment only; the recovery method is untouched.

Test plan

  • DeviceFinderBaseTests (subscriber isolation) — passed, net9.0 and net10.0
  • WifiModuleUpdaterTests (comment-only; suite stays green) — passed, net9.0 and net10.0
  • DiagnosticGuardTests (SafeTrace contract the finder now depends on) — passed, net9.0 and net10.0

Local filter: FullyQualifiedName~DeviceFinderBaseTests|FullyQualifiedName~WifiModuleUpdaterTests|FullyQualifiedName~DiagnosticGuardTests — 44 passed / 0 failed on each TFM.

Open in Web Open in Cursor 

DeviceFinderBase.RaiseIsolated still traced subscriber failures with
Trace.WriteLine inside an empty catch after #763 moved the composite
finder onto DiagnosticGuard.SafeTrace. Compose that line inside SafeTrace
and keep the outer catch that isolates subscribers.

Rewrite the WifiModuleUpdater flag comment so cancel and failure match
TryLeaveLanUpdateModeAfterFailureAsync (#788): best-effort transparent-mode
exit, settle, then LAN:APPLY, without persisting LAN:ENAbled/SAVE.

Co-authored-by: Tyler Kron <tylerkron@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants