test(windows): C-1 pre-fix tests for Windows-specific bugs

Pre-fix test suite for 7 Windows-specific findings. All tests
are SHARED (no build tags) — they compile and run on Linux
using source file inspection and direct function calls.

Tests added:
- F-C1-1 HIGH: Winget PATH-only search (2 tests)
- F-C1-2 MEDIUM: Winget text parser spaces bug (4 tests)
- F-C1-3 HIGH: Ghost updates — no post-install verification (3 tests)
- F-C1-4 RESOLVED: Service auto-restart already configured (1 test)
- F-C1-5 HIGH: Duplicated polling loop missing B-2 fixes (5 tests)
- F-C1-6 LOW: Winget uses fmt.Printf (2 tests)
- F-C1-7 LOW: Service has emojis in logs (2 tests)

Current state: 8 FAIL, 11 PASS. All prior tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 08:51:44 -04:00
parent 799c155d94
commit 38184a9625
6 changed files with 705 additions and 0 deletions

58
docs/C1_PreFix_Tests.md Normal file
View File

@@ -0,0 +1,58 @@
# C-1 Pre-Fix Test Suite
**Date:** 2026-03-29
**Branch:** culurien
**Purpose:** Document Windows-specific bugs BEFORE fixes.
**Reference:** docs/C1_Windows_Audit.md
---
## Test Files
| File | Package | Tag | Bugs |
|------|---------|-----|------|
| `scanner/winget_path_test.go` | `scanner` | SHARED | F-C1-1 |
| `scanner/winget_parser_test.go` | `scanner` | SHARED | F-C1-2, F-C1-8 |
| `scanner/winget_logging_test.go` | `scanner` | SHARED | F-C1-6 |
| `scanner/windows_ghost_test.go` | `scanner` | SHARED | F-C1-3 |
| `scanner/windows_service_parity_test.go` | `scanner` | SHARED | F-C1-4, F-C1-5, F-C1-7 |
All tests read source files as text — no Windows APIs needed.
All compile and run on Linux. Zero platform-specific imports.
---
## State-Change Summary
| Test | Bug | Current | After Fix |
|------|-----|---------|-----------|
| TestWingetSearchesPathOnly | F-C1-1 | PASS | update |
| TestWingetChecksKnownInstallLocations | F-C1-1 | **FAIL** | PASS |
| TestWingetTextParserHandlesSpacesInPackageNames | F-C1-2 | **FAIL** | PASS |
| TestWingetTextParserCurrentlyBreaksOnSpaces | F-C1-2 | PASS | update |
| TestWingetJsonParserHandlesSpacesInPackageNames | F-C1-2 | PASS | PASS |
| TestWingetParserReturnsConsistentStructure | F-C1-2 | PASS | PASS |
| TestWindowsUpdateInstallerHasNoPostInstallVerification | F-C1-3 | PASS | update |
| TestWindowsUpdateInstallerVerifiesPostInstallState | F-C1-3 | **FAIL** | PASS |
| TestWindowsUpdateSearchCriteriaExcludesInstalled | F-C1-3 | PASS | PASS |
| TestWindowsServiceHasAutoRestartOnCrash | F-C1-4 | PASS | PASS |
| TestWindowsServicePollingLoopHasFixedJitter | F-C1-5 | PASS | update |
| TestWindowsServicePollingLoopHasProportionalJitter | F-C1-5 | **FAIL** | PASS |
| TestWindowsServicePollingLoopHasNoExponentialBackoff | F-C1-5 | PASS | update |
| TestWindowsServicePollingLoopHasExponentialBackoff | F-C1-5 | **FAIL** | PASS |
| TestPollingLoopIsNotDuplicated | F-C1-5 | **FAIL** | PASS |
| TestWingetScannerUsesStructuredLogging | F-C1-6 | PASS | update |
| TestWingetScannerHasNoFmtPrintf | F-C1-6 | **FAIL** | PASS |
| TestWindowsServiceHasEmojiInLogs | F-C1-7 | PASS | update |
| TestWindowsServiceHasNoEmojiInLogs | F-C1-7 | **FAIL** | PASS |
**8 FAIL** (assert post-fix), **11 PASS** (document state).
---
## Notes
1. F-C1-4 was resolved during testing: `SetRecoveryActions` already exists in the service code. The audit finding was incorrect.
2. All tests are SHARED (no build tags) — they read source files as text.
3. Winget parser tests (Part 2) call Go functions directly — they test pure parsing logic.
4. All prior B-2 and A-series agent tests continue to pass.