Repository navigation
Fix packaged backend crashing on Windows at startup - #4
Conversation
The first Windows CI run showed server.exe dying immediately with UnicodeEncodeError: when stdout is a pipe (as when Electron launches the backend), Windows Python uses cp1252, which cannot encode the emoji in the startup banner and OCR log messages. Every Windows install would have shown "processing engine did not start". - server.py: reconfigure stdout/stderr to UTF-8 (errors=replace) before importing the app - tests/test_entrypoint.py: start server.py with PYTHONIOENCODING=cp1252 and piped output and require /api/health (fails without the fix) - smoke-test-backend.ps1: stop waiting as soon as the backend exits and print its stdout/stderr, instead of polling for 90 seconds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jze3nDgZGqUXGceiu5RCAf
ECC Tools / Security EvidenceCommit: Security evidence gate passed (success) No security-sensitive scanner-evidence gap detected. Mode: enforce Scanned 3 changed file(s). No missing scanner-evidence signal was detected. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 1 PR taxonomy bucket(s): CI/CD Recommendation. Scanned 3 changed file(s). Roadmap taxonomy buckets: CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 3 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 3 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
The first run of the Windows backend package CI job (on #3) caught a ship-blocking bug:
When stdout is a pipe, which is how Electron launches the backend, Windows Python encodes output as cp1252. That code page can't encode the emoji in the startup banner or the OCR log messages, so
server.exedied immediately. Every Windows install would have shown "The processing engine did not start".Changes
backend/server.py: reconfigure stdout/stderr to UTF-8 (errors='replace') before importing the app.backend/tests/test_entrypoint.py: new test that starts the realserver.pywithPYTHONIOENCODING=cp1252and piped output, then requires/api/health. Verified it fails without the fix and passes with it.scripts/smoke-test-backend.ps1: stop waiting as soon as the backend process exits, and print its stdout/stderr. Previously it polled for 90 seconds after a crash.Testing
/api/health.ruff checkclean. The new test passes, and fails on the old code.Windows backend packagejob, which buildsserver.exewith PyInstaller and smoke-tests it with the bundled Tesseract.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jze3nDgZGqUXGceiu5RCAf
Generated by Claude Code