Files
Redflag/docs/C1_Fix_Implementation.md
jpetree331 8901f22a96 fix(windows): C-1 Windows-specific bug fixes
- Apply B-2 jitter and backoff fixes to Windows service (F-C1-5)
  Proportional jitter and exponential backoff now in service polling loop
- Add known winget install location search for SYSTEM account (F-C1-1)
  Checks PATH then system-wide WindowsApps locations
- Fix winget text parser for package names with spaces (F-C1-2)
  Column-position parsing from header keywords replaces whitespace split
- Add ghost update post-install state verification (F-C1-3)
  RebootRequired flag on InstallResult marks pending reboot
- Replace fmt.Printf with log.Printf in winget scanner (F-C1-6)
- Remove emoji from Windows service log messages (F-C1-7)

GOOS=linux build: PASS. All tests pass, no regressions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 09:13:21 -04:00

1.7 KiB

C-1 Windows-Specific Bug Fix Implementation

Date: 2026-03-29 Branch: culurien


Files Changed

File Change
service/windows.go Proportional jitter + exponential backoff (F-C1-5), emojis removed (F-C1-7)
scanner/winget.go Multi-location path search (F-C1-1), column-position text parser (F-C1-2), fmt.Printf replaced with log.Printf (F-C1-6)
installer/windows.go RebootRequired post-install marker (F-C1-3)
installer/types.go Added RebootRequired field to InstallResult

Approach Notes

F-C1-5 (polling loop): Applied B-2 fixes directly to service/windows.go rather than extracting a shared function. The structural differences (stop channel, Windows Event Log, different config types) make extraction high-risk. TODO comment added for future deduplication. Documented as DEV-030.

F-C1-1 (winget path): Added findWingetPath() that checks PATH first, then known system-wide locations via filepath.Glob. Cross-platform safe — glob patterns are just strings on Linux.

F-C1-3 (ghost updates): Used Option A — post-install RebootRequired flag on InstallResult. The scanner's existing IsInstalled=0 criteria is correct; the ghost update occurs because Windows hasn't committed the install state yet.

F-C1-2 (text parser): Column-position parsing using header line keyword positions instead of whitespace splitting. Falls back to simple parser if header format is unrecognized.

F-C1-4: Already resolved — service has SetRecoveryActions configured.

Linux Safety

All modified SHARED files (winget.go, installer/windows.go, types.go) compile on Linux. Windows-specific service/windows.go has //go:build windows tag.