Files
Redflag/docs/D1_PreFix_Tests.md
jpetree331 2c98973f87 test(machineid): D-1 pre-fix tests for machine ID duplication bugs
Pre-fix tests for 5 machine ID findings. Tests FAIL where they
assert correct post-fix behavior, PASS where they document bugs.

Tests added:
- F-D1-1 HIGH: Registration fallback unhashed format (4 tests)
- F-D1-1: Hash function and format consistency (3 tests)
- F-D1-2 MEDIUM: No machine ID recovery path (2 tests)
- F-D1-3 LOW: Dead example_integration.go code (2 tests)
- F-D1-4 LOW: Windows redundant machineid.ID() retry (2 tests)
- F-D1-5 LOW: client.go fmt.Printf for errors (2 tests)

Current state: 6 FAIL, 9 PASS. All prior tests pass.

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

48 lines
2.0 KiB
Markdown

# D-1 Pre-Fix Test Suite
**Date:** 2026-03-29
**Branch:** culurien
**Purpose:** Document machine ID duplication bugs BEFORE fixes.
**Reference:** docs/D1_MachineID_Audit.md
---
## Test Files
| File | Package | Bugs |
|------|---------|------|
| `system/machine_id_fallback_test.go` | `system` | F-D1-1 |
| `system/machine_id_format_test.go` | `system` | F-D1-1 |
| `system/machine_id_winpath_test.go` | `system` | F-D1-4 |
| `middleware/machine_id_recovery_test.go` | `middleware_test` | F-D1-2 |
| `logging/example_integration_test.go` | `logging` | F-D1-3 |
| `client/machine_id_logging_test.go` | `client` | F-D1-5 |
Note: `machine_id_winpath_test.go` uses this name (not `_windows_test.go`) to avoid Go's `_windows` filename suffix filtering which excludes files on Linux builds.
Note: `hashMachineID` is unexported but accessible from `system` package tests (same package).
---
## State-Change Summary
| Test | Bug | Current | After Fix |
|------|-----|---------|-----------|
| TestRegistrationFallbackIsNotHashed | F-D1-1 | PASS | update |
| TestRegistrationFallbackUsesCanonicalFunction | F-D1-1 | **FAIL** | PASS |
| TestMachineIDIsAlways64HexChars | F-D1-1 | PASS | PASS |
| TestRegistrationAndRuntimeUseSameCodePath | F-D1-1 | **FAIL** | PASS |
| TestAllMachineIDFallbacksProduceSameFormat | F-D1-1 | PASS | PASS |
| TestHashMachineIDAlwaysProduces64HexChars | F-D1-1 | PASS | PASS |
| TestUnknownFallbackFormatDifferentFromHash | F-D1-1 | PASS | update |
| TestMachineBindingHasNoUpdatePath | F-D1-2 | PASS | update |
| TestMachineBindingShouldHaveUpdatePath | F-D1-2 | **FAIL** | PASS |
| TestExampleIntegrationFileIsDeadCode | F-D1-3 | PASS | update |
| TestExampleIntegrationFileDoesNotExist | F-D1-3 | **FAIL** | PASS |
| TestWindowsFallbackHasRedundantRetry | F-D1-4 | PASS | update |
| TestWindowsFallbackUsesAlternativeSources | F-D1-4 | **FAIL** | PASS |
| TestClientMachineIDErrorUsesFmtPrintf | F-D1-5 | PASS | update |
| TestClientMachineIDErrorUsesStructuredLogging | F-D1-5 | **FAIL** | PASS |
**6 FAIL** (assert post-fix), **9 PASS** (document current state).