From 33a3bcf59bffe4ed99b4def9578fc3b91bdb2dc1 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 16 Nov 2026 11:51:16 +0000 Subject: [PATCH 1/3] Test that an error in the update on start-up is reported and followed An error the errors table does not name, raised in the update on start-up, was neither reported to the update complete callbacks nor followed by the next check, and it was raised into the code that registered the data file, so building a Pipeline could fail on it. Update polling catches such an error, reports it as AUTO_UPDATE_UNKNOWN_ERROR and schedules the next check, and the specification asks for every check to be reported once it ends, the update on start-up included. --- .../tests/test_datafile_update_http.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py b/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py index bd43899d..88d9a4c3 100644 --- a/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py +++ b/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py @@ -1290,5 +1290,53 @@ def testTheNextPolledCheckStillAppliesAGoodFile(self): UpdateStatus.AUTO_UPDATE_SUCCESS], self.statuses) +class StartUpCheckErrorTests(UpdateServiceTestCase): + """! + data-updates.md line 354. Every check MUST be reported to + onUpdateCallbacks once it ends, the update on start-up included, so an + error the errors table does not name is reported as + AUTO_UPDATE_UNKNOWN_ERROR and logged, the next check is scheduled, and + registering the data file does not raise into the code that built the + Pipeline. + """ + + def setUp(self): + super().setUp() + self.data_file.update_on_start = True + self.data_file.updated_on_start = False + self.data_file.auto_update = True + self.hold_timers() + + def update_url(): + raise ValueError("the update URL could not be made") + + self.data_file.get_update_url = update_url + + def testAnErrorOnStartUpIsLoggedAndReported(self): + self.service.register_data_file(self.data_file) + self.assertEqual( + [UpdateStatus.AUTO_UPDATE_UNKNOWN_ERROR], self.statuses) + errors = [message for level, message in self.pipeline.logs + if level == "error"] + self.assertEqual(1, len(errors), self.pipeline.logs) + self.assertTrue(errors[0].startswith( + "An unhandled error occurred while checking for automatic " + "updates for engine 'FakeEngine'. Error detail: "), errors[0]) + self.assertIn("the update URL could not be made", errors[0]) + self.assertFalse(self.data_file.updating) + + def testTheNextCheckIsScheduledAfterAnErrorOnStartUp(self): + self.service.register_data_file(self.data_file) + self.assertEqual(1, len(self.pending)) + self.get(response(200)) + self.data_file.get_update_url = lambda: URL + scheduled = self.pending.pop() + scheduled.function(*scheduled.args).join() + self.assertEqual([b"new"], self.data_file.refreshed) + self.assertEqual( + [UpdateStatus.AUTO_UPDATE_UNKNOWN_ERROR, + UpdateStatus.AUTO_UPDATE_SUCCESS], self.statuses) + + if __name__ == "__main__": unittest.main() From 200ddc39c1c6d98ea13ee8baf493568f5975dd89 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 16 Nov 2026 12:01:41 +0000 Subject: [PATCH 2/3] Write the start-up check tests from the whole of the Errors section The first version of these tests expected the update on start-up to log its error and swallow it, as update polling does. The specification says the opposite for the update on start-up, which passes the error to its caller instead of logging it, while still reporting how the check ended and still scheduling the next check. --- .../tests/test_datafile_update_http.py | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py b/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py index 88d9a4c3..62bfb516 100644 --- a/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py +++ b/pipeline/fiftyone_pipeline_engines/tests/test_datafile_update_http.py @@ -1292,12 +1292,18 @@ def testTheNextPolledCheckStillAppliesAGoodFile(self): class StartUpCheckErrorTests(UpdateServiceTestCase): """! - data-updates.md line 354. Every check MUST be reported to - onUpdateCallbacks once it ends, the update on start-up included, so an - error the errors table does not name is reported as - AUTO_UPDATE_UNKNOWN_ERROR and logged, the next check is scheduled, and - registering the data file does not raise into the code that built the - Pipeline. + An error the errors table does not name, raised in the update on + start-up. data-updates.md line 354 says every check MUST be reported + to onUpdateCallbacks once it ends, "including the checks made by + update polling, by the file watcher, by the update on start-up and by + a programmatic call". Lines 477 to 478 say "A programmatic check, the + update on start-up and an update from memory pass the error to their + caller instead of logging it", and lines 475 to 476 say a failure + "MUST NOT stop later checks for updates". + + So the check is reported as AUTO_UPDATE_UNKNOWN_ERROR, the error + reaches the caller that registered the data file, nothing is logged, + and the next check is still scheduled. """ def setUp(self): @@ -1306,27 +1312,34 @@ def setUp(self): self.data_file.updated_on_start = False self.data_file.auto_update = True self.hold_timers() + self.failure = ValueError("the update URL could not be made") def update_url(): - raise ValueError("the update URL could not be made") + raise self.failure self.data_file.get_update_url = update_url - def testAnErrorOnStartUpIsLoggedAndReported(self): - self.service.register_data_file(self.data_file) + def register(self): + """Registers the data file, which makes the update on start-up, + and returns the error it passed to this caller.""" + with self.assertRaises(ValueError) as caught: + self.service.register_data_file(self.data_file) + return caught.exception + + def testTheErrorIsReportedAndPassedToTheCaller(self): + self.assertIs(self.failure, self.register()) self.assertEqual( [UpdateStatus.AUTO_UPDATE_UNKNOWN_ERROR], self.statuses) - errors = [message for level, message in self.pipeline.logs - if level == "error"] - self.assertEqual(1, len(errors), self.pipeline.logs) - self.assertTrue(errors[0].startswith( - "An unhandled error occurred while checking for automatic " - "updates for engine 'FakeEngine'. Error detail: "), errors[0]) - self.assertIn("the update URL could not be made", errors[0]) self.assertFalse(self.data_file.updating) - def testTheNextCheckIsScheduledAfterAnErrorOnStartUp(self): - self.service.register_data_file(self.data_file) + def testTheErrorIsNotLogged(self): + self.register() + self.assertEqual( + [], [message for level, message in self.pipeline.logs + if level == "error"]) + + def testTheNextCheckIsScheduledAndStillAppliesAGoodFile(self): + self.register() self.assertEqual(1, len(self.pending)) self.get(response(200)) self.data_file.get_update_url = lambda: URL From e91be0906ebc25a515c33c9096343369cce046a9 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 16 Nov 2026 13:19:14 +0000 Subject: [PATCH 3/3] Report how the update on start-up ended, and schedule the next check An error the errors table does not name, raised in the update on start-up, was neither reported to the update complete callbacks nor followed by the next check. The specification asks for every check to be reported once it ends, the update on start-up included, for the update on start-up to pass its error to the caller rather than logging it, and for a failure never to stop later checks. The error is now reported as AUTO_UPDATE_UNKNOWN_ERROR, which schedules the next check, and is then raised on to the caller. --- .../datafile_update_service.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.py b/pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.py index 8c89000c..f68b6ea4 100644 --- a/pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.py +++ b/pipeline/fiftyone_pipeline_engines/src/fiftyone_pipeline_engines/datafile_update_service.py @@ -754,9 +754,20 @@ def check_next_update(self, data_file, run_after_error = False): if data_file.update_on_start and not data_file.updated_on_start and not run_after_error: self._log("info", "Updating on start-up") - # The update on start-up logs and reports a failure as update - # polling does. - self._check(data_file, to_caller=False) + # The update on start-up logs and reports a failure of the + # errors table as update polling does. An error the table does + # not name is reported in the same way, so that every check is + # reported once it ends, and then passed to the caller that + # registered the data file rather than logged, which is what + # the update on start-up does with an error. The report + # schedules the next check, so one error never stops later + # checks. + try: + self._check(data_file, to_caller=False) + except Exception: + self._end_check( + data_file, UpdateStatus.AUTO_UPDATE_UNKNOWN_ERROR, True) + raise elif data_file.auto_update: