matiasandina / matiasandina/uid_python_api
Doric preflight-armed driver is reused at runtime but stimulation startup still calls connect()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Summary
When a laser run is verified in preflight, we keep a live DoricLightSource in live_state.laser_driver and reuse it during runtime. However, StimulationController.start() still unconditionally calls driver.connect().
Why this is confusing
- Preflight launch verification already opens the Doric device and leaves it armed.
- Runtime reuses that same driver object via
live_state.laser_driver. start()still callsconnect()as if runtime owns first initialization.- This currently works only because
DoricLightSource.connect()short-circuits whenself._dll is not None.
Code references
preflight_ui.py:_arm_laser_for_launch()stores the armed driver inlive_state.laser_driver.stim_controller.py:from_config()reuseslive_state.laser_driverwhen present.stim_controller.py:start()still callsself._config.driver.connect()unconditionally.doric_light_source.py:connect()returns early when_dllis already set.
Local evidence
- Bundled Doric examples show a single lifecycle:
init -> open_device -> use -> close_device -> quit. - We did not find local documentation explicitly stating that repeated
connect()on an already-open device is supported. - In the current reuse path, the second
connect()is probably harmless because our wrapper short-circuits, but that is wrapper behavior, not a documented Doric contract.
Desired fix
- Make the preflight-armed runtime path explicit.
- Do not call
connect()again when reusing an already-armed preflight driver. - Keep runtime startup semantics clear: reuse vs fresh initialization should be distinguishable in code and UI copy.
Notes
- This is separate from UI wording cleanup.
- Preflight still blocks launch if required laser verification fails.
- After launch, runtime fault handling remains a separate behavior question.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read preflight_ui.py::_arm_laser_for_launch(), then follow stim_controller.py::from_config() and start() to trace reuse of live_state.laser_driver. Check doric_light_source.py::connect() and the bundled Doric lifecycle examples. Done means the preflight-armed path is explicit, skips a second connect(), and distinguishes reuse from fresh initialization without changing launch blocking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100