fix(gui): wait for hw lock before auto-centering after mount #243

Closed
duan_j wants to merge 3 commits from fix/auto-center-after-mount-wait-idle into main
pull from: fix/auto-center-after-mount-wait-idle
Owner

Problem

"apply after mounting" never triggered auto-centering.

The server publishes the new sample (cfg.current_sample, mounting/service.py) while the
mount op still holds the hw lock (state change, events, screenshot). The GUI fired
find_tip.click() on the sample-id change, /alc/center_loop acquires the lock
non-blocking -> BeamlineBusyException -> request rejected, no retry.

Fix

  • data_collection_settings._track_sample arms a pending flag on mount and clicks on the
    first status tick with busy == False (busy == hw lock held). Unmount clears it.
  • Skipped while queue automation runs (SampleQueuePanel.automation_running_changed):
    /scan/auto centers each sample itself and frees the lock between samples, so a GUI
    centering in that gap could steal the lock from the next /scan/auto and stop the queue.

Test

New tests: waits for hw lock release; skipped during queue automation.
tests/unit/gui/test_data_collection_settings.py: 34 passed.

Not yet verified on the beamline.

Generated with Claude Code (https://claude.com/claude-code)

## Problem "apply after mounting" never triggered auto-centering. The server publishes the new sample (cfg.current_sample, mounting/service.py) while the mount op still holds the hw lock (state change, events, screenshot). The GUI fired find_tip.click() on the sample-id change, /alc/center_loop acquires the lock non-blocking -> BeamlineBusyException -> request rejected, no retry. ## Fix - data_collection_settings._track_sample arms a pending flag on mount and clicks on the first status tick with busy == False (busy == hw lock held). Unmount clears it. - Skipped while queue automation runs (SampleQueuePanel.automation_running_changed): /scan/auto centers each sample itself and frees the lock between samples, so a GUI centering in that gap could steal the lock from the next /scan/auto and stop the queue. ## Test New tests: waits for hw lock release; skipped during queue automation. tests/unit/gui/test_data_collection_settings.py: 34 passed. Not yet verified on the beamline. Generated with Claude Code (https://claude.com/claude-code)
duan_j added 1 commit 2026-09-29 11:15:22 +02:00
fix(gui): wait for hw lock before auto-centering after mount
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m1s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m26s
CI / lint (pull_request) Successful in 1m35s
CI / test (3.12) (pull_request) Successful in 1m37s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m40s
CI / test-with-coverage (pull_request) Successful in 1m42s
CI / test (3.13) (pull_request) Successful in 1m45s
CI / test (3.14) (pull_request) Successful in 1m47s
CI / coverage-analysis (pull_request) Successful in 3s
43054dc0e8
The server publishes the new sample while the mount still holds the hw
lock, and /alc/center_loop takes that lock non-blocking, so the click
fired on the sample-id change was rejected as busy and never retried.
Arm on mount, fire on the first non-busy status tick instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Coverage report (automated)

Total line + branch coverage: 51%
Diff coverage vs main: 100% (minimum 80%)

Full report: coverage artifact on this run.

Coverage report (automated) Total line + branch coverage: 51% Diff coverage vs main: 100% (minimum 80%) Full report: coverage artifact on this run.
duan_j added 1 commit 2026-09-29 11:20:45 +02:00
fix(gui): skip mount auto-centering during queue automation
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Successful in 1m18s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m41s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m44s
CI / test (3.12) (pull_request) Successful in 1m46s
CI / test (3.13) (pull_request) Successful in 1m45s
CI / test (3.14) (pull_request) Failing after 1m45s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m49s
CI / test-with-coverage (pull_request) Successful in 1m58s
CI / coverage-analysis (pull_request) Successful in 4s
f49f34cd27
Automation centers each sample itself and frees the hw lock between
samples; waiting for idle made the GUI fire center_loop in that gap,
which could steal the lock from the next /scan/auto and stop the queue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
duan_j added 1 commit 2026-09-29 11:25:39 +02:00
fix(gui): gate mount auto-centering on in-flight /scan/auto, not queue flag
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 31s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 32s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Failing after 31s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Failing after 30s
CI / test (3.14) (pull_request) Failing after 32s
CI / test-with-coverage (pull_request) Failing after 35s
CI / coverage-analysis (pull_request) Skipped
CI / test (3.13) (pull_request) Failing after 40s
CI / test (3.12) (pull_request) Successful in 1m19s
039c56a9e9
Pause flips the queue's running flag while the current sample is still
being processed, so a mount seen after Pause armed a centering on an
already handled sample. Track the /scan/auto request instead; a counter
because the queue sends the next scan before the done signal reaches us.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
duan_j closed this pull request 2026-09-29 16:50:29 +02:00
duan_j deleted branch fix/auto-center-after-mount-wait-idle 2026-09-29 16:50:36 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.