Files
Redflag/docs/D2_PreFix_Tests.md
jpetree331 0da761243b test(ethos): D-2 pre-fix tests for ETHOS compliance violations
Pre-fix tests documenting emoji in log statements and fmt.Printf
used as logging across server and agent codebases.

Tests added:
- Server emoji: machine_binding.go, agents.go, update handlers (6 tests)
- Server fmt.Printf: queries, handlers, services (6 tests)
- Agent emoji: main.go log paths, migration executor (4 tests)
- Exemptions: display/terminal.go, setup.go (2 tests, always pass)

Current state: 8 FAIL, 8 PASS, 2 ALWAYS-PASS.
All prior tests pass. No regressions.

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

54 lines
2.7 KiB
Markdown

# 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).