Skip to content

Fix/code review hal serialization#14

Merged
gbradham merged 2 commits into
mainfrom
fix/code-review-hal-serialization
Jul 9, 2026
Merged

Fix/code review hal serialization#14
gbradham merged 2 commits into
mainfrom
fix/code-review-hal-serialization

Conversation

@gbradham

@gbradham gbradham commented Jul 9, 2026

Copy link
Copy Markdown
Member

No description provided.

gbradham added 2 commits July 9, 2026 09:22
- BLEWriteDevice.write()/shutdown() now share the lock, and write()
  refuses to run or reconnect after shutdown -- prevents a late/queued
  write from re-arming a stimulator right after an emergency stop
- BaseDevice.execute_action() gates on _initialized so a shut-down
  device cannot be driven again until re-initialized
- TelemetrixBoard: offload blocking thread start/stop and set_pin_mode
  off the qasync event loop; serialize connect/disconnect with a lock;
  auto-reconnect on passive (mid-session) disconnect; clear stale pin
  caches on every disconnect path
- PiGPIOBoard.emergency_stop() skips input devices (no read-only-value
  AttributeError spam)
- HardwareManager: bound device.shutdown() with a timeout in
  disconnect_board()/shutdown_device(), matching emergency_stop()

Adds tests/unit/hal/test_base_device.py, test_pi_gpio_board.py and
tests/unit/core/test_hardware_manager.py.
- ExperimentSerializer read device.pin/.board_id/.settings, none of which
  exist on BaseDevice, so every device serialized as pin=0/board_id="" and
  failed to reload; now reads device._config.pins/.board.id/._config.settings
- reload routes through add_device_multi_pin; zero-pin devices (e.g. the BLE
  stimulator) round-trip correctly
- apply_to_session now syncs the loaded schema into the session model, with
  phantom-node filtering, so File > Save As after a load no longer overwrites
  the hardware map and flow graph with empty lists
- DeviceConfigSchema carries a pins dict; single-pin saves emit both keys so
  they stay readable by older versions (zero/multi-pin is an accepted break)
- ExperimentSession.remove_board() removes flow nodes bound to the removed
  board's devices, mirroring remove_device()
- GliderCore retains fire-and-forget tasks in a set and drains them on
  shutdown so flow-teardown cannot be GC'd or race the shutdown path

Adds tests/unit/core/test_background_tasks.py.
@gbradham gbradham merged commit b614227 into main Jul 9, 2026
10 checks passed
@gbradham gbradham deleted the fix/code-review-hal-serialization branch July 9, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant