From 145b300fa2a4e82cd4b02e6c8e6288239548ba03 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Tue, 23 Jun 2026 18:27:04 +0200 Subject: [PATCH] broker: fail the run loudly when the writer breaks mid-acquisition A writer connection that dropped mid-run left a truncated file, yet the acquisition was still logged as "finished with success": the writer error returned by ImagePusher::Finalize() (set via transmission_error on a broken session connection) was captured into receiver_output.writer_err but never acted upon. Treat a non-empty writer_err as a failed acquisition: throw so it is reported as "finished with error" and surfaced to the caller, instead of silently succeeding with incomplete data. Applies to both the Lite and FPGA workflows, which share this stop/finalize path. Combined with the liveness changes (which no longer tear a connection down for a transient stall), this fires only on a genuine writer break. Co-Authored-By: Claude Opus 4.8 --- broker/JFJochServices.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 1d30ed54..b5913a81 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -122,6 +122,14 @@ JFJochServicesOutput JFJochServices::Stop() { ret.receiver_output.received_packets[i], ret.receiver_output.expected_packets[i]); } } + + // A writer that broke mid-run (e.g. a lost connection) leaves a truncated file. + // Surface that as a failed acquisition instead of silently reporting success. + if (!ret.receiver_output.writer_err.empty()) + throw JFJochException(JFJochExceptionCategory::FileWriteError, + "Writer error, written data may be incomplete: " + + ret.receiver_output.writer_err); + logger.Info(" ... finished with success"); } catch (const JFJochException &e) { logger.Error(" ... finished with error {}", e.what());