Skip to content

Move the background services out of Controller, and the import and export results into AnnotationIoController - #235

Merged
mfl28 merged 3 commits into
masterfrom
refactor/io-services
Oct 11, 2026
Merged

mfl28 merged 3 commits into
masterfrom
refactor/io-services

Conversation

@mfl28

@mfl28 mfl28 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Moves the background services out of Controller, and the handling of import and export results into AnnotationIoController. Behavior is unchanged.

1. IoServices

  • What it owns: the six background services (annotation import and export, image folder loading, predictions, fetching model names, the connection check).
  • Progress dialogs: one per service, reused for every run as before (ControlsFX progress dialogs never detach from their worker).
  • Failures: a failed run shows its exception.
  • Starting: startImport/startExport start imports and exports.
  • What stays in Controller: a small ResultHandlers implementation that says what to do with each result. Its service getters stay, delegating, since the UI tests use them.

2. Import and export results in AnnotationIoController

  • New methods: onExportFinished and onImportFinished decide:
    • when the annotations count as saved;
    • which folder is remembered (not the autosave folder after a restore);
    • when the error report or the "no valid annotations" message appears;
    • that the operation waiting for the export (e.g. quitting) runs.
  • View updates: these go through new Operations methods (showStatus, isRestoringAutosave, onAnnotationsImported), in the same order as before: model update, autosave restore notice, view, dialogs, remembered folder.
  • Tests: 6 new unit tests in AnnotationIoControllerTest cover a successful export, an export with errors, a successful import, an import without valid annotations, an import with invalid entries, and restoring an autosave (including the call order).

Controller goes from 1,519 to 1,461 lines.

Separate commit: TorchServeClientTest waits for a new prediction result

  • The race: each step clicked Predict and waited until the prediction service had succeeded. Until the click restarted it, the service still held the previous step's successful result, so the check could pass early and read the previous status message. It failed in 1 of 4 local runs.
  • The fix: the helper remembers the previous result and waits for a successful run with a new one (by identity, since two runs can return equal results). It then passed 5 out of 5 runs. LitServeClientTest runs one prediction per test and isn't affected.

The full suite (352 tests) passes locally apart from that race, which the second commit fixes.

mfl28 added 2 commits October 11, 2026 18:42
…port results into AnnotationIoController

IoServices owns the six background services (import, export, image folder
loading, predictions, model names, connection check), their reusable
progress dialogs and the failure handling. Controller only says what to do
with the results.

What happens after an import or export (when the annotations count as
saved, which folder is remembered, the error report, the operation that
waited for the export) moves into AnnotationIoController, covered by new
unit tests. The view updates go through its Operations, in the same order
as before.
Each step clicked Predict and waited until the service had succeeded. Until
the click restarted it, the service still held the previous step's result,
so the check could pass early and read the previous status message.
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.67089% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.47%. Comparing base (dd2cbc4) to head (5cd2da2).

Files with missing lines Patch % Lines
...mfl28/boundingboxeditor/controller/IoServices.java 91.22% 5 Missing ⚠️
...mfl28/boundingboxeditor/controller/Controller.java 94.66% 3 Missing and 1 partial ⚠️
...ngboxeditor/controller/AnnotationIoController.java 96.15% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #235      +/-   ##
============================================
+ Coverage     90.43%   90.47%   +0.03%     
- Complexity     2407     2408       +1     
============================================
  Files           141      142       +1     
  Lines          8983     9019      +36     
  Branches        862      862              
============================================
+ Hits           8124     8160      +36     
- Misses          445      446       +1     
+ Partials        414      413       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

SonarCloud (S3398): the result handlers are only used by
ServiceResultHandlers and restartEditHistory only by
AnnotationIoOperations, so their code now lives there.
@sonarqubecloud

Copy link
Copy Markdown

@mfl28
mfl28 merged commit 921087f into master Oct 11, 2026
19 checks passed
@mfl28
mfl28 deleted the refactor/io-services branch October 11, 2026 18:09
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