From 088f3cb609c2aa2a05d52f606e3f09703326a4a0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 10 Nov 2026 08:02:42 +0700 Subject: [PATCH 1/5] fix(p0): fail closed on Pages-only boot and recover same registered ASIO mixer Only reveal the shipped mixer after callback-backed native ChannelId/M4 readback; preserve public /preview/ byte-for-byte. Reject fake GUI-ready handshakes. Generalize pinned same-ASIO rebind beyond ASIO4ALL with verified hardware output policy and tests. Preserve safe mute/identity checks, existing VST3/WIRE graph and logical session. No new release until Windows and real hardware qualification. --- scripts/build_approved_native_gui.py | 23 ++++++++++++++++++++ src/LiveAudioEngine.h | 9 ++++---- src/Main.cpp | 26 +++++++++++++++-------- src/NativeMixerSessionDocument.h | 5 ++++- tests/approved_native_cold_start_smoke.py | 4 ++++ tests/approved_native_gui_bundle_test.py | 4 ++++ tests/native_mixer_session_store_test.cpp | 19 +++++++++++++++++ web/approved-native-bridge.js | 20 ++++++++++++++--- 8 files changed, 93 insertions(+), 17 deletions(-) diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index 5dac25f24..69c34045c 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -26,6 +26,23 @@ '') SCHEMA = "arsonmix.approved-native-pages-bundle.v2" +NATIVE_BOOT_GUARD = ( + '\n' +) + def sha256(data: bytes) -> str: return hashlib.sha256(data).hexdigest() @@ -263,6 +280,9 @@ def native_html(approved: str | None = None) -> str: if html.count(before) != 1 or after in html: raise ValueError("Native-only M2 control hook anchor drift: " + before[:55]) html = html.replace(before, after, 1) + if html.count("") != 1: + raise ValueError("Approved Pages missing unique native boot guard anchor") + html = html.replace("", NATIVE_BOOT_GUARD + "", 1) html = html.replace("", ADAPTER_MARKER + "\n") return html.replace("\n", newline) @@ -274,6 +294,9 @@ def public_from_native(native: str) -> str: if html.count(ADAPTER_MARKER + "\n") != 1: raise ValueError("Native adapter marker missing or duplicated") html = html.replace(ADAPTER_MARKER + "\n", "", 1) + if html.count(NATIVE_BOOT_GUARD) != 1: + raise ValueError("Native boot guard missing or duplicated") + html = html.replace(NATIVE_BOOT_GUARD, "", 1) for before, after in reversed(NATIVE_EVENT_HOOKS): if html.count(after) != 1: raise ValueError("Native-only M2 control hook missing or duplicated") diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 7768c6a43..b60ea7538 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -480,7 +480,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback bool selectedRetainedAsioDriverForReopen() { using Policy=armix::session::MixerDeviceBindingPolicy; if(deviceManager_.getCurrentAudioDevice() || !acceptedMixerBinding_ || - !Policy::isAsio4All(*acceptedMixerBinding_) || + acceptedMixerBinding_->backend!="ASIO" || !asioPinnedRegistration_.valid() || !attached_ || independent_.active() || deviceManager_.getCurrentAudioDeviceType()!="ASIO")return false; juce::AudioDeviceManager::AudioDeviceSetup setup; @@ -497,7 +497,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback bool authorizeRetainedAsioRestart() { using Policy=armix::session::MixerDeviceBindingPolicy; if(!hasRetainedNativeSession() || !acceptedMixerBinding_ || - !Policy::isAsio4All(*acceptedMixerBinding_) || !asioPinnedRegistration_.valid() || + acceptedMixerBinding_->backend!="ASIO" || !asioPinnedRegistration_.valid() || !allOutputsDisarmed() || independent_.active() || !attached_ || handoff_.busy() || fxMovePhase_.load(std::memory_order_acquire)!=0 || routeReconfiguring_.load(std::memory_order_acquire) || @@ -542,9 +542,10 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback } bool reattachRetainedAsioMixer() { using Policy=armix::session::MixerDeviceBindingPolicy; - if(!acceptedMixerBinding_ || !Policy::isAsio4All(*acceptedMixerBinding_) || + if(!acceptedMixerBinding_ || acceptedMixerBinding_->backend!="ASIO" || !hasRetainedNativeSession() || !allOutputsDisarmed() || - !directFence_.permitted() || handoff_.busy())return false; + !directFence_.permitted() || handoff_.busy() || + !sameRetainedAsioDriver())return false; armix::session::MixerSessionDocument document; if(!dryRoutingLab_.describeRetainedAsioSession(document))return false; document.binding=*acceptedMixerBinding_; diff --git a/src/Main.cpp b/src/Main.cpp index 2a2b7f01f..4f30d3bcb 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -231,6 +231,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr .withNativeIntegrationEnabled() .withEventListener ("arMixGuiReady", [this] (juce::var ready) { + // A Pages-only demo cannot authenticate native session readiness. + if (ready.getProperty ("gui", "").toString() != + "APPROVED_PAGES_PREVIEW_BUTTONS" || + !static_cast (ready.getProperty ("nativeBridgeAttached", false))) + { + diagnostics_.record ("GUI_NATIVE_BRIDGE_MISSING", + "Ignoring Pages-only readiness notification"); + return; + } browser_.loaded = true; guiReadyTick_ = juce::Time::getMillisecondCounter(); // WebView2 may finish its first navigation while this @@ -2522,7 +2531,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr return error; } if(bindingMode==MixerBindingMode::exact && startupOnSavedDevice && - armix::session::MixerDeviceBindingPolicy::isAsio4All(doc.binding)) + doc.binding.backend=="ASIO") bindingMode=MixerBindingMode::verifiedAsioRestart; const bool resume=startupOnSavedDevice && (bindingMode==MixerBindingMode::exact || bindingMode==MixerBindingMode::verifiedAsioRestart) && @@ -5423,7 +5432,6 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr auto* device=engine_.devices().getCurrentAudioDevice(); if(device) { if(device->getTypeName()!="ASIO" || - !device->getName().startsWithIgnoreCase("ASIO4ALL") || !engine_.sameRetainedAsioDriver())return; } else if(!engine_.selectedRetainedAsioDriverForReopen()) { // The device pointer disappeared: never open an unapproved or @@ -5448,13 +5456,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr setup.useDefaultInputChannels=!setup.inputChannels.isZero(); setup.useDefaultOutputChannels=true; asioRecoveryGate_.driverTransaction(now); - if(!device)diagnostics_.record("ASIO4ALL_DEVICE_MISSING", + if(!device)diagnostics_.record("ASIO_DEVICE_MISSING", "Reopening previously approved registered ASIO driver; no fallback"); const auto error=openSelectedAudioDevice("ASIO",setup,true); asioRecoveryGate_.carryInternalEpoch(engine_.dryRoutingLabEpoch()); device=engine_.devices().getCurrentAudioDevice(); if(error.isNotEmpty() || !device || !device->isOpen()) { - diagnostics_.record("ASIO4ALL_REOPEN_FAILED",error); + diagnostics_.record("ASIO_REOPEN_FAILED",error); emitApprovedNativeSnapshot(); return; } @@ -5463,13 +5471,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // Admission can lag driver restart without any driver call. // It MUST NOT exhaust the bounded reopen/correction allowance. asioRecoveryGate_.waitForReadback(now); - diagnostics_.record("ASIO4ALL_BIND_NOT_READY","Waiting for verified callback/readback"); + diagnostics_.record("ASIO_BIND_NOT_READY","Waiting for verified callback/readback"); return; } if(const auto corrected=engine_.asioRestartPinCorrection()) { if(!asioRecoveryGate_.mayChangeDriver()) { asioRecoveryGate_.waitForReadback(now); - diagnostics_.record("ASIO4ALL_PIN_CORRECTION_DEFERRED", + diagnostics_.record("ASIO_PIN_CORRECTION_DEFERRED", "Driver transaction budget exhausted for this physical epoch"); return; } @@ -5485,7 +5493,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr reopened->getActiveInputChannels()!=corrected->inputChannels || reopened->getActiveOutputChannels()!=corrected->outputChannels || !engine_.authorizeRetainedAsioRestart()) { - diagnostics_.record("ASIO4ALL_PIN_CORRECTION_FAILED", + diagnostics_.record("ASIO_PIN_CORRECTION_FAILED", error.isNotEmpty()?error:juce::String("Readback changed during correction")); emitApprovedNativeSnapshot(); return; @@ -5498,7 +5506,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // current epoch; retry without reopening hardware at an // exponentially bounded CONTROL cadence. asioRecoveryGate_.bindFailed(now); - diagnostics_.record("ASIO4ALL_REATTACH_FAILED",error); + diagnostics_.record("ASIO_REATTACH_FAILED",error); emitApprovedNativeSnapshot(); return; } @@ -5509,7 +5517,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr mixerSessionError_.clear(); if(engine_.takeAsioResetMonitorIntent())requestAutomaticMain(false); if(engine_.isMonitorEnabled())mixerSessionStatus_="RESTORED_MONITORING"; - diagnostics_.record("ASIO4ALL_REATTACHED","Verified driver and current MAIN pair"); + diagnostics_.record("ASIO_REATTACHED","Verified driver and current MAIN pair"); emitApprovedNativeSnapshot(); } diff --git a/src/NativeMixerSessionDocument.h b/src/NativeMixerSessionDocument.h index 68ce4c659..27f08581f 100644 --- a/src/NativeMixerSessionDocument.h +++ b/src/NativeMixerSessionDocument.h @@ -110,8 +110,11 @@ struct MixerDeviceBindingPolicy final { (mode==Mode::verifiedDeviceApply && (saved.backend!=live.backend || saved.playback!=live.playback))) return count==2?VerifiedNativeOutputs{count,0,1,-1,-1,false}:unavailable; + // The host checks the pinned registered ASIO driver identity first. + // Physical MAIN pin mapping still requires exact verified readback. if(mode==Mode::verifiedAsioRestart && - (!isAsio4All(live) || saved.backend!=live.backend || saved.playback!=live.playback)) + (saved.backend!="ASIO" || live.backend!="ASIO" || + saved.capture!=live.capture || saved.playback!=live.playback)) return unavailable; auto outputs=document.outputs; outputs.activeOutputChannels=count; diff --git a/tests/approved_native_cold_start_smoke.py b/tests/approved_native_cold_start_smoke.py index 91ad872bf..a431a280f 100644 --- a/tests/approved_native_cold_start_smoke.py +++ b/tests/approved_native_cold_start_smoke.py @@ -44,6 +44,8 @@ def main(): # Native Console is ALWAYS visible, even with no callback/device. # Bridge still rejects unadmitted PCM edits until accepted readback. assert page.locator('.console-pane').is_visible() + assert page.locator('html').get_attribute('data-armix-native-boot')=='waiting' + assert page.locator('#tracks').evaluate('e=>getComputedStyle(e).visibility')=='hidden' assert not page.evaluate('()=>window.__nativeIntents.length') # Built-in JUCE DSP must be discoverable before ANY third-party # VST3 catalog response. The native host never inserts demo FX. @@ -214,6 +216,8 @@ def show_select(value): state['legacyM4']={'active':True,'routeAccepted':True,'routingRevision':'77', 'nativeBusStructural':False,'fxInstances':[[] for _ in range(14)]} emit(page,'arMixConsoleSnapshot',state) + page.wait_for_function('()=>document.documentElement.dataset.armixNativeBoot==="ready"') + assert page.locator('#tracks').evaluate('e=>getComputedStyle(e).visibility')=='visible' page.locator('.console-pane').wait_for(state='visible') if 'collapsed-send' in (page.locator('.console-body').get_attribute('class') or ''): page.locator('.section-rail [data-section="send"]').click() diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index b770ba045..7213ae20a 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -22,6 +22,10 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) approved = (source / "index.html").read_text("utf-8") native = (out / "index.html").read_text("utf-8") self.assertEqual(bundle.public_from_native(native), approved) + self.assertIn('id="armix-native-boot-guard"', native) + self.assertNotIn('id="armix-native-boot-guard"', approved) + self.assertIn('data-armix-native-boot="waiting"', native) + self.assertIn('nativeBridgeAttached:true', native) self.assertNotIn("__ARMIX_NATIVE_M2__", approved) self.assertIn("__ARMIX_NATIVE_M2__", native) # Never let a missing ASIO driver or delayed native snapshot diff --git a/tests/native_mixer_session_store_test.cpp b/tests/native_mixer_session_store_test.cpp index 0255f8f25..57979cb39 100644 --- a/tests/native_mixer_session_store_test.cpp +++ b/tests/native_mixer_session_store_test.cpp @@ -864,6 +864,25 @@ int main(){ duplicatePins.outputNames.add("2nd output with SST 1"); assert(!MixerDeviceBindingPolicy::proposedOutputs(asio,duplicatePins,2, BindingMode::verifiedAsioRestart).valid()); + // A third-party ASIO driver must rebind only the SAME registered host + // and verified physical MAIN, never guess a new output or capture device. + auto vendor=asio; + vendor.binding.capture=vendor.binding.playback="MAONO PS22 ASIO"; + auto vendorCurrent=vendor.binding; + const auto vendorMain=MixerDeviceBindingPolicy::proposedOutputs( + vendor,vendorCurrent,2,BindingMode::verifiedAsioRestart); + assert(vendorMain.valid() && vendorMain.mainL==vendor.outputs.mainL && + vendorMain.mainR==vendor.outputs.mainR); + auto vendorRestored=vendor; + assert(MixerDeviceBindingPolicy::apply(vendorRestored,vendorCurrent,vendorMain,2, + BindingMode::verifiedAsioRestart).isEmpty()); + vendorCurrent.playback="Different ASIO interface"; + assert(!MixerDeviceBindingPolicy::proposedOutputs( + vendor,vendorCurrent,2,BindingMode::verifiedAsioRestart).valid()); + vendorCurrent=vendor.binding; + vendorCurrent.capture="Other capture"; + assert(!MixerDeviceBindingPolicy::proposedOutputs( + vendor,vendorCurrent,2,BindingMode::verifiedAsioRestart).valid()); auto exact=d; assert(MixerDeviceBindingPolicy::apply(exact,d.binding,d.outputs,2,BindingMode::exact) .isEmpty()); diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 6e1ab7a1b..df9cb0923 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -7,7 +7,8 @@ // The public GUI owns one lexical model. Native-only bundle exports a narrow // reference to that SAME model; never reconstruct a parallel DOM/DSP. const scope = window.__ARMIX_NATIVE_SCOPE__ || null; - const connected = Boolean(backend?.emitEvent && backend?.addEventListener && protocol); + const connected = Boolean(backend?.emitEvent && backend?.addEventListener && + protocol?.createController && scope?.installGraph && scope?.render); // Public browser preview keeps its header; the native JUCE caption replaces it. if (backend?.emitEvent && backend?.addEventListener) document.documentElement?.classList?.add?.("armix-native-desktop"); @@ -2261,6 +2262,7 @@ if(!session || session.deviceEpoch!==next.device.epoch) { flags.acceptedGraphConnected=false; flags.productionCallbackLive=false; + document.documentElement.dataset.armixNativeBoot="waiting"; lastPaintedSignature=""; delete document.documentElement.dataset.armixNativeRoster; status("AUDIO CONNECTION CHANGED · OPEN AUDIO I/O"); @@ -2274,6 +2276,8 @@ reconcileM4RackReadback(next); if(session.authority==="M4" && m4Verified()) { paintM4Fallback(next); + // M4 is a callback-backed compatibility producer, not Pages demo PCM. + document.documentElement.dataset.armixNativeBoot="ready"; if(scope?.syncVerifiedM4Wires?.(session.channels.map(ch=>ch.source),m4TrackIds)) document.documentElement.dataset.armixNativeRoster="accepted"; } @@ -2313,6 +2317,9 @@ if(lastPaintedSignature!==signature && projectNativeGraphWithoutFocusLoss(next)){ lastPaintedSignature=signature; document.documentElement.dataset.armixNativeRoster="accepted"; + document.documentElement.dataset.armixNativeBoot="ready"; + } else if(lastPaintedSignature!==signature) { + document.documentElement.dataset.armixNativeBoot="waiting"; } stopDemo(); paintNativeMeters(next); @@ -2322,7 +2329,10 @@ if (!nativeAdmitted) { flags.productionCallbackLive=false;flags.acceptedGraphConnected=false; lastPaintedSignature="";lastNativeTopologySignature=""; - if(!m4Verified())delete document.documentElement.dataset.armixNativeRoster; + if(!m4Verified()){ + delete document.documentElement.dataset.armixNativeRoster; + document.documentElement.dataset.armixNativeBoot="waiting"; + } stopDemo(); status(m4Verified()? "NATIVE M4 · real PCM faders and meters · ChannelId buses not yet admitted": @@ -2338,6 +2348,7 @@ const signature=next.identity+"|"+JSON.stringify(next.graph.channels.map(ch=>[ ch.id,ch.controls,ch.inserts,ch.fxRackBypassed,ch.primaryOutId]))+"|"+JSON.stringify(next.graph.edges)+"|"+appearanceRevision; if (signature===lastPaintedSignature) { + document.documentElement.dataset.armixNativeBoot="ready"; finishNativeTrack(next);finishNativeTrackDelete(next); // Telemetry often advances without a structural graph revision. paintNativeMeters(next); @@ -2346,10 +2357,12 @@ } if (!projectNativeGraphWithoutFocusLoss(next)) { flags.acceptedGraphConnected=false;flags.productionCallbackLive=false; + document.documentElement.dataset.armixNativeBoot="waiting"; stopDemo();status("NATIVE READBACK INVALID · existing GUI controls unchanged"); return; } document.documentElement.dataset.armixNativeRoster="accepted"; + document.documentElement.dataset.armixNativeBoot="ready"; flags.productionCallbackLive=next.productLive;flags.acceptedGraphConnected=true; syncMonitorButton(next.device); lastPaintedSignature=signature;stopDemo();paintNativeMeters(next); @@ -3273,7 +3286,8 @@ stopDemo(); status("NATIVE: subscribed · waiting for true device and accepted ChannelId graph"); backend.emitEvent("arMixGuiReady",{ - gui:"APPROVED_PAGES_PREVIEW_BUTTONS",visualReady:true,audioReady:false, + gui:"APPROVED_PAGES_PREVIEW_BUTTONS",nativeBridgeAttached:true, + visualReady:true,audioReady:false, viewportWidth:Math.round(window.innerWidth), viewportHeight:Math.round(window.innerHeight), devicePixelRatio:window.devicePixelRatio From 7f08958320cc2c7cd2059a8bfac70cf323e7edf5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 10 Nov 2026 08:05:58 +0700 Subject: [PATCH 2/5] test(p0): preserve bridge listener tests while rejecting missing native renderer; qualify generic ASIO identity --- tests/mixer_io_operator_contract_test.mjs | 6 +++--- web/approved-native-bridge.js | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index 81bcf28f9..3622a42cf 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -617,18 +617,18 @@ test('ASIO4ALL automatic rebind has bounded retries, succeeds only after verifie assert.doesNotMatch(apply,/asioRecoveryEpoch_=engine_\.dryRoutingLabEpoch\(\);\s*if\(changedAsioPinLayout\)/); }); -test('ASIO4ALL missing JUCE device can reopen only the pinned user-selected driver',()=>{ +test('Missing ASIO device can reopen only the pinned registered user-selected driver',()=>{ const main=read('src/Main.cpp'),engine=read('src/LiveAudioEngine.h'); const service=main.slice(main.indexOf('void serviceAsioMixerRestart()'), main.indexOf('void changeListenerCallback (')); assert.match(service,/else if\(!engine_\.selectedRetainedAsioDriverForReopen\(\)\)/); assert.match(service,/if\(!device \|\| !device->isOpen\(\)/); - assert.match(service,/ASIO4ALL_DEVICE_MISSING/); + assert.match(service,/ASIO_DEVICE_MISSING/); const selected=engine.slice(engine.indexOf('bool selectedRetainedAsioDriverForReopen()'), engine.indexOf('bool authorizeRetainedAsioRestart()')); assert.match(selected,/deviceManager_\.getCurrentAudioDevice\(\)/); assert.match(selected,/deviceManager_\.getCurrentAudioDeviceType\(\)!="ASIO"/); - assert.match(selected,/Policy::isAsio4All\(\*acceptedMixerBinding_\)/); + assert.match(selected,/acceptedMixerBinding_->backend!="ASIO"/); assert.match(selected,/setup\.outputDeviceName!=acceptedMixerBinding_->playback/); assert.match(selected,/setup\.inputDeviceName!=acceptedMixerBinding_->capture/); assert.match(selected,/asioPinnedRegistration_\.sameDriverClass\(registered\.registration\.identity\)/); diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index df9cb0923..1671bb636 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -7,8 +7,7 @@ // The public GUI owns one lexical model. Native-only bundle exports a narrow // reference to that SAME model; never reconstruct a parallel DOM/DSP. const scope = window.__ARMIX_NATIVE_SCOPE__ || null; - const connected = Boolean(backend?.emitEvent && backend?.addEventListener && - protocol?.createController && scope?.installGraph && scope?.render); + const connected = Boolean(backend?.emitEvent && backend?.addEventListener && protocol); // Public browser preview keeps its header; the native JUCE caption replaces it. if (backend?.emitEvent && backend?.addEventListener) document.documentElement?.classList?.add?.("armix-native-desktop"); @@ -3285,13 +3284,17 @@ updateHardwarePanel(null); stopDemo(); status("NATIVE: subscribed · waiting for true device and accepted ChannelId graph"); - backend.emitEvent("arMixGuiReady",{ - gui:"APPROVED_PAGES_PREVIEW_BUTTONS",nativeBridgeAttached:true, - visualReady:true,audioReady:false, - viewportWidth:Math.round(window.innerWidth), - viewportHeight:Math.round(window.innerHeight), - devicePixelRatio:window.devicePixelRatio - }); + // A missing compiled Pages/native scope may still expose the contract + // listener in tests, but is never admitted as a ready Windows mixer. + if(scope?.installGraph && scope?.render){ + backend.emitEvent("arMixGuiReady",{ + gui:"APPROVED_PAGES_PREVIEW_BUTTONS",nativeBridgeAttached:true, + visualReady:true,audioReady:false, + viewportWidth:Math.round(window.innerWidth), + viewportHeight:Math.round(window.innerHeight), + devicePixelRatio:window.devicePixelRatio + }); + } else status("Native mixer renderer unavailable · reinstall or repair application"); controller.subscribe(); }; if(document.readyState==="loading") From 028e7fe2e20c9cf4f210584f44868d3f285c8cf6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 10 Nov 2026 08:07:47 +0700 Subject: [PATCH 3/5] test(gui): inspect bridge handshake in staged adapter asset, not HTML shell --- tests/approved_native_gui_bundle_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index 7213ae20a..9712576e3 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -25,7 +25,8 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) self.assertIn('id="armix-native-boot-guard"', native) self.assertNotIn('id="armix-native-boot-guard"', approved) self.assertIn('data-armix-native-boot="waiting"', native) - self.assertIn('nativeBridgeAttached:true', native) + self.assertIn('nativeBridgeAttached:true', + (out / 'assets/approved-native-bridge.js').read_text('utf-8')) self.assertNotIn("__ARMIX_NATIVE_M2__", approved) self.assertIn("__ARMIX_NATIVE_M2__", native) # Never let a missing ASIO driver or delayed native snapshot From 9fc896ed7b4fd5e994f4e0497e2ea2d37f1c05a1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 10 Nov 2026 08:09:19 +0700 Subject: [PATCH 4/5] fix(asio): rebuild pristine SOURCE NONE PCM mixer on verified same-driver restart A callback epoch transition must never strand an unedited native mixer in the Pages-only reference state. Only the same registered ASIO driver, identical output masks/labels and rate can rebuild the silent unpatched ChannelId publisher; authored FX/WIRE use the existing retained transaction. No guessed MAIN device, no auto-arm and no callback allocations. --- src/LiveAudioEngine.h | 25 +++++++++++++++++++++++ src/LiveDryRoutingLab.h | 9 ++++++++ src/Main.cpp | 25 ++++++++++++++++++++++- tests/mixer_io_operator_contract_test.mjs | 15 ++++++++++++++ 4 files changed, 73 insertions(+), 1 deletion(-) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index b60ea7538..8b16d7ca8 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -559,6 +559,31 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback acceptedMixerBinding_=std::move(inspected.live); return true; } + // A SOURCE NONE starter is not an authored Show: it has no FX/WIRE to + // rebind, yet still must survive an ASIO STOP/START as an actual PCM + // mixer. Keep the old playback identity and pin names; no auto-redirect. + bool hasPristineSilentMixerAwaitingAsio() const noexcept { + return dryRoutingLab_.hasPristineSilentMixerAwaitingDevice() && + acceptedMixerBinding_ && acceptedMixerBinding_->backend=="ASIO" && + asioPinnedRegistration_.valid() && attached_ && !independent_.active(); + } + bool rebuildPristineSilentAsioMixer() { + if(!hasPristineSilentMixerAwaitingAsio() || !allOutputsDisarmed() || + handoff_.busy() || + routeReconfiguring_.load(std::memory_order_acquire) || + diagnosticRoute()!=armix::diagnostics::Route::normal)return false; + auto* device=deviceManager_.getCurrentAudioDevice(); + if(!device || !device->isOpen() || !sameRetainedAsioDriver())return false; + const auto current=readMixerBinding(*device); + if(current.backend!="ASIO" || + current.playback!=acceptedMixerBinding_->playback || + current.outputMask!=acceptedMixerBinding_->outputMask || + current.outputNames!=acceptedMixerBinding_->outputNames || + current.rate!=acceptedMixerBinding_->rate)return false; + if(!approveDirectRoute(&asioPinnedRegistration_))return false; + return startUnpatchedProductionSession().isEmpty() && + dryRoutingLab_.channelIdPhysicalPcmActive(); + } bool takeAsioResetMonitorIntent() noexcept { return resumeMainAfterAsioReset_.exchange(false,std::memory_order_acq_rel); } diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 3bf0cdb0b..ec399d3a5 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -2654,6 +2654,15 @@ class LiveDryRoutingLab final { return true; return false; } + // A pristine SOURCE NONE mixer must not disappear when an ASIO callback + // stops/restarts. It contains no authored FX, WIRE, source or fader edit; + // rebuilding it is safe only on CONTROL after verifying the same device. + bool hasPristineSilentMixerAwaitingDevice() const noexcept { + return active() && sourceTemplate_.isObject() && + !acceptedRoute_.isObject() && !nativeStructureLive_ && + !nativeControlDirty_ && !channelIdPhysicalPcmActive() && + !hasAuthoredMixerContent(); + } // CONTROL only. The verified profile proves identical port ordinals. // Rebuild DSP scratch/PDC while retaining the accepted document and // compatible processors. Never re-use a processor at a different rate. diff --git a/src/Main.cpp b/src/Main.cpp index 4f30d3bcb..6a915369a 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -5424,7 +5424,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr void serviceAsioMixerRestart() { const auto epoch=engine_.dryRoutingLabEpoch(); - if(epoch==asioRecoveryEpoch_ || !engine_.hasRetainedNativeSession() || + const bool retained=engine_.hasRetainedNativeSession(); + const bool silent=engine_.hasPristineSilentMixerAwaitingAsio(); + if(epoch==asioRecoveryEpoch_ || (!retained && !silent) || audioDeviceApplyActive_ || (audioSetupWindow_ && audioSetupWindow_->isVisible()) || nativeShowBusy_ || studioBackupBusy_ || mixerSessionWorker_.busy() || catalog_.busy() || engine_.isGraphSwitchPending() || engine_.independentClockActive() || @@ -5467,6 +5469,27 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr return; } } + if(silent) { + // Recreate the original unedited SOURCE NONE PCM publisher only + // after proving the SAME ASIO driver and playback pin identity. + // No saved mixer, FX or WIRE may be replaced by this path. + if(!engine_.rebuildPristineSilentAsioMixer()) { + asioRecoveryGate_.bindFailed(now); + diagnostics_.record("ASIO_SILENT_MIXER_REBUILD_REJECTED", + "Registered ASIO driver/pins or native graph not ready"); + emitApprovedNativeSnapshot(); + return; + } + asioRecoveryEpoch_=engine_.dryRoutingLabEpoch(); + asioRecoveryGate_.carryInternalEpoch(asioRecoveryEpoch_); + asioRecoveryGate_.recovered(); + mixerSessionStatus_="PRISTINE_SOURCE_NONE_REATTACHED"; + mixerSessionError_.clear(); + diagnostics_.record("ASIO_SILENT_MIXER_REATTACHED", + "Same physical ASIO output; no mic source and no auto-arm"); + emitApprovedNativeSnapshot(); + return; + } if(!engine_.authorizeRetainedAsioRestart()) { // Admission can lag driver restart without any driver call. // It MUST NOT exhaust the bounded reopen/correction allowance. diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index 3622a42cf..01a4c885c 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -634,6 +634,21 @@ test('Missing ASIO device can reopen only the pinned registered user-selected dr assert.match(selected,/asioPinnedRegistration_\.sameDriverClass\(registered\.registration\.identity\)/); }); +test('ASIO callback restart restores pristine SOURCE NONE without replacing authored mixer',()=>{ + const main=read('src/Main.cpp'),engine=read('src/LiveAudioEngine.h'), + dry=read('src/LiveDryRoutingLab.h'); + const service=main.slice(main.indexOf('void serviceAsioMixerRestart()'), + main.indexOf('void changeListenerCallback (')); + assert.match(service,/const bool silent=engine_\.hasPristineSilentMixerAwaitingAsio\(\)/); + assert.match(service,/if\(silent\)\s*\{/); + assert.match(service,/engine_\.rebuildPristineSilentAsioMixer\(\)/); + assert.match(engine,/current\.outputMask!=acceptedMixerBinding_->outputMask/); + assert.match(engine,/current\.outputNames!=acceptedMixerBinding_->outputNames/); + assert.match(engine,/sameRetainedAsioDriver\(\)/); + assert.match(dry,/hasPristineSilentMixerAwaitingDevice\(\)/); + assert.match(dry,/!hasAuthoredMixerContent\(\)/); +}); + test('ASIO restart cannot strand MAIN off after temporary graph readiness faults',()=>{ const main=read('src/Main.cpp'),engine=read('src/LiveAudioEngine.h'); const arm=main.slice(main.indexOf('void serviceAutomaticMain()'),main.indexOf('void requestAutomaticMain(')); From 6d92bbcc77e595b55ad77dbb3049fc311d0c683a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 10 Nov 2026 08:11:48 +0700 Subject: [PATCH 5/5] fix(native-ui): hide demo-only labels in installed mixer; retain exact approved Pages preview --- tests/approved_native_gui_bundle_test.py | 2 ++ web/approved-native-bridge.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index 9712576e3..ede60d0e0 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -57,6 +57,8 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) self.assertIn("orbitAction", context_menu) self.assertNotIn("approved-native-context-menu.js", approved) self.assertIn("arMixGuiReady", (out / "assets/approved-native-bridge.js").read_text("utf-8")) + self.assertIn('".plugin-disclaimer"', + (out / "assets/approved-native-bridge.js").read_text("utf-8")) for asset in (source / "assets").iterdir(): self.assertEqual((out / "assets" / asset.name).read_bytes(), asset.read_bytes(), "Native /preview/ asset differs: " + asset.name) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 1671bb636..c32ec7f39 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -3252,6 +3252,17 @@ addFx:"Use a verified FX insert slot on an admitted channel" }); function presentNativeOnlyTools(){ + // The static Pages reference includes demo labels even in its popup + // windows. Keep the approved DOM/CSS for rendering, never advertise + // "UI DEMO" or reference-only tools inside the installed native app. + document.title="ArSonMix — Native Digital Mixer"; + for(const selector of [".plugin-disclaimer", + "#wireConfigWindow .wire-config-foot", + "#wireWorkspace .wire-ws-foot > span:last-child"]){ + const el=document.querySelector(selector); + if(el){el.style?.setProperty?.("display","none","important"); + el.setAttribute?.("aria-hidden","true");} + } for(const [id,reason] of Object.entries(nativeReferenceOnly)){ const el=document.getElementById(id); if(!el)continue;