From a90378d851a67b4cfa3fa6000631315bd364a804 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 19 Nov 2026 11:11:39 +0700 Subject: [PATCH 1/5] refactor(g-mv27): extract one-shot control authority selector to pure Strip VM --- web/approved-channel-strip-view-model.js | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/web/approved-channel-strip-view-model.js b/web/approved-channel-strip-view-model.js index 161f4dfad..9bbbd3627 100644 --- a/web/approved-channel-strip-view-model.js +++ b/web/approved-channel-strip-view-model.js @@ -551,6 +551,34 @@ return "UNAVAILABLE"; } + // G-MV27: one-shot controls use a pure authority selector, not divergent + // button/double-click branches. MV-10 gesture scheduling remains independent. + function controlCommandPlan({operation,trackKind,logical=false, + logicalReadOnly=false,logicalPending=false,logicalChannelId=null, + logicalSupported=false,authority="",admitted=false,graphConnected=false, + nativeChannelId=null,nativeSupported=false,m4Verified=false, + m4Channel=-1,masterAuthority="UNAVAILABLE"}={}) { + if(!["SET_FADER","SET_PAN","SET_MUTE","SET_SOLO"].includes(operation)) + return "BLOCK"; + if(logical)return logicalReadOnly!==true && logicalPending!==true && + decimalId(logicalChannelId) && logicalSupported===true?"LOGICAL":"BLOCK"; + // The physical MAIN host gateway owns its gain/mute even under ChannelId. + // Never fall through to ChannelId SET_FADER or SET_MUTE for MAIN. + if(trackKind==="master") + return ["SET_FADER","SET_MUTE"].includes(operation) && + ["CHANNEL_ID","M4"].includes(masterAuthority)?"MAIN_HOST":"BLOCK"; + if(!trackKind)return "BLOCK"; + if(authority==="M4") + return trackKind==="audio" && m4Verified===true && + Number.isInteger(m4Channel) && m4Channel>=0 && m4Channel<10? + "M4":"BLOCK"; + if(authority==="CHANNEL_ID") + return admitted===true && graphConnected===true && + decimalId(nativeChannelId) && nativeSupported===true? + "CHANNEL_ID":"BLOCK"; + return "BLOCK"; + } + // MV-9: pure Channel Strip scalar gesture/readback policy. The only // pending Maps, native events, timers and audio transport stay in the // approved bridge. Treat exact decimal-string ChannelIds as opaque data. @@ -744,7 +772,7 @@ sourceAckResult,sourceReadbackSettlement, m4SourceReadbackSettlement,sourceQueueReadback,sourceQueueAckTransition, sourceQueueTimeoutDecision, - masterScalarAuthority,scalarIdentityMatches,scalarVisualSettlement,m4ScalarAckResult, + masterScalarAuthority,controlCommandPlan,scalarIdentityMatches,scalarVisualSettlement,m4ScalarAckResult, m4ScalarReadbackSettlement,scalarDispatchLease, scalarGestureFlushPlan,scalarDispatchPlan, identityReadback,identityEditPlan, From 1addd976d16977371460a4ec07f89cf5a1efcb43 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 19 Nov 2026 11:12:13 +0700 Subject: [PATCH 2/5] refactor(g-mv27): one command route for mute solo and unity resets; deny stale field fallback --- web/approved-native-bridge.js | 98 ++++++++++++++++------------------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 8010c6d86..288e1f993 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -3273,6 +3273,39 @@ }else status("NATIVE ARM REJECTED: "+(ack?.error||"device not ready")); }); } + // G-MV27: UI actions (MUTE/SOLO/unity resets) share one pure native + // authority plan, separate from MV-10's coalesced pointer gesture lane. + // IPC, request IDs, ACK/readback and the PCM owner remain unchanged. + function controlCommandRoute(operation,t) { + const current=controller?.state()?.current,id=nativeIdFor(t); + return stripVM.controlCommandPlan({ + operation,trackKind:t?.kind,logical:!!logicalView, + logicalReadOnly:logicalView?.readOnly===true, + logicalPending:!!pendingLogical,logicalChannelId:id, + logicalSupported:logicalView?.graph?.capabilities?.supportedOps?.includes(operation)===true, + authority:mixerSession()?.authority,admitted:current?.admitted===true && + current?.retained!==true,graphConnected:flags.acceptedGraphConnected, + nativeChannelId:id, + nativeSupported:current?.graph?.capabilities?.supportedOps?.includes(operation)===true, + m4Verified:m4Verified(),m4Channel:m4Index(t), + masterAuthority:t?.kind==="master"?nativeMasterAuthority():"UNAVAILABLE" + }); + } + function dispatchControlCommand(operation,t,payload) { + const route=controlCommandRoute(operation,t); + if(route==="LOGICAL"||route==="CHANNEL_ID") + return intent(operation,t,payload); + if(route==="M4"||route==="MAIN_HOST"){ + const parameter=route==="MAIN_HOST"? + operation==="SET_FADER"?"masterGain":"masterMute": + {SET_FADER:"faderDb",SET_PAN:"pan",SET_MUTE:"mute",SET_SOLO:"solo"}[operation]; + const value=operation==="SET_FADER"?payload?.valueDb: + operation==="SET_PAN"?payload?.value*100:payload?.enabled; + return sendM4Control(parameter,t,value); + } + status("Native "+operation+" unavailable · verify mixer authority/readback"); + return false; + } const nativeHooks=Object.freeze({ enabled:connected, requestDeleteTrack:requestNativeTrackDelete, @@ -3501,19 +3534,11 @@ } return true; } - const numeric=Number(el.value); - if (field==="level"&&Number.isFinite(numeric)) - intent("SET_FADER",t,{valueDb:numeric}); - else if (field==="pan"&&Number.isFinite(numeric)) { - // Preserve hardware center detent without publishing demo PAN state. - const fine=el.dataset.panKeyboard==="true"; - const bypass=el.dataset.panAltPointer==="true"; - const value=!fine&&!bypass&&Math.abs(numeric)<=12?0:numeric; - intent("SET_PAN",t,{value:value/100}); - } else { - status("NATIVE: "+field+" awaits native capability; reference graph unchanged"); - scope?.render?.(); // restore SELECT/route control from accepted graph - } + // If the streaming preflight refused a live field, do NOT bypass + // it by sending an unguarded ChannelId intent on pointer release. + if(field==="level")el.value=String(t.level); + else if(field==="pan")el.value=String(t.pan); + status("NATIVE: "+field+" awaits accepted control/readback"); return true; }, consumeAction(t,action,btn) { @@ -3666,28 +3691,10 @@ status("PFL not armed · independent physical MONITOR output required"); return true; } - if (action==="mute"||action==="solo") { - // MAIN has one host scalar gateway. A refused native MAIN lease - // must never fall through to generic ChannelId SET_MUTE/SOLO. - if(t.kind==="master"){ - // Offline .smix remains an editable durable logical mixer: - // its native logical-intent owner is distinct from physical PCM. - if(logicalView){ - intent(action==="mute"?"SET_MUTE":"SET_SOLO",t, - {value:!t[action],enabled:!t[action]}); - }else if(action==="mute" && nativeMasterAuthority()!=="UNAVAILABLE"){ - if(!sendM4Control("masterMute",t,!t.mute)) - status("Native MAIN mute rejected"); - }else status("MAIN mute unavailable · verified PCM required"); - return true; - } - if(m4ControlIsOwner()&&m4Verified()&&m4Index(t)>=0){ - if(!sendM4Control(action,t,!t[action])) - status("Native M4 mute/solo rejected"); - return true; - } - const key=action==="mute"?"SET_MUTE":"SET_SOLO"; - intent(key,t,{value:!t[action],enabled:!t[action]});return true; + if(action==="mute"||action==="solo"){ + dispatchControlCommand(action==="mute"?"SET_MUTE":"SET_SOLO", + t,{value:!t[action],enabled:!t[action]}); + return true; } status("NATIVE: "+action+" is not an accepted ChannelId operation");return true; }, @@ -3939,20 +3946,7 @@ status("SOF unity reset unavailable · select one admitted SEND"); return true; } - // MAIN reset must not become an unrelated ChannelId SET_FADER - // when its native physical host scalar lease is not admitted. - if(t?.kind==="master"){ - // An offline MAIN unity reset edits the logical .smix document, - // never the unavailable physical host/ChannelId PCM authority. - if(logicalView)intent("SET_FADER",t,{valueDb:0}); - else if(nativeMasterAuthority()!=="UNAVAILABLE") - sendM4Control("masterGain",t,0); - else status("MAIN reset unavailable · verified PCM required"); - return true; - } - if(m4ControlIsOwner()&&m4Verified()) - sendM4Control("faderDb",t,0); - else intent("SET_FADER",t,{valueDb:0}); + dispatchControlCommand("SET_FADER",t,{valueDb:0}); } else if(event.target.closest?.(".gain-dial")){ if(t?.kind!=="audio"||t.nativeGainAvailable!==true) @@ -3960,10 +3954,8 @@ else intent("SET_INPUT_GAIN",t,{valueDb:0}); return true; } - else if(event.target.classList.contains("center-pan")){ - if(m4ControlIsOwner()&&m4Verified())sendM4Control("pan",t,0); - else intent("SET_PAN",t,{value:0}); - } + else if(event.target.classList.contains("center-pan")) + dispatchControlCommand("SET_PAN",t,{value:0}); else if(event.target.closest?.(".footer-label,.strip-identity-top")) openNativeIdentity(t,event.target); return true; From 355b8b7b63d5fdd4c691ddf328ed47048c88418b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 19 Nov 2026 11:12:38 +0700 Subject: [PATCH 3/5] test(g-mv27): authority matrix for exact logical M4 ChannelId MAIN one-shot commands --- ...proved_scalar_view_model_contract.test.cjs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/approved_scalar_view_model_contract.test.cjs b/tests/approved_scalar_view_model_contract.test.cjs index 57eb08b5c..6789b78d1 100644 --- a/tests/approved_scalar_view_model_contract.test.cjs +++ b/tests/approved_scalar_view_model_contract.test.cjs @@ -89,6 +89,60 @@ test("G-MV26 MAIN scalar gate uses current PCM authority, never stale M4 status" /document\.|window\.|backend|setTimeout|AudioContext|emitEvent/); }); +test("G-MV27 one-shot controls use exactly one authority and fail closed",()=>{ + const plan=p=>vm.controlCommandPlan({operation:"SET_MUTE",trackKind:"audio", + authority:"CHANNEL_ID",admitted:true,graphConnected:true, + nativeChannelId:bigId,nativeSupported:true,...p}); + for(const operation of ["SET_FADER","SET_PAN","SET_MUTE","SET_SOLO"]) + assert.equal(plan({operation}),"CHANNEL_ID"); + assert.equal(plan({authority:"M4",admitted:false,m4Verified:true, + m4Channel:4,nativeSupported:false}),"M4"); + assert.equal(plan({authority:"M4",admitted:false,m4Verified:false, + m4Channel:4}),"BLOCK","stale M4 cannot become ChannelId request"); + assert.equal(plan({authority:"M4",admitted:false,m4Verified:true, + m4Channel:10}),"BLOCK"); + assert.equal(plan({authority:"M4",admitted:false,m4Verified:true, + trackKind:"bus",m4Channel:4}),"BLOCK"); + assert.equal(plan({authority:"CHANNEL_ID",admitted:false,m4Verified:true, + m4Channel:4}),"BLOCK","stale M4 cannot authorize ChannelId"); + assert.equal(plan({nativeSupported:false}),"BLOCK"); + assert.equal(plan({graphConnected:false}),"BLOCK"); + assert.equal(plan({nativeChannelId:Number(bigId)}),"BLOCK", + "uint64 ChannelId is not a rounded JS number"); + assert.equal(plan({authority:"NONE",m4Verified:true,m4Channel:4}),"BLOCK"); + assert.equal(plan({trackKind:"master",operation:"SET_MUTE", + masterAuthority:"CHANNEL_ID"}),"MAIN_HOST"); + assert.equal(plan({trackKind:"master",operation:"SET_FADER", + masterAuthority:"M4"}),"MAIN_HOST"); + assert.equal(plan({trackKind:"master",operation:"SET_SOLO", + masterAuthority:"CHANNEL_ID"}),"BLOCK"); + assert.equal(plan({trackKind:"master",operation:"SET_PAN", + masterAuthority:"CHANNEL_ID"}),"BLOCK"); + assert.equal(plan({trackKind:"master",operation:"SET_MUTE", + masterAuthority:"UNAVAILABLE"}),"BLOCK"); + assert.equal(plan({operation:"SET_OUTPUT_ARM"}),"BLOCK"); + assert.equal(plan({logical:true,authority:"NONE",admitted:false, + logicalChannelId:bigId,logicalSupported:true}),"LOGICAL"); + assert.equal(plan({logical:true,trackKind:"master",operation:"SET_MUTE", + masterAuthority:"UNAVAILABLE",logicalChannelId:bigId, + logicalSupported:true}),"LOGICAL","offline MAIN never needs physical PCM"); + assert.equal(plan({logical:true,logicalReadOnly:true, + logicalChannelId:bigId,logicalSupported:true}),"BLOCK"); + assert.equal(plan({logical:true,logicalPending:true, + logicalChannelId:bigId,logicalSupported:true}),"BLOCK"); + assert.equal(plan({logical:true,logicalSupported:false, + logicalChannelId:bigId}),"BLOCK"); + assert.equal(plan({logical:true,logicalChannelId:"0", + logicalSupported:true}),"BLOCK"); + assert.equal(plan(), "CHANNEL_ID"); + const bridge=readFileSync("web/approved-native-bridge.js","utf8"); + assert.match(bridge,/stripVM\.controlCommandPlan\(/); + assert.equal((bridge.match(/function dispatchControlCommand\(/g)||[]).length,1); + assert.equal((bridge.match(/action:"routingM4Control"/g)||[]).length,1); + assert.doesNotMatch(vm.controlCommandPlan.toString(), + /document\.|window\.|backend|setTimeout|AudioContext|emitEvent/); +}); + test("MV-9 exact native edit identity never rounds uint64 channel/device values",()=>{ assert.equal(vm.scalarIdentityMatches(edit,identity),true); assert.equal(vm.scalarIdentityMatches(edit,{...identity,channelId:bigNext}),false); From c8bfae770e41057242af03e1e7f3b4143305ded2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 19 Nov 2026 11:12:42 +0700 Subject: [PATCH 4/5] test(g-mv27): assert SOF reset wins before unified command dispatch --- tests/approved_native_m2_contract.test.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 142ec2d55..0f5adadde 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -3919,8 +3919,8 @@ test("SOF double-click and target selection never commandeer MAIN fader",()=>{ assert.ok(start>0&&end>start,"native delegate must own double-click"); const handler=bridge.slice(start,end); assert.ok(handler.indexOf("scope?.sofEnabled") < - handler.indexOf('sendM4Control'), - "SOF must intercept fader reset BEFORE M4/Main fader ownership"); + handler.indexOf('dispatchControlCommand'), + "SOF must intercept fader reset BEFORE unified native control routing"); assert.match(handler,/requestWireGain\(\{sourceId:t\.id,edgeId:id,levelDb:0\}\)/); assert.match(handler,/intent\("SET_INPUT_GAIN",t,\{valueDb:0\}\)/); }); From 84e338991883d1e9c4cb63d7fedc364602d6060e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 19 Nov 2026 11:13:36 +0700 Subject: [PATCH 5/5] test(g-mv27): live ChannelId M4 offline and unsupported field command routing end-to-end --- tests/live_fader_held_drag.test.cjs | 114 ++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/tests/live_fader_held_drag.test.cjs b/tests/live_fader_held_drag.test.cjs index bcd9cf331..f83d390e0 100644 --- a/tests/live_fader_held_drag.test.cjs +++ b/tests/live_fader_held_drag.test.cjs @@ -150,6 +150,120 @@ test("G-MV26 offline .smix MAIN MUTE and unity reset keep logical native ACK pat } }); +test("G-MV27 ChannelId one-shot MUTE, FADER reset and PAN reset use exact native intent",()=>{ + for(const scenario of [ + {action:"mute",operation:"SET_MUTE",field:"mute"}, + {dbl:"fader",operation:"SET_FADER"}, + {dbl:"center-pan",operation:"SET_PAN"} + ]){ + const h=harness(),source=nativeChannelIdFixture(); + source.device.epoch="77";source.mixerSession.deviceEpoch="77"; + h.listeners.get("arMixConsoleSnapshot")(source); + const channel=h.scope.tracks[4]; + assert.ok(channel?.id,"accepted native strip must exist"); + if(scenario.action){ + assert.equal(h.window.__ARMIX_NATIVE_M2__.consumeAction( + channel,scenario.action,{}),true); + }else{ + assert.equal(h.window.__ARMIX_NATIVE_M2__.consumeDoubleClick({ + target:{classList:{contains:name=>name===scenario.dbl}, + closest:()=>null} + },channel),true); + } + const msg=h.sent.filter(x=>x.name==="arMixConsoleIntent").at(-1)?.payload; + assert.equal(msg?.operation,scenario.operation); + assert.equal(msg?.targetChannelId,source.graph.channels[4].id); + if(scenario.operation==="SET_MUTE")assert.equal(msg.payload.enabled,true); + if(scenario.operation==="SET_FADER")assert.equal(msg.payload.valueDb,0); + if(scenario.operation==="SET_PAN")assert.equal(msg.payload.value,0); + assert.equal(h.sent.some(x=>x.payload?.action==="routingM4Control"),false); + } +}); + +test("G-MV27 unsupported ChannelId SOLO/PAN field and reset never bypass capability gate",()=>{ + const h=harness(),s=nativeChannelIdFixture(); + s.device.epoch="77";s.mixerSession.deviceEpoch="77"; + s.graph.capabilities.supportedOps=["SET_FADER","SET_MUTE"]; + h.listeners.get("arMixConsoleSnapshot")(s); + const t=h.scope.tracks[4],native=h.window.__ARMIX_NATIVE_M2__; + const count=()=>h.sent.filter(x=>x.name==="arMixConsoleIntent" || + x.payload?.action==="routingM4Control").length; + const before=count(); + assert.equal(native.consumeAction(t,"solo",{}),true); + assert.equal(native.consumeDoubleClick({target:{ + classList:{contains:q=>q==="center-pan"},closest:()=>null}},t),true); + const el={dataset:{field:"pan",panKeyboard:"false"},lane:4, + value:"80",min:"-100",max:"100"}; + assert.equal(native.consumeField({target:el,type:"change"}),true); + assert.equal(count(),before, + "denied live PAN must not re-enter generic SET_PAN intent on release"); + assert.equal(el.value,String(t.pan),"refuse restores accepted PAN readback"); +}); + +test("G-MV27 active M4 one-shot controls use only the legacy owner and ordinal",()=>{ + const h=harness({m4:true}),s=clone(fixture),rev="3"; + const controls=()=>({faderDb:-6,pan:0,mute:false,solo:false}); + const source=()=>({mode:"MONO",left:0,right:-1,main:true,channelFormat:"MONO"}); + s.legacyM4={active:true,routeAccepted:true,routingRevision:rev, + channelControls:Array.from({length:10},controls), + channels:Array.from({length:10},source), + fxInstances:Array.from({length:10},()=>Array(8).fill(null))}; + s.mixerSession={authority:"M4",deviceEpoch:s.device.epoch,routeRevision:rev, + channels:Array.from({length:10},()=>({source:source(),main:true, + channelFormat:"MONO",controls:controls(),fxRackBypassed:false, + peakL:0.1,peakR:0.1})),main:{db:0,mute:false}}; + h.listeners.get("arMixConsoleSnapshot")(s); + const t=h.scope.tracks[4],native=h.window.__ARMIX_NATIVE_M2__; + assert.equal(native.consumeAction(t,"mute",{}),true); + assert.equal(native.consumeAction(t,"solo",{}),true); + assert.equal(native.consumeDoubleClick({target:{ + classList:{contains:x=>x==="fader"},closest:()=>null}},t),true); + assert.equal(native.consumeDoubleClick({target:{ + classList:{contains:x=>x==="center-pan"},closest:()=>null}},t),true); + const cmds=h.sent.filter(e=>e.payload?.action==="routingM4Control"); + assert.deepEqual(cmds.map(e=>[e.payload.channel,e.payload.parameter,e.payload.controlValue]), + [[4,"mute",true],[4,"solo",true],[4,"faderDb",0],[4,"pan",0]]); + assert.equal(h.sent.some(e=>e.name==="arMixConsoleIntent"),false); + const gone=clone(s);gone.legacyM4.routeAccepted=false; + h.listeners.get("arMixConsoleSnapshot")(gone); + const before=cmds.length; + native.consumeAction(t,"mute",{}); + assert.equal(h.sent.filter(e=>e.payload?.action==="routingM4Control").length,before, + "retired M4 cannot fall through to either M4 or ChannelId"); +}); + +test("G-MV27 offline .smix one-shot channel controls edit only logical document",()=>{ + for(const operation of ["SET_MUTE","SET_SOLO","SET_FADER","SET_PAN"]){ + const h=harness(),s=clone(fixture),live=nativeChannelIdFixture(); + s.productionCallbackLive=false; + s.mixerSession={authority:"NONE",deviceEpoch:s.device.epoch}; + const graph=clone(live.graph); + graph.revision="12";graph.rosterRevision="12"; + graph.capabilities.callbackOwnsChannelIds=false; + graph.capabilities.supportedOps=["SET_FADER","SET_PAN","SET_MUTE","SET_SOLO"]; + s.logicalMixer={schema:"arsonmix.native.logical-mixer.v1", + authority:"LOGICAL_ONLY",workspaceToken:"offline-gmv27", + readOnly:false,revision:"12",physicalOutputAdmitted:false, + outputArmed:false,graph}; + h.listeners.get("arMixConsoleSnapshot")(s); + const t=h.scope.tracks[4],native=h.window.__ARMIX_NATIVE_M2__; + assert.ok(t?.id,"logical read-model projects CH5"); + if(operation==="SET_MUTE"||operation==="SET_SOLO"){ + native.consumeAction(t,operation==="SET_MUTE"?"mute":"solo",{}); + }else{ + native.consumeDoubleClick({target:{classList:{ + contains:q=>q===(operation==="SET_FADER"?"fader":"center-pan")}, + closest:()=>null}},t); + } + const sent=h.sent.filter(x=>x.name==="arMixLogicalIntent"); + assert.equal(sent.length,1,"one offline "+operation+" after one action"); + assert.equal(sent[0].payload.operation,operation); + assert.equal(sent[0].payload.channelId,graph.channels[4].id); + assert.equal(h.sent.some(x=>x.name==="arMixConsoleIntent" || + x.payload?.action==="routingM4Control"),false); + } +}); + test("held ChannelId drag publishes first gain and coalesces latest BEFORE release",()=>{ const h=harness(),s=nativeChannelIdFixture(); h.listeners.get("arMixConsoleSnapshot")(s);