Commit graph

3 commits

Author SHA1 Message Date
SwiftWing21
3d2d894a33 fix(proxy): defer file logging install to create_app()
Move _setup_file_logging() from module import to create_app() so
importing headroom.proxy.server in tests or library contexts no longer
silently attaches a RotatingFileHandler to the user's live proxy.log.

This was discovered via PR #303: running the test suite produced
"Optimization failed: TimeoutError" entries in ~/.headroom/logs/proxy.log
because TestClient instantiations from test_proxy_anthropic_compression_diagnostics.py
inherited the module-level handler.

Add a regression test that imports the server module in a subprocess
and asserts no RotatingFileHandler is attached to the headroom logger.

Refs #303 (review thread).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 15:28:33 -07:00
JerrettDavis
0d48d4cd58 test(pr208): add coverage for is_anthropic_auth, file logging, repro helpers, and wrap paths
Boosts patch coverage by testing uncovered code paths in the PR diff:
- is_anthropic_auth header detection (6 cases)
- _setup_file_logging with new _headroom_log_dir path + OSError handling
- repro_codex_replay: _http_to_ws_url, _classify_exit, format_summary, build_parser
- CodexWsStats.record_error and AnthropicHttpStats dataclasses
- LatencyHistogram percentile boundary conditions
- wrap.py _get_log_path using headroom.paths module

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 14:13:45 -05:00
JerrettDavis
eb83f403d7 test: add coverage for PR #208 changes
Tests for jitter_delay_ms helper, asyncio.timeout shim, release workflow
--allow-same-version flag validation, SIGKILL fallback on Windows, and
LatencyHistogram from the repro harness script.

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