From 4a87ad293a7282d5b57f348f11eb05df75530089 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 29 Oct 2026 18:10:09 +0700 Subject: [PATCH 1/4] fix(routing): port reviewed #147 src/Main.cpp on latest main --- src/Main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index a759c09d3..a7f8a9f5b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -946,7 +946,23 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr action.startsWith ("import") || action.startsWith ("fx") || action == "addCatalog" || action == "addScanFolder" || action == "scanVst3" || action == "routingDryApply")) - return emitNotice ("Studio backup in progress. Finish backup before editing saved FX or VST library.", true); + { + const auto reason=juce::String( + "Studio backup in progress. Finish backup before editing saved FX or VST library."); + // R1 matrix must ALWAYS get a response after APPLY, including + // upstream rejection before the normal routing command handler. + // No graph or device state may be mutated while Studio IO is busy. + if(action=="routingDryApply" && browser_.loaded) + { + auto ack=std::make_unique(); + ack->setProperty("ok",false); + ack->setProperty("error",reason); + ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); + browser_.emitEventIfBrowserIsVisible( + "arMixRoutingLabAck",juce::var(ack.release())); + } + return emitNotice(reason,true); + } // Structural plugin operations currently detach the original callback // and must never mutate a running independent render thread. From b66a55dd34ab3f4e036e33b93aacc01ef70e8745 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 29 Oct 2026 18:10:13 +0700 Subject: [PATCH 2/4] fix(routing): port reviewed #147 web/monitor.js on latest main --- web/monitor.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/web/monitor.js b/web/monitor.js index 56a905668..6f015fa36 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -579,18 +579,11 @@ if(failure){patchFeedback("REJECTED · "+failure);return;} if(state.monitor){patchFeedback("MUTE OUTPUT FIRST · structural routing cannot be applied while speakers are armed.");return;} syncNativeLevelsToRouteDraft(); + // patchPreflight above already checked epoch, enabled ports and stereo. + // Enter pending only after *every* synchronous rejection gate has passed. patchPending=true; renderPatchMatrix(); - if(!draftEpoch || draftEpoch!==Number(d.epoch)){ - document.getElementById("arRouteFeedback").textContent= - "DEVICE CHANGED · old channel assignments discarded. Re-select the actual physical inputs."; - drawRoutes(); - return; // must never submit old ports with a newly observed epoch - } - if(!Array.isArray(d.ports)||!d.ports.length){ - document.getElementById("arRouteFeedback").textContent="Select a real ASIO/WASAPI audio input in AUDIO SETUP first.";return; - } - document.getElementById("arRouteFeedback").textContent="Applying native route (output must be MUTED)..."; + document.getElementById("arRouteFeedback").textContent="Applying verified native route (output remains MUTED)..."; api.emitEvent("arMixAction",{action:"routingDryApply",value:{ deviceEpoch:draftEpoch,revision:Number(d.revision)||0, channels:draftRoutes.map(c=>({...c})), From b86355bc1937f43bf6c6ce6b49554be8c2d33c83 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 29 Oct 2026 18:10:31 +0700 Subject: [PATCH 3/4] test(routing): regression rejected ACK and pending retry tests/live_routing_ui_contract_test.mjs --- tests/live_routing_ui_contract_test.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/live_routing_ui_contract_test.mjs b/tests/live_routing_ui_contract_test.mjs index d094a8550..bf9737296 100644 --- a/tests/live_routing_ui_contract_test.mjs +++ b/tests/live_routing_ui_contract_test.mjs @@ -205,3 +205,15 @@ test("R0 premium workspace is anchored to mixer chrome and lazily opens INTERNAL assert.match(ui,/routingDryApply/); assert.match(ui,/hydrateAcceptedRoute/); }); +test("R1 upstream Studio-IO rejection always releases native APPLY pending state",()=>{ + const first=main.indexOf('if ((studioBackupBusy_ || nativeShowBusy_)'); + const next=main.indexOf('// Structural plugin operations',first); + assert.ok(first>=0&&next>first); + const gate=main.slice(first,next); + assert.match(gate,/action=="routingDryApply"/); + assert.match(gate,/arMixRoutingLabAck/); + assert.match(gate,/setProperty\("ok",false\)/); + assert.match(ui,/patchPending=false/); + assert.match(ui,/if\(patchPending\)return/); +}); + From 3cb9c884f2cb85238e84c595021995f09d133bc8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 29 Oct 2026 18:10:36 +0700 Subject: [PATCH 4/4] test(routing): regression rejected ACK and pending retry tests/ui_smoke.py --- tests/ui_smoke.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/ui_smoke.py b/tests/ui_smoke.py index ccb9367f7..1ad7a17a8 100644 --- a/tests/ui_smoke.py +++ b/tests/ui_smoke.py @@ -1316,6 +1316,19 @@ async def image_for(selector): assert action["channels"][0]["left"]==2 and action["channels"][0]["mode"]=="MONO",action assert action["channels"][1]["left"]==2 and action["channels"][1]["right"]==5,action assert await native.locator("#arRouteApply").is_disabled() + # Busy Studio IO must reject with native ACK and unlock APPLY (no + # fake LIVE green cell or reinitialization of the user's draft). + await native.evaluate("""()=>{ + const d=window.__arPatchStatus.dryRoutingLab; + window.__arMixMockEvents.arMixRoutingLabAck({ + ok:false,error:"Studio backup in progress",state:d + }); + }""") + assert await native.locator("#arRouteApply").is_enabled() + assert "REJECTED" in await native.locator("#arRouteFeedback").inner_text() + assert await native.locator('[data-patch-row="0"][data-patch-port="2"].arPatchCell').get_attribute("data-patch-state")=="draft" + await native.locator("#arRouteApply").click() + assert await native.locator("#arRouteApply").is_disabled() await native.evaluate("""()=>{ const d=window.__arPatchStatus.dryRoutingLab; d.active=true;d.ready=true;d.revision=1;