Repository navigation
Fix zero-total acquisition progress and thread exception logging - #1251
Merged
Merged
Conversation
Avoid dividing by nonpositive Z-stack image totals in progress updates, show unknown remaining time, and allow later valid updates to recover. Always stop progress timers before reading acquisition state, including when capture stops before its first image. Repair both thread exception handlers so QueueHandler retains the original traceback without a formatting error. Reuse analysis: - Repair AcquireBarController.progress_bar and its existing stop helper. - Repair the existing SelfLockThread and SynchronizedThreadPool handlers; no parallel progress, validation, or logging abstraction is added. - Document the progress fallback and stop behavior in the owning method. Validation: 105 acquisition/controller tests passed, including 10 new regressions; repository pre-commit hooks and Ruff lint passed.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fixes are consistent with the described failures and have appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes acquisition progress handling for invalid totals and preserves thread exception tracebacks.
Changes:
- Safely resets progress for invalid Z-stack totals and early stops.
- Corrects exception logging in worker threads.
- Adds regression coverage for progress and thread recovery.
| File | Description |
|---|---|
src/navigate/controller/sub_controllers/acquire_bar.py |
Handles invalid totals and stopping safely. |
src/navigate/controller/thread_pool.py |
Corrects exception logging calls. |
test/controller/sub_controllers/test_acquire_bar.py |
Tests invalid totals, recovery, and stopping. |
test/controller/test_thread_pool.py |
Tests traceback logging and resource reuse. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1251 +/- ##
===========================================
+ Coverage 67.16% 67.18% +0.01%
===========================================
Files 210 210
Lines 31068 31072 +4
===========================================
+ Hits 20868 20876 +8
+ Misses 10200 10196 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
annie-xd-wang
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Z-stack frame can reach the progress display with
number_z_steps == 0, raisingZeroDivisionErrorand interrupting the capture loop. The worker's exception handler then raises a logging-formatTypeError, obscuring the original failure.This change handles nonpositive Z-stack totals by resetting both progress bars and showing
--:--:--for remaining time; normal progress resumes when valid totals return. Stop now cancels progress timers before reading acquisition state, including when no frames have arrived. Both thread exception handlers use valid logging arguments and preserve the original traceback throughQueueHandler.Validation:
The existing progress and thread handlers are repaired in place; the implementation and reuse rationale are recorded in b87f77cd4. Test isolation is corrected in beab0116a.