testsAndMisc/docs/superpowers/evidence/brother-printer-stuck-job-2026-10-12.json
Krzysztof kuhy Rudnicki c4d5631054
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
fix(brother_printer): truthful probe note, pyusb auto-install, stuck-job detection
The CUPS-fallback note blamed a missing pyusb when the probe was really
skipped because CUPS owned the printer. It now names the real reason.
run.sh installs python-pyusb for the system python3 that sudo runs.

A paper misfeed blocks the usb:// backend while CUPS keeps saying
"processing", and cancel leaves that backend hung so the queue never
recovers. The report now flags a job whose page counter is frozen for
15 s, and a backend of a cancelled job, with a y/N offer to SIGKILL it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaBRWtXXWCs3K3yPHSruUC
2026-10-12 16:23:48 +02:00

49 lines
2.5 KiB
JSON

{
"intent": "The Brother status report stops lying while a job is stuck: it names the real reason the USB probe was skipped, installs pyusb on its own, and flags a stalled job (paper misfeed) or a hung backend left behind by a cancelled job.",
"scope": [
"python_pkg/brother_printer/{_stuck_job,_cups_fallback,cups_service,constants,data_classes,display}.py, run.sh, tests",
"Non-goal: fixing the printer's paper pick-up, which is mechanical"
],
"changes": [
"USBResult.probe_note carries _usb_probe_skip_reason(): CUPS busy / pyusb missing / printer silent; display prints it instead of 'pyusb not available'",
"run.sh ensure_pyusb: probes /usr/bin/python3 (what sudo runs; the user's python3 is a pyenv shim) and pacman-installs python-pyusb",
"_stuck_job.py: scans /proc for usb://Brother backends; orphaned backend of a cancelled job -> cups:backend-orphaned + y/N SIGKILL offer; job-impressions-completed frozen 15 s -> cups:job-stalled",
"41xxx status now reads 'Out of Paper / not feeding' since a misfeed sets the same paper-empty bit"
],
"verification": [
{
"command": "./run.sh during stalled job 105 (2026-10-12 16:01)",
"result": "pass",
"evidence": "Note: USB status probe skipped: CUPS has a job on the printer; status obtained via CUPS only."
},
{
"command": "fake orphan (exec -a usb://Brother/... sleep 40) + display_usb_results with stdin y",
"result": "pass",
"evidence": "Queue blocked by a hung backend of a cancelled job / Kill hung backend PID 960784 ... Backend killed; process gone"
},
{
"command": "flag_stuck_job with frozen vs moving counter",
"result": "pass",
"evidence": "frozen: cups:job-stalled after 15.0s; moving: cleared after 1.0s"
},
{
"command": "python3 -m pytest -q --cov=python_pkg.brother_printer --cov-branch python_pkg/brother_printer/tests",
"result": "pass",
"evidence": "431 passed, coverage 100.00%"
},
{
"command": "lpr Krasnale-sie-rzadza.pdf (jobs 106, 107 pages 52-55), monitored via ipptool",
"result": "pass",
"evidence": "all 55 pages on paper, user-confirmed; printer back at 10001 Ready"
}
],
"risks": [
"Stall window is 15 s: a healthy run froze the counter up to ~9 s, so a very slow first page could false-flag",
"A status run during printing now blocks up to 15 s while it samples progress"
],
"rollback": [
"git revert the commit",
"Run ./run.sh on an idle printer and confirm Ready 10001"
]
}