From 28a686de1407b69713127bf49ca549dad6107fc0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:06:37 +0700 Subject: [PATCH 1/9] fix(wire): native-only inspector rollback to accepted EdgeId readback after rejected gain/timeout --- scripts/build_approved_native_gui.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index 3dbc667a7..fc3f502dd 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -239,6 +239,21 @@ def accepted_pages_html() -> str: " }\n" " }\n" " },\n" + " rollbackNativeWireInspector(rows){\n" + " const gain=document.getElementById('wireWsGain');\n" + " const text=document.getElementById('wireWsGainText');\n" + " // Rejection/expiry has no new PCM snapshot. Restore the last admitted\n" + " // readback in-place rather than leaving a forever-PENDING inspector.\n" + " if(!gain||!text?.textContent?.startsWith('PENDING · '))return false;\n" + " const id=Number(gain.dataset.wsGain);\n" + " const edge=wireEdges.find(e=>e.id===id&&e.kind!=='primary'&&e.enabled);\n" + " const row=Array.isArray(rows)?rows.find(r=>r.id===id&&Number.isFinite(r.levelDb)):null;\n" + " if(!edge||!row){gain.disabled=true;text.textContent='SEND UNAVAILABLE';return true;}\n" + " edge.levelDb=row.levelDb;\n" + " gain.value=String(row.levelDb); // same focused input, no DOM replacement\n" + " text.textContent='UNCHANGED · '+row.levelDb+' dB';\n" + " return true;\n" + " },\n" " syncVerifiedM4Wires(rows,ids){\n" " if(!Array.isArray(rows)||rows.length!==10||!Array.isArray(ids)||ids.length!==10)\n" " return false;\n" From 8925f9be07705b4ab4ab2603d3888bb336df8cef Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:07:02 +0700 Subject: [PATCH 2/9] fix(bridge): rollback pending inspector LCD on native rejection using last accepted EdgeId snapshot --- web/approved-native-bridge.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 3aa78e0d6..6108b3226 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -643,6 +643,14 @@ } return true; } + // One authoritative EdgeId gain projection for normal readback AND failure + // rollback. No duplicate DSP math or synthetic accepted control state. + function nativeWireGainReadback(next){ + return (next?.graph?.edges||[]).filter(e=>e.enabled&&e.primaryOutput===false) + .map(e=>({id:uiByWireId.get(e.edgeId),pending:pendingWireGains.has(e.edgeId), + levelDb:Math.round(Math.max(-60,Math.min(6, + e.gainLinear>0?20*Math.log10(e.gainLinear):-60))*10)/10})); + } function projectNativeGraphWithoutFocusLoss(next) { // Only identity, order, processing width, source and edges are structural. // Rack/slot bypass is applied in-place from independent readback below. @@ -658,9 +666,7 @@ lastNativeTopologySignature=structure; return true; } - scope?.syncNativeWireGains?.(next.graph.edges.filter(e=>e.enabled&&e.primaryOutput===false) - .map(e=>({id:uiByWireId.get(e.edgeId),pending:pendingWireGains.has(e.edgeId),levelDb:Math.round(Math.max(-60,Math.min(6, - e.gainLinear>0?20*Math.log10(e.gainLinear):-60))*10)/10}))); + scope?.syncNativeWireGains?.(nativeWireGainReadback(next)); // A SEND OFF is a scalar, NOT a disconnected WIRE. Update just the // affected selected SOF strip; preserve fader focus and all plugin state. for(const edge of next.graph.edges.filter(e=>e.enabled&&e.primaryOutput===false)){ @@ -2954,6 +2960,11 @@ state.current?.device?.epoch===wire.epoch&&deferStartupWire(wire.ops,1))return; startupWire=null; pendingWireGains.clear(); + // The controller deliberately freezes current on a rejected ACK. + // Repaint only an inspector that still says PENDING from that + // admitted PCM readback, without a new intent, timer or graph edit. + if(state.current) + scope?.rollbackNativeWireInspector?.(nativeWireGainReadback(state.current)); if(pendingFxInsert?.authority==="CHANNEL_ID"){ pendingFxInsert=null; nativeToast("VST3 insert rejected · "+state.lastError); @@ -2966,7 +2977,7 @@ // Never destroy an active pointer capture. Once the user releases, // restore only the last independently accepted native controls. if(flags.acceptedGraphConnected && (scope.activeFaderId??-1)<0){ - if(!scope.wireGainDragging && !document.activeElement?.matches?.(".strip select,.wire-gain")) + if(!scope.wireGainDragging && !document.activeElement?.matches?.(".strip select,.wire-gain,#wireWsGain")) scope.render?.(); controller.subscribe(); if(state.current)paintNativeMeters(state.current); From 361f6eb6d6453ec2f3a913f8945018927e67838e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:07:33 +0700 Subject: [PATCH 3/9] test(wire): execute native compiled inspector rollback with exact EdgeId rejection, focus and stale-route guards --- tests/approved_native_m2_contract.test.cjs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 8a6451d17..1209bc567 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -56,6 +56,7 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi const parallel={id:42,sourceId:1,destId:3,kind:"send",mode:"send", nativeTap:"POST_FADER",levelDb:-6,enabled:true}; const panel={hidden:false,innerHTML:""},readout={textContent:"-6 dB"}; + const inspectorGain={value:"-12",dataset:{wsGain:"42"},disabled:false}; const observed=[]; const gain=input=>input?.dataset?.wsGain!==undefined?input:null; const tap=input=>input?.dataset?.wsTap!==undefined?input:null; @@ -66,6 +67,7 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi get hidden(){return panel.hidden},set hidden(v){panel.hidden=v}, get innerHTML(){return panel.innerHTML},set innerHTML(v){panel.innerHTML=v}}; if(id==="wireWsGainText")return readout; + if(id==="wireWsGain")return inspectorGain; return null; }}, window:{__JUCE__:{backend:{}},__ARMIX_NATIVE_M2__:{ @@ -119,6 +121,27 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi assert.match(observed[2],/awaiting accepted native PCM readback/); assert.equal(primary.levelDb,0); assert.equal(parallel.levelDb,-6,"reference WIRE graph never becomes native routing owner"); + // Execute the native compiled rollback method rather than a mock. It must + // repair the same focused DOM control from the latest accepted PCM readback. + // Rejection has no new snapshot: the original level remains -6, not -12. + const rollbackStart=html.indexOf(" rollbackNativeWireInspector(rows){"); + const rollbackEnd=html.indexOf(" syncVerifiedM4Wires(rows,ids){",rollbackStart); + assert.ok(rollbackStart>0&&rollbackEnd>rollbackStart,"native rollback method installed exactly once"); + const method=html.slice(rollbackStart,rollbackEnd).trim().replace(/,\\s*$/,""); + const rollback=vm.runInNewContext("({"+method+"})",scope); + assert.equal(rollback.rollbackNativeWireInspector([{id:42,levelDb:-6}]),true); + assert.equal(inspectorGain.value,"-6","failed native intent restores accepted gain without replacing the focused input"); + assert.equal(readout.textContent,"UNCHANGED · -6 dB","LCD cannot remain PENDING after a rejected gain"); + assert.equal(parallel.levelDb,-6,"no browser graph edit or optimistic audio state"); + assert.equal(rollback.rollbackNativeWireInspector([{id:42,levelDb:-6}]),false, + "idempotent failure reconciliation must not repaint a settled LCD"); + // A stale EdgeId cannot silently roll back or write a different route. + inspectorGain.dataset.wsGain="41";readout.textContent="PENDING · -8 dB"; + assert.equal(rollback.rollbackNativeWireInspector([{id:42,levelDb:-6}]),true); + assert.equal(inspectorGain.disabled,true); + assert.equal(readout.textContent,"SEND UNAVAILABLE"); + assert.match(bridge,/rollbackNativeWireInspector\\?\\.\\(nativeWireGainReadback\\(state.current\\)\\)/, + "native control failure must invoke the same compiled inspector rollback"); }); test("native PRE_FADER WIRE inspector uses one exact SET_TAP PCM intent and accepted readback",()=>{ From a8d9267eb437b7c44620b791b8e0c2374fba8a9f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:08:20 +0700 Subject: [PATCH 4/9] test(wire): correct JS RegExp escapes in executable compiled rollback regression --- 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 1209bc567..327d67991 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -127,7 +127,7 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi const rollbackStart=html.indexOf(" rollbackNativeWireInspector(rows){"); const rollbackEnd=html.indexOf(" syncVerifiedM4Wires(rows,ids){",rollbackStart); assert.ok(rollbackStart>0&&rollbackEnd>rollbackStart,"native rollback method installed exactly once"); - const method=html.slice(rollbackStart,rollbackEnd).trim().replace(/,\\s*$/,""); + const method=html.slice(rollbackStart,rollbackEnd).trim().replace(/,\s*$/,""); const rollback=vm.runInNewContext("({"+method+"})",scope); assert.equal(rollback.rollbackNativeWireInspector([{id:42,levelDb:-6}]),true); assert.equal(inspectorGain.value,"-6","failed native intent restores accepted gain without replacing the focused input"); @@ -140,7 +140,7 @@ test("WIRE inspector controls PRIMARY BUS and PARALLEL MAIN by actual EdgeId, wi assert.equal(rollback.rollbackNativeWireInspector([{id:42,levelDb:-6}]),true); assert.equal(inspectorGain.disabled,true); assert.equal(readout.textContent,"SEND UNAVAILABLE"); - assert.match(bridge,/rollbackNativeWireInspector\\?\\.\\(nativeWireGainReadback\\(state.current\\)\\)/, + assert.match(bridge,/rollbackNativeWireInspector\?\.\(nativeWireGainReadback\(state.current\)\)/, "native control failure must invoke the same compiled inspector rollback"); }); From 318b2c22f0f6503db1600bfc5f06284fabb7ba14 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:11:20 +0700 Subject: [PATCH 5/9] test(chromium): real WIRE Inspector rejected ACK restores focused gain and LCD without later snapshot --- tests/approved_native_wire_gain_smoke.py | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/approved_native_wire_gain_smoke.py b/tests/approved_native_wire_gain_smoke.py index 40fb13200..967280cda 100644 --- a/tests/approved_native_wire_gain_smoke.py +++ b/tests/approved_native_wire_gain_smoke.py @@ -143,6 +143,65 @@ def drag(): + +def verify_inspector_rejected_gain(page, out): + """Real compiled native GUI: rejected ACK with NO new snapshot must not + strand PENDING or detach the inspector slider held in keyboard focus.""" + page.add_init_script("""window.__nativeListeners=new Map();window.__nativeIntents=[]; + window.__JUCE__={backend:{ + emitEvent(name,payload){ + if(name==='arMixConsoleIntent')window.__nativeIntents.push(payload); + }, + addEventListener(name,callback){window.__nativeListeners.set(name,callback);} + }};""") + errors=[] + page.on("pageerror",lambda exc:errors.append(str(exc))) + page.goto((out/"index.html").as_uri()) + page.wait_for_function("()=>window.__ARMIX_NATIVE_M2__?.enabled") + state=snapshot() + emit(page,"arMixConsoleSnapshot",state) + page.locator("#wireMatrixToggle").click() + route=page.locator('[data-ws-inspect="1:2"]') + route.wait_for(state="visible") + route.click() + slider=page.locator("#wireWsGain") + slider.wait_for(state="visible") + assert slider.is_enabled(),"Selected parallel SEND must allow native gain" + assert "PRIMARY" not in page.locator("#wireWsGainText").inner_text() + assert abs(float(slider.input_value())-(-6.0))<.11 + page.evaluate("()=>window.__heldInspectorGain=document.getElementById('wireWsGain')") + slider.focus() + slider.evaluate("""el=>{ + el.value='-12'; + el.dispatchEvent(new Event('input',{bubbles:true})); + }""") + assert page.locator("#wireWsGainText").inner_text()=="PENDING · -12 dB" + page.wait_for_function( + "()=>window.__nativeIntents.filter(x=>x.operation==='SET_WIRE_GAIN').length===1") + request=page.evaluate( + "()=>window.__nativeIntents.find(x=>x.operation==='SET_WIRE_GAIN')") + assert request["targetChannelId"]==SOURCE,request + assert request["payload"]["edgeId"]==SEND,request + assert abs(request["payload"]["gainLinear"]-10**(-12/20))<1e-8,request + emit(page,"arMixConsoleAck",{ + "requestId":request["requestId"],"status":"REJECTED", + "errorCode":"TEST_REJECTION","deviceEpoch":state["device"]["epoch"], + "graphRevision":state["graph"]["revision"], + "rosterRevision":state["graph"]["rosterRevision"]}) + # NO independent later snapshot is intentionally emitted. + # A rejected request cannot wait for one to repaint its LCD. + assert page.locator("#wireWsGainText").inner_text()=="UNCHANGED · -6 dB" + assert abs(float(slider.input_value())-(-6))<.11 + assert page.evaluate( + "()=>document.getElementById('wireWsGain')===window.__heldInspectorGain") + assert slider.evaluate("el=>document.activeElement===el"), ( + "Rejection must not drop keyboard focus on the original range input") + assert len(page.evaluate( + "()=>window.__nativeIntents.filter(x=>x.operation==='SET_WIRE_GAIN')"))==1 + assert abs(float(page.evaluate( + "()=>window.__ARMIX_NATIVE_SCOPE__.wireEdges.find(e=>e.id===2)?.levelDb"))-(-6))<.11 + assert not errors,errors + def verify_external_output(page, out): """Actual /preview/ native WebView: select -> native ACK -> callback readback. @@ -250,6 +309,9 @@ def main(): impact = browser.new_page(viewport={"width": 1366, "height": 768}) verify_socket_impact(impact, out) impact.close() + inspector_page = browser.new_page(viewport={"width":1366,"height":900}) + verify_inspector_rejected_gain(inspector_page,out) + inspector_page.close() output_page = browser.new_page(viewport={"width":1366,"height":900}) verify_external_output(output_page,out) output_page.close() From 484f46b6e85692111ed2d1e73644f5a5697653c1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:11:55 +0700 Subject: [PATCH 6/9] ci(wire): reuse existing scoped Chromium runner for rejected inspector ACK regression --- .github/workflows/ui-smoke.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index d833184cb..414d85d68 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -195,7 +195,7 @@ jobs: needs: quick # Both 8D-SonKu and SOF native-owner PRs share ONE actual Chromium runner. # Preserve fast-only checks for unrelated GUI and engine branches. - if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-') || startsWith(github.head_ref, 'integration/sof-sonku-main-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }} + if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-') || startsWith(github.head_ref, 'integration/sof-sonku-main-') || startsWith(github.head_ref, 'fix/native-wire-inspector-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }} runs-on: ubuntu-latest timeout-minutes: 12 steps: @@ -216,6 +216,8 @@ jobs: # job (zero additional browser runners and zero Windows recompiles). - name: Native SOF PRE/POST, SEND ON, EdgeId gain and ACK/readback Chromium run: python tests/approved_native_sof_chromium_smoke.py + - name: Native WIRE Inspector rejected gain and exact EdgeId ACK rollback (real Chromium) + run: python tests/approved_native_wire_gain_smoke.py - name: Integrated V65 WIRE motion, SOF and actual native WIRE regression if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/sof-sonku-main-') }} run: | From 751286a9c2181264f342a2f09d8c6dc58266c11c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:14:11 +0700 Subject: [PATCH 7/9] test(chromium): resolve exact projected WIRE EdgeId instead of assuming allocator index 2 --- tests/approved_native_wire_gain_smoke.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/approved_native_wire_gain_smoke.py b/tests/approved_native_wire_gain_smoke.py index 967280cda..aae8e9611 100644 --- a/tests/approved_native_wire_gain_smoke.py +++ b/tests/approved_native_wire_gain_smoke.py @@ -198,8 +198,11 @@ def verify_inspector_rejected_gain(page, out): "Rejection must not drop keyboard focus on the original range input") assert len(page.evaluate( "()=>window.__nativeIntents.filter(x=>x.operation==='SET_WIRE_GAIN')"))==1 - assert abs(float(page.evaluate( - "()=>window.__ARMIX_NATIVE_SCOPE__.wireEdges.find(e=>e.id===2)?.levelDb"))-(-6))<.11 + assert abs(float(page.evaluate("""()=>{ + // EdgeId is allocated by the native graph projector; never assume 2. + const id=Number(document.getElementById('wireWsGain').dataset.wsGain); + return window.__ARMIX_NATIVE_SCOPE__.wireEdges.find(e=>e.id===id)?.levelDb; + }"""))-(-6))<.11 assert not errors,errors def verify_external_output(page, out): From 6996e9ebc530397f0163531cac3e223cde33af19 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:17:53 +0700 Subject: [PATCH 8/9] fix(wire): settle exact gain no-op and stale deferred EdgeId without spurious ACK wait --- web/approved-native-bridge.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 6108b3226..609089742 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -362,10 +362,23 @@ if(state?.pending||!current?.admitted)return; for(const [edgeId,edit] of pendingWireGains){ pendingWireGains.delete(edgeId); - if(current.identity!==edit.identity)continue; // never replay into a new graph/device + if(current.identity!==edit.identity){ + // A changed device/graph invalidates a deferred edit, but must not + // strand its LCD while waiting for a nonexistent ACK. + scope?.rollbackNativeWireInspector?.(nativeWireGainReadback(current)); + continue; // never replay into a new graph/device + } const edge=current.graph.edges.find(e=>e.enabled&&e.edgeId===edgeId&&e.from===edit.source); - if(!edge||edge.primaryOutput!==false)continue; - if(Math.abs(edge.gainLinear-edit.gain)<.00001)continue; + if(!edge||edge.primaryOutput!==false){ + scope?.rollbackNativeWireInspector?.(nativeWireGainReadback(current)); + continue; + } + if(Math.abs(edge.gainLinear-edit.gain)<.00001){ + // The accepted PCM gain already equals the requested scalar. Do not + // emit a redundant native intent, but DO settle the pending display. + scope?.syncNativeWireGains?.(nativeWireGainReadback(current)); + continue; + } const result=controller.intent("SET_WIRE_GAIN",edit.source,{edgeId,gainLinear:edit.gain}); if(result.ok)window.setTimeout(()=>controller?.expire(result.requestId),8000); else status("WIRE gain rejected · "+result.error); From 06b1bfebf256142f67a4dcf46090eb0068df6857 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 13 Nov 2026 14:18:34 +0700 Subject: [PATCH 9/9] test(chromium): exact accepted -6 dB WIRE no-op settles LCD without any ACK or extra PCM intent --- tests/approved_native_wire_gain_smoke.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/approved_native_wire_gain_smoke.py b/tests/approved_native_wire_gain_smoke.py index aae8e9611..ec461bdee 100644 --- a/tests/approved_native_wire_gain_smoke.py +++ b/tests/approved_native_wire_gain_smoke.py @@ -159,6 +159,9 @@ def verify_inspector_rejected_gain(page, out): page.goto((out/"index.html").as_uri()) page.wait_for_function("()=>window.__ARMIX_NATIVE_M2__?.enabled") state=snapshot() + # Use an exactly representable accepted -6 dB gain to prove the + # native coalescer's equality/no-op path emits no redundant intent. + state["graph"]["edges"][1]["gainLinear"]=10**(-6/20) emit(page,"arMixConsoleSnapshot",state) page.locator("#wireMatrixToggle").click() route=page.locator('[data-ws-inspect="1:2"]') @@ -203,6 +206,21 @@ def verify_inspector_rejected_gain(page, out): const id=Number(document.getElementById('wireWsGain').dataset.wsGain); return window.__ARMIX_NATIVE_SCOPE__.wireEdges.find(e=>e.id===id)?.levelDb; }"""))-(-6))<.11 + # Requesting the exact same accepted -6 dB is a no-op: native must + # suppress redundant PCM writes AND settle the pending LCD by itself. + # No ACK, new snapshot or hidden user recovery action is available. + slider.evaluate("""el=>{ + el.value='-6'; + el.dispatchEvent(new Event('input',{bubbles:true})); + }""") + assert page.locator("#wireWsGainText").inner_text()=="PENDING · -6 dB" + page.wait_for_function("""()=>{ + return document.getElementById('wireWsGainText')?.textContent==='-6 dB'; + }""",timeout=5000) + assert len(page.evaluate( + "()=>window.__nativeIntents.filter(x=>x.operation==='SET_WIRE_GAIN')"))==1, ( + "Exact accepted gain no-op must not resend a native PCM command") + assert slider.evaluate("el=>document.activeElement===el") assert not errors,errors def verify_external_output(page, out):