Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6272,6 +6272,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
ack->setProperty("ok",opened);
ack->setProperty("error",error);
ack->setProperty("instanceId",token);
// G-MV36: correlate the HWND result to its exact GUI click.
// The requestId is feedback only; it is not installed PCM proof.
ack->setProperty("requestId",args.getProperty("requestId",juce::var()));
if(browser_.loaded)browser_.emitEventIfBrowserIsVisible(
"arMixRoutingFxEditorAck",juce::var(ack.release()));
if(opened)diagnostics_.record("ROUTED_FX_EDITOR_OPENED",
Expand Down
149 changes: 146 additions & 3 deletions tests/approved_native_m2_contract.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,8 @@ test("P0 real slot VST3 power and native editor use verified instance tokens",()
assert.match(bridge,/requestAdmittedFxPower\(t,action,btn\)/);
assert.match(bridge,/FX rack unchanged/);
assert.match(bridge,/pendingM4RackPowers/);
assert.match(bridge,/action:"routingFxEditor"/);
assert.match(read("web/approved-fx-rack-view-model.js"),/action:"routingFxEditor"/);
assert.match(bridge,/dispatchPhysicalFxEditor\(plan,lease,"M4"\)/);
assert.match(bridge,/action:plan\.action,requestId,\.\.\.plan\.payload/);
assert.match(read("web/approved-fx-rack-view-model.js"),
/action:"routingFxBypass"/);
Expand Down Expand Up @@ -3618,7 +3619,9 @@ test("ImmerSIB opens the exact native ChannelId HWND, survives VST3 editor, no s
assert.match(bridge,/fxRackVM\.editorNavigationPlan\(current,/);
assert.match(editorVM,/view\.raw\?\.mixerSession\?\.authority==="CHANNEL_ID"/);
assert.match(bridge,/else \{\s*\/\/ Both vendor VST3 and ImmerSIB retain their exact real/);
assert.match(bridge,/backend\.emitEvent\("arMixAction",\{action:"routingFxEditor",\s*channelId:editor\.channelId,slot:editor\.slot,/);
assert.match(bridge,/openChannelIdFxEditor\(editor\)/);
assert.match(bridge,/fxRackVM\.nativeEditorDispatchPlan\(current,lease,/);
assert.match(bridge,/dispatchPhysicalFxEditor\(plan,lease,"CHANNEL_ID"\)/);
assert.match(bridge,/else if\(editor\.authority==="LOGICAL"\)/);
assert.match(bridge,/action:"logicalVendorFxEditor"/);
assert.doesNotMatch(bridge,/else status\("Native VST3 editor opened"\)/);
Expand Down Expand Up @@ -4980,7 +4983,9 @@ test("MV-9B bridge uses only accepted native snapshots for global FX, fences M4
"globalPowerSettlement","m4SlotPowerAckResult","m4SlotPowerSettlement"])
assert.match(bridge,new RegExp("fxRackVM\\."+name+"\\("));
assert.match(bridge,/const current=controller\?\.state\(\)\?\.current;\s*const button=document\.getElementById\?\.\("globalFxToggle"\)/);
assert.match(bridge,/onAccepted:\(next,confirmed\)=>\{\s*onNativeReadback\(next,confirmed\);\s*syncGlobalFxReadback\(\);/);
assert.match(bridge,/onAccepted:\(next,confirmed\)=>\{\s*onNativeReadback\(next,confirmed\);/);
assert.match(bridge,/fxRackVM\.nativeEditorAckResult\(pendingFxEditorAck,null,accepted,/);
assert.match(bridge,/pendingFxEditorAck=null;\s*syncGlobalFxReadback\(\);/);
assert.match(bridge,/const apply=\(\)=>controller\.onSnapshot\(snapshot\);/);
assert.doesNotMatch(bridge,/controller\.onSnapshot\(snapshot\);syncGlobalFxReadback/);
assert.doesNotMatch(bridge,/const actual=snapshot\?\.globalFxBypassed;/);
Expand Down Expand Up @@ -6399,6 +6404,144 @@ test("G-MV35 native MOVE/REMOVE FX demands installed ChannelId hardware owner",(
assert.doesNotMatch(pure,/backend\.emitEvent|document\.|window\.|setTimeout/);
});

test("G-MV36 ChannelId vendor FX editor dispatch retains exactly one physical instance lease",()=>{
const channelId="9007199254740993",epoch="31",revision="45",rosterRevision="18";
const device={epoch,sampleRate:48000,bufferFrames:256,
enabledInputs:[0,1],enabledOutputs:[0,1]};
const hardwareConfiguration=protocol.nativeHardwareConfiguration(device);
const snap={admitted:true,retained:false,device,raw:{
mixerSession:{authority:"CHANNEL_ID",deviceEpoch:epoch}},graph:{
revision,rosterRevision,capabilities:{callbackOwnsChannelIds:true},
channels:[{id:channelId,role:"INPUT",inserts:[
{id:"vst3-instance",catalogId:"vendor.alpha",bypassed:false}]}]
}};
const original=JSON.stringify(snap);
const navigation=fxRackVM.editorNavigationPlan(snap,{
channelId,slot:0,hardwareConfiguration});
assert.equal(navigation.kind,"OPEN");
assert.equal(navigation.lease.authority,"CHANNEL_ID");
const plan=(snapshot=snap,lease=navigation.lease,hw=hardwareConfiguration)=>
fxRackVM.nativeEditorDispatchPlan(snapshot,lease,{hardwareConfiguration:hw});
assert.deepEqual(plan(),{kind:"READY",action:"routingFxEditor",payload:{
channelId,slot:0,instanceId:"vst3-instance",deviceEpoch:epoch,revision}});
assert.equal(Object.isFrozen(navigation.lease),true);
for(const bad of [null,{}, {...navigation.lease,authority:"LOGICAL"},
{...navigation.lease,workspaceToken:"other"}, {...navigation.lease,slot:1}])
assert.equal(plan(snap,bad).kind,"UNAVAILABLE");
for(const mutate of [
s=>{s.device.epoch="32";},s=>{s.device.enabledInputs=[2,3];},
s=>{s.raw.mixerSession.authority="M4";},
s=>{s.raw.mixerSession.deviceEpoch="32";},
s=>{s.admitted=false;},s=>{s.retained=true;},
s=>{s.graph.revision="46";},s=>{s.graph.rosterRevision="19";},
s=>{s.graph.capabilities.callbackOwnsChannelIds=false;},
s=>{s.graph.channels[0].inserts[0].id="replacement";},
s=>{s.graph.channels[0].inserts[0].catalogId="vendor.beta";},
s=>{s.graph.channels[0].inserts=[];}
]){
const next=clone(snap);mutate(next);
assert.equal(plan(next,navigation.lease,
protocol.nativeHardwareConfiguration(next.device)).kind,"UNAVAILABLE");
}
assert.equal(plan(snap,navigation.lease,"wrong-device").kind,"UNAVAILABLE");
assert.equal(fxRackVM.nativeEditorDispatchPlan(snap,navigation.lease,{
hardwareConfiguration,offline:true}).kind,"UNAVAILABLE");
assert.equal(JSON.stringify(snap),original,"pure editor plan never writes PCM");
});
test("G-MV36 correlated FX HWND ACK guards request, device, roster, and plugin instance",()=>{
const channelId="9007199254740993",epoch="51",revision="46";
const device={epoch,sampleRate:48000,bufferFrames:256,
enabledInputs:[0,1],enabledOutputs:[0,1]};
const hardwareConfiguration=protocol.nativeHardwareConfiguration(device);
const native={admitted:true,retained:false,device,raw:{
mixerSession:{authority:"CHANNEL_ID",deviceEpoch:epoch}},graph:{
revision,rosterRevision:"19",capabilities:{callbackOwnsChannelIds:true},
channels:[{id:channelId,role:"INPUT",inserts:[
{id:"native-fx-8",catalogId:"vendor.vst3"}]}]
}};
const nav=fxRackVM.editorNavigationPlan(native,{
channelId,slot:0,hardwareConfiguration});
assert.equal(nav.kind,"OPEN");
const pending={authority:"CHANNEL_ID",requestId:"fx-editor-7",lease:nav.lease};
const verdict=(p=pending,ack=null,snapshot=native,hw=hardwareConfiguration)=>
fxRackVM.nativeEditorAckResult(p,ack,snapshot,{
hardwareConfiguration:hw,verifiedM4:true});
assert.equal(verdict(null,{requestId:pending.requestId,
instanceId:"native-fx-8",ok:true}),"IGNORE");
assert.equal(verdict(),"IGNORE");
assert.equal(verdict(pending,{requestId:"old",instanceId:"native-fx-8",
ok:false}),"IGNORE");
assert.equal(verdict(pending,{requestId:pending.requestId,
instanceId:"wrong",ok:true}),"REJECTED");
assert.equal(verdict(pending,{requestId:pending.requestId,
instanceId:"native-fx-8",ok:false}),"REJECTED");
assert.equal(verdict(pending,{requestId:pending.requestId,
instanceId:"native-fx-8",ok:true}),"ACKED");
assert.equal(verdict(pending,{instanceId:"native-fx-8",ok:true}),"IGNORE");
assert.equal(fxRackVM.nativeEditorAckResult(pending,null,native,{
hardwareConfiguration,offline:true}),"STALE");
for(const mutate of [
s=>{s.graph.rosterRevision="20";},
s=>{s.graph.revision="47";},
s=>{s.graph.channels[0].inserts[0].id="retired";},
s=>{s.raw.mixerSession.authority="M4";},
s=>{s.device.enabledOutputs=[2,3];}
]){
const updated=clone(native);mutate(updated);
const hw=protocol.nativeHardwareConfiguration(updated.device);
assert.equal(verdict(pending,null,updated,hw),"STALE");
assert.equal(verdict(pending,{requestId:pending.requestId,
instanceId:"native-fx-8",ok:true},updated,hw),"STALE");
}
const m4Device={epoch:"55",sampleRate:48000,bufferFrames:256,
enabledInputs:[0,1],enabledOutputs:[0,1]};
const m4Hw=protocol.nativeHardwareConfiguration(m4Device);
const m4={admitted:false,retained:false,device:m4Device,raw:{
mixerSession:{authority:"M4",deviceEpoch:"55",routeRevision:"12",
channels:Array.from({length:10},()=>({role:"INPUT"}))},
legacyM4:{active:true,routeAccepted:true,nativeBusStructural:false,
routingRevision:"12",fxInstances:Array.from({length:10},()=>[])}
}};
m4.raw.legacyM4.fxInstances[4][0]={
instanceId:"m4-fx",catalogId:"vendor.m4",bypassed:false};
const accepted=fxRackVM.m4EditorDispatchPlan(m4,{
channel:4,slot:0,instanceId:"m4-fx",deviceEpoch:55,revision:12,
verifiedM4:true,hardwareConfiguration:m4Hw});
assert.equal(accepted.kind,"READY");
const m4Pending={requestId:"fx-editor-9",authority:"M4",lease:accepted.lease};
const m4Result=(p=m4Pending,ack=null,snapshot=m4,hw=m4Hw)=>
fxRackVM.nativeEditorAckResult(p,ack,snapshot,{
verifiedM4:true,hardwareConfiguration:hw});
assert.equal(m4Result(),"IGNORE");
assert.equal(m4Result(m4Pending,{requestId:"fx-editor-7",
instanceId:"m4-fx",ok:true}),"IGNORE");
assert.equal(m4Result(m4Pending,{requestId:"fx-editor-9",
instanceId:"m4-fx",ok:true}),"ACKED");
const replacement=clone(m4);
replacement.raw.legacyM4.fxInstances[4][0].catalogId="other";
assert.equal(m4Result(m4Pending,null,replacement),"STALE");
assert.equal(m4Result(m4Pending,null,m4,"old-hardware"),"STALE");
assert.equal(m4Result({...m4Pending,authority:"LOGICAL"}),"STALE");
});
test("G-MV36 one correlated native editor transport and JUCE echo, no duplicate toast",()=>{
const bridge=read("web/approved-native-bridge.js"),
main=read("src/Main.cpp"),viewmodel=read("web/approved-fx-rack-view-model.js");
assert.match(main,/if \(action == "routingFxEditor"\) \{/);
assert.match(main,/ack->setProperty\("requestId",args\.getProperty\("requestId",juce::var\(\)\)\);/);
assert.match(main,/ack->setProperty\("instanceId",token\);/);
assert.match(bridge,/function dispatchPhysicalFxEditor\(plan,lease,authority\)/);
assert.match(bridge,/backend\.emitEvent\("arMixAction",\{action:plan\.action,requestId,\.\.\.plan\.payload\}\);/);
assert.match(bridge,/dispatchPhysicalFxEditor\(plan,lease,"M4"\)/);
assert.match(bridge,/dispatchPhysicalFxEditor\(plan,lease,"CHANNEL_ID"\)/);
assert.match(bridge,/if\(logicalView\|\|fxRackVM\.nativeEditorDispatchPlan\(current,lease,/);
assert.match(bridge,/pendingFxEditorAck=null; \/\/ expire old native HWND/);
assert.match(bridge,/fxRackVM\.nativeEditorAckResult\(pendingFxEditorAck,ack,accepted,/);
assert.match(bridge,/if\(verdict==="IGNORE"\)return; \/\/ obsolete, duplicate or unrelated ACK/);
assert.match(bridge,/fxRackVM\.nativeEditorAckResult\(pendingFxEditorAck,null,accepted,/);
assert.doesNotMatch(bridge,/if\(ack\?\.ok!==true\)\s*nativeToast\(ack\?\.error\|\|/);
assert.doesNotMatch(viewmodel,/backend\.emitEvent|document\.|window\.|setTimeout/);
});

test("G-MV37 one physical ChannelId M/ST policy validates exact accepted input",()=>{
const id="9007199254740993",hw="asio|48000|256|0,1|0,1";
const graph={revision:"45",rosterRevision:"8",
Expand Down
10 changes: 5 additions & 5 deletions tests/imersip_p92_catalog_contract_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def test_immersib_rack_opens_real_native_editor_without_fake_toast(self):
host=source("src/Main.cpp")
self.assertIn("fxRackVM.editorNavigationPlan(current,",bridge)
self.assertIn('view.raw?.mixerSession?.authority==="CHANNEL_ID"',editor_vm)
self.assertRegex(bridge,
r'backend\.emitEvent\("arMixAction",\{action:"routingFxEditor",\s*'
r'channelId:editor\.channelId,slot:editor\.slot,\s*'
r'instanceId:editor\.instanceId,deviceEpoch:editor\.deviceEpoch,\s*'
r'revision:editor\.graphRevision\}\)')
self.assertIn("openChannelIdFxEditor(editor)",bridge)
self.assertIn("fxRackVM.nativeEditorDispatchPlan(current,lease,",bridge)
self.assertIn('dispatchPhysicalFxEditor(plan,lease,"CHANNEL_ID")',bridge)
self.assertIn('action:"routingFxEditor"',editor_vm)
self.assertIn('ack->setProperty("requestId",args.getProperty("requestId",juce::var()))',host)
self.assertNotIn('else status("Native VST3 editor opened")',bridge)
self.assertIn("ImerSipP92Editor*>(editor)",host)
self.assertIn("std::make_unique<PluginEditorWindow>",host)
Expand Down
35 changes: 35 additions & 0 deletions web/approved-fx-rack-view-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,40 @@
Object.keys(current.lease).every(key=>current.lease[key]===lease[key]);
}

// G-MV36: physical ChannelId VST3 / ImmerSIB editors use the original
// JUCE HWND only when the EXACT G-MV31 accepted instance lease survives.
// Logical .smix and native built-in /preview/ editor owners stay separate.
function nativeEditorDispatchPlan(snapshot,lease,{
hardwareConfiguration,offline=false}={}){
if(offline||lease?.authority!=="CHANNEL_ID"||
!editorNavigationLeaseMatches(snapshot,lease,{hardwareConfiguration}))
return {kind:"UNAVAILABLE"};
return {kind:"READY",action:"routingFxEditor",
payload:{channelId:lease.channelId,slot:lease.slot,
instanceId:lease.instanceId,deviceEpoch:lease.deviceEpoch,
revision:lease.graphRevision}};
}
// One pure HWND ACK policy for M4 and ChannelId: transport requestId AND
// installed FX instance must match, and the current accepted hardware,
// route, roster, catalog and owner must still hold the exact click lease.
// Called with ack=null by the controller on every accepted PCM snapshot;
// this retires stale HWND requests even if the native host never responds.
function nativeEditorAckResult(pending,ack,snapshot,{
verifiedM4=false,offline=false,hardwareConfiguration}={}){
if(!pending)return "IGNORE";
const lease=pending.lease;
const valid=pending.authority==="CHANNEL_ID"?
!offline&&lease?.authority==="CHANNEL_ID"&&
editorNavigationLeaseMatches(snapshot,lease,{hardwareConfiguration}):
pending.authority==="M4"&&
m4EditorDispatchLeaseMatches(snapshot,lease,{
verifiedM4,offline,hardwareConfiguration});
if(!valid)return "STALE";
if(!ack||ack.requestId!==pending.requestId)return "IGNORE";
if(ack.instanceId!==lease.instanceId||ack.ok!==true)return "REJECTED";
return "ACKED";
}

// G-MV34: one physically admitted ChannelId FX owner for bypass/insert.
// The bridge supplies the canonical existing native device fingerprint.
// Historical pure/partial fixtures without the optional fingerprint stay
Expand Down Expand Up @@ -599,6 +633,7 @@
return Object.freeze({powerReadback,mountedRackMatches,
m4Presentation,nativePowerSettlement,m4PowerPlan,m4RackAckResult,
m4RackSettlement,m4EditorDispatchPlan,m4EditorDispatchLeaseMatches,
nativeEditorDispatchPlan,nativeEditorAckResult,
m4InsertPlan,m4InsertAckResult,m4InsertReadbackSettlement,
editorNavigationPlan,editorNavigationLeaseMatches,m4EditorPlan,
nativeInsertPlan,nativeEditPlan,nativeInsertSettlement,
Expand Down
Loading
Loading