Bug Fixes
lager battery <net> tuinow works for the first time. The OLD WebSocket battery monitor crashed at module load withImportError: cannot import name '_resolve_net_and_driver' from 'lager.power.battery.dispatcher'— that symbol existed at module level only in the supply dispatcher, never the battery one. Nobody had reported the bug because nobody had tested the battery TUI before. Incidentally fixed by the VISA-ownership unification below; the battery monitor now also emits abattery_driver_readyevent mirroringsupply_driver_readyfor client symmetry.- Concurrent SCPI access on the same instrument now serializes correctly. Two
/invokerequests against the same cached driver inbox/lager/hardware_service.pycould race on the SCPI bus and produceQuery INTERRUPTEDpyvisa errors. Added a per-(device_name, address)lock that wraps every driver call. Multi-channel devices (e.g., Rigol DP821) correctly share one lock since they share one VISA session.
Improvements
- VISA session ownership unified. The supply and battery WebSocket monitors no longer open their own pyvisa sessions in monitor threads. They now route every driver call through
hardware_service.py:/invokevia the existingDeviceHTTP proxy.hardware_service.py(port 8080) is the sole owner of pyvisa sessions per(device_name, address). The v0.16.5POST /cache/clearband-aid is removed — this is the architectural fix that replaces it. Net effect: TUIs are more robust, no longer trip on stale cached sessions, andQuery INTERRUPTEDerrors during simultaneous TUI + CLI activity are gone. - Battery handlers consolidated. ~670 lines of duplicate battery-handler code in
box/lager/box_http_server.py(parallel to the modularbox/lager/http_handlers/battery.py) were deleted.box_http_server.pynow imports and registers the modular versions, matching what was already done for supply. - Test hygiene. Two unit tests in
test/unit/cli/test_performance_improvements.pyhad been silently failing since the.lagerconfig format was migrated to JSON-only. Tempfiles now use{"LAGER": {...}}JSON; full unit suite is back to 141/141 passing.

