From c2e5e4a4e8c90a6df601ba6fbe975596bac91357 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 19 Oct 2026 22:11:51 +0200 Subject: [PATCH] broker: initialize clears the image buffer, turns live rugnux off and removes its model Initialize is the fresh start between users, so nothing of the previous one's session is left: the image buffer is cleared, live rugnux processing is disabled and the uploaded MR model is dropped. It is done at the start of Initialize, under m then rugnux_mutex (the order the other setters take), so it happens even if configuring the detector then fails. The receiver is always Idle when the state machine is not running, so the buffer clear has no unmet precondition. The dashboard's rugnux panel read the settings only once, on mount, so after an initialize from any client it kept showing the previous run; it now polls them like the Rugnux tab does. The /initialize description in jfjoch_api.yaml says so; the frontend client is regenerated (description only). The python client docs and redoc follow at the release. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4 --- broker/JFJochStateMachine.cpp | 12 ++++++++++++ broker/jfjoch_api.yaml | 1 + .../src/client/@tanstack/react-query.gen.ts | 1 + frontend/src/client/sdk.gen.ts | 1 + frontend/src/components/RugnuxStatus.tsx | 5 +++-- tests/JFJochStateMachineTest.cpp | 19 +++++++++++++++++++ 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index ccadf4949..ddc009829 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -329,6 +329,18 @@ void JFJochStateMachine::Initialize() { ResetError(); // Clear error, we don't care what was it start_exception = nullptr; // Re-initialising discards a pending start failure + // A fresh start: no images from before, and no live rugnux analysis or model left over from the + // previous user. + services.ClearImageBuffer(); + { + std::unique_lock ul2(rugnux_mutex); + RugnuxLiveSettings s = services.GetRugnuxLive(); + s.enable = false; + s.model = nullptr; + s.model_size_bytes = 0; + services.SetRugnuxLive(s); + } + logger.Info("Initialize"); SetState(JFJochState::Busy, "Configuring indexing threads", BrokerStatus::MessageSeverity::Info); try { diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index d142b8ede..4e9768dae 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -2917,6 +2917,7 @@ paths: This operation will reconfigure network interface of the detector. During operation of the detector it is recommended to use the `POST /pedestal` operation instead. If storage cells are used, the execution time might be few minutes. + It also clears the image buffer, disables live rugnux analysis and removes the rugnux model. This is async function - one needs to use `POST /wait_till_done` to ensure operation is done. responses: diff --git a/frontend/src/client/@tanstack/react-query.gen.ts b/frontend/src/client/@tanstack/react-query.gen.ts index db804e38d..04691c492 100644 --- a/frontend/src/client/@tanstack/react-query.gen.ts +++ b/frontend/src/client/@tanstack/react-query.gen.ts @@ -16,6 +16,7 @@ import type { deleteConfigRugnuxModelData, deleteConfigRugnuxModelError, getConf * This operation will reconfigure network interface of the detector. * During operation of the detector it is recommended to use the `POST /pedestal` operation instead. * If storage cells are used, the execution time might be few minutes. + * It also clears the image buffer, disables live rugnux analysis and removes the rugnux model. * * This is async function - one needs to use `POST /wait_till_done` to ensure operation is done. * diff --git a/frontend/src/client/sdk.gen.ts b/frontend/src/client/sdk.gen.ts index 9e0922bea..1da0a08e2 100644 --- a/frontend/src/client/sdk.gen.ts +++ b/frontend/src/client/sdk.gen.ts @@ -28,6 +28,7 @@ export type Options