# D-2 Pre-Fix Test Suite

**Date:** 2026-03-29
**Branch:** culurien
**Purpose:** Document ETHOS violations BEFORE fixing them.

---

## Test Files

| File | Package | Type | Targets |
|------|---------|------|---------|
| `server/middleware/ethos_emoji_test.go` | `middleware_test` | Emoji | machine_binding.go |
| `server/handlers/ethos_emoji_test.go` | `handlers_test` | Emoji | agents.go, update handlers |
| `server/handlers/ethos_logging_test.go` | `handlers_test` | fmt.Printf | docker_reports.go, metrics.go |
| `server/handlers/ethos_setup_exempt_test.go` | `handlers_test` | Exemption | setup.go |
| `server/services/ethos_logging_test.go` | `services_test` | fmt.Printf | security_settings_service.go |
| `server/queries/ethos_logging_test.go` | `queries_test` | fmt.Printf | docker.go, metrics.go, updates.go |
| `agent/cmd/ethos_emoji_test.go` | `main` | Emoji | main.go log statements |
| `agent/migration/ethos_emoji_test.go` | `migration` | Emoji | executor.go |
| `agent/display/ethos_exempt_test.go` | `display` | Exemption | terminal.go |

## Exemptions (NOT to be touched in D-2 fix)

- `display/terminal.go` — intentional terminal UI emoji
- `handlers/setup.go` — CLI wizard output (fmt.Printf intentional)
- `cmd/agent/main.go` lines 294-322 — registration CLI output
- `cmd/agent/main.go` lines 691-697 — startup banner

## State-Change Summary

| Test | Type | Current | After Fix |
|------|------|---------|-----------|
| TestMachineBindingMiddlewareHasEmojiInLogs | Emoji | PASS | update |
| TestMachineBindingMiddlewareHasNoEmojiInLogs | Emoji | **FAIL** | PASS |
| TestAgentsHandlerHasEmojiInLogs | Emoji | PASS | update |
| TestAgentsHandlerHasNoEmojiInLogs | Emoji | **FAIL** | PASS |
| TestUpdateHandlersHaveEmojiInLogs | Emoji | PASS | update |
| TestUpdateHandlersHaveNoEmojiInLogs | Emoji | **FAIL** | PASS |
| TestHandlerFilesUseFmtPrintfForLogging | fmt.Printf | PASS | update |
| TestHandlerFilesUseStructuredLogging | fmt.Printf | **FAIL** | PASS |
| TestServicesUseFmtPrintfForLogging | fmt.Printf | PASS | update |
| TestServicesUseStructuredLogging | fmt.Printf | **FAIL** | PASS |
| TestQueriesUseFmtPrintfForLogging | fmt.Printf | PASS | update |
| TestQueriesUseStructuredLogging | fmt.Printf | **FAIL** | PASS |
| TestMainGoHasEmojiInLogStatements | Emoji | PASS | update |
| TestMainGoLogStatementsHaveNoEmoji | Emoji | **FAIL** | PASS |
| TestMigrationExecutorHasEmojiInOutput | Emoji | PASS | update |
| TestMigrationExecutorHasNoEmojiInOutput | Emoji | **FAIL** | PASS |
| TestTerminalDisplayIsExemptFromEthos | Exemption | PASS | PASS |
| TestSetupHandlerIsExemptFromEthos | Exemption | PASS | PASS |

**8 FAIL** (assert post-fix), **8 PASS** (document state), **2 ALWAYS-PASS** (exemptions).
