Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,22 @@ 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.");
// Routing APPLY is an acknowledged transaction. An early IO-busy
// rejection must answer once; it must not mutate the current graph.
if (action == "routingDryApply" && browser_.loaded)
{
auto ack = std::make_unique<juce::DynamicObject>();
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.
Expand Down
19 changes: 19 additions & 0 deletions tests/live_routing_ui_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,22 @@ test("R0 premium workspace is anchored to mixer chrome and lazily opens INTERNAL
assert.match(ui,/routingDryApply/);
assert.match(ui,/hydrateAcceptedRoute/);
});

test("R1 Studio backup rejection sends one negative native ACK and leaves graph untouched",()=>{
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,/setProperty \("ok", false\)/);
assert.match(gate,/setProperty \("state", engine_\.status\(\)\.getProperty/);
assert.match(gate,/arMixRoutingLabAck/);
assert.ok(gate.indexOf("arMixRoutingLabAck") < gate.indexOf("return emitNotice"));
assert.doesNotMatch(gate,/enableDryRoutingLab|applyDryRoutingLab|disableDryRoutingLab/);
assert.match(ui,/if\(patchPending\)return/);
const apply=ui.slice(ui.indexOf('document.getElementById("arRouteApply").addEventListener'));
assert.ok(apply.indexOf("patchPreflight()")<apply.indexOf("patchPending=true"));
assert.ok(apply.indexOf("if(state.monitor)")<apply.indexOf("patchPending=true"));
assert.match(ui,/patchPending=false/);
assert.match(ui,/if\(reply\?\.ok===true\)hydrateAcceptedRoute\(\)/);
});
15 changes: 15 additions & 0 deletions tests/ui_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,21 @@ 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()
# Emulate the native Studio backup guard: rejection MUST release
# pending and preserve the uncommitted physical patch as 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()
assert await native.evaluate("""()=>window.__arMixSent.filter(
x=>x.payload?.action==='routingDryApply').length""")==2
await native.evaluate("""()=>{
const d=window.__arPatchStatus.dryRoutingLab;
d.active=true;d.ready=true;d.revision=1;
Expand Down
13 changes: 3 additions & 10 deletions web/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 checked the native epoch and real enabled ports, and
// output-MUTE was checked above. Only now disable APPLY awaiting its ACK.
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})),
Expand Down
Loading