fix(gui): JobRunner surfaces FailedToStart + UTF-8/unbuffered child env (#117, #118)#134
Open
prekabreki wants to merge 1 commit into
Open
fix(gui): JobRunner surfaces FailedToStart + UTF-8/unbuffered child env (#117, #118)#134prekabreki wants to merge 1 commit into
prekabreki wants to merge 1 commit into
Conversation
…child env (#117, #118) JobRunner fired started.emit() unconditionally but never connected errorOccurred, so a QProcess::FailedToStart -- which fires ONLY errorOccurred, never finished() -- left the chip "running" forever, the poll timer looping and the controls disabled (#117). Connect errorOccurred and, on FailedToStart, clear _proc and emit finished(-1), mirroring CaptureRunner. Guarded on `_proc is not None` so a non-start error that also fires finished() can't emit finished twice. JobRunner also decoded the child's stdout as UTF-8 but set no process environment, so on Windows a Python child writing to a pipe used the ANSI code page (mojibake in the hours-long console) and block-buffered its output (#118). Factor CaptureRunner's local _utf8_environment() into a shared deciwaves.gui.proc_env.utf8_environment(), add PYTHONUNBUFFERED=1, and use it in BOTH runners. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Two GUI audit findings against
JobRunner(the hours-long pipeline console runner insrc/deciwaves/gui/jobs.py).CaptureRunner(setup/doctor) already handled both correctly; this bringsJobRunnerin line and dedupes the shared piece.#117 (audit H2) — FailedToStart wedged the UI
JobRunner.start()firedstarted.emit()unconditionally and never connectederrorOccurred. OnQProcess::FailedToStart(e.g. a missing/mistyped program), QProcess fires onlyerrorOccurred, neverfinished— so the finish handler never ran, the chip stayed "running" forever, the poll timer looped, and controls stayed disabled.Fix: connect
errorOccurred; onFailedToStartclear_procand emitfinished(-1), mirroringCaptureRunner. Guarded on_proc is not Noneso a non-start error that also firesfinished()can't emitfinishedtwice.#118 (audit H3) — no UTF-8/unbuffered child env
JobRunnerdecoded child stdout as UTF-8 but set no process environment, so on Windows a Python child writing to a pipe fell back to the ANSI code page (mojibake for non-ASCII paths / issue #59's em-dash) and block-buffered its output.Fix: factored
CaptureRunner's local_utf8_environment()into a small shared moduledeciwaves.gui.proc_env.utf8_environment()(matching this package'scli_command.pyshared-helper idiom), addedPYTHONUNBUFFERED=1, and used it in both runners.Tests
Added to
tests/gui/test_jobs.py:test_failed_to_start_finishes_instead_of_hanging— starting a non-existent program emitsfinished(-1)rather than hanging.test_child_env_forces_utf8_unbuffered— the shared helper setsPYTHONUTF8=1/PYTHONIOENCODING=utf-8/PYTHONUNBUFFERED=1, andJobRunneractually passes all three through to its child.ruff check src testsclean; fullpytest -qgreen (1129 passed, 33 skipped).Did not touch
shell.py(owned by another task).Closes #117
Closes #118
🤖 Generated with Claude Code