diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 2d826b544..68e525359 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -111,6 +111,7 @@ jobs: python tests/native_harmony_assembly_test.py node --check site/preview-v2/assets/mixer-native-vocal-throw.js python tests/native_peq_assembly_test.py + python tests/native_v60_fader_assembly_contract.py python tests/approved_operator_ux_smoke.py python scripts/build_ui_css.py --check python tests/gui_baseline_lock_test.py diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index 7d6942805..c395e277f 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -105,8 +105,13 @@ def accepted_pages_html() -> str: "}\n"), ("scaleTopPct(v,-60,gainMax)", "(100.0-faderPercent(v,isSend))"), - (" const gain=Math.round((max-(max-min)*frac)*10)/10;\n", - " const gain=Math.round(faderDbFromTravelPercent(100*(1-frac),max===6)*10)/10;\n"), + (" let gain=Math.round((max-(max-min)*frac)*10)/10;\n", + " let gain=Math.round(faderDbFromTravelPercent(100*(1-frac),max===6)*10)/10;\n"), + # The native fader has a calibrated logarithmic travel (unity is 77%), + # while the public reference uses a linear dB scale. The detent MUST + # snap at the visual/PCM unity position of the native tapered curve. + (" const unityY=travel.top+travel.height*(max/(max-min));\n", + " const unityY=travel.top+travel.height*(1-faderPercent(0,max===6)/100);\n"), # Only the compiled Windows WebView gets verified native driver inputs. # Public /preview/ continues to show its labeled simulated reference. ("const channelOptions=(t,type)=>{\n", @@ -158,13 +163,10 @@ def accepted_pages_html() -> str: ("function fxNativeTransactionRequired(){\n", "function fxNativeTransactionRequired(){\n" " if(window.__JUCE__?.backend)return true;\n"), - # Source's pointerup clears faderGesture BEFORE the later deferred bridge - # listener runs. Dispatch exactly once at the actual gesture commit point. - (" const g=faderGesture;faderGesture=null;\n" - " g.box.releasePointerCapture?.(ev.pointerId);\n", - " const g=faderGesture;faderGesture=null;\n" - " g.box.releasePointerCapture?.(ev.pointerId);\n" - " if(window.__ARMIX_NATIVE_M2__?.consumeField?.({target:g.input,type:'change'}))return;\n"), + # V60 source sends the final change through handleField() exactly once + # on pointer release. The existing native-only handleField interception + # below/above takes that committed target to the ACK/readback dispatcher. + # Do NOT install a second synthetic pointerup native event. # Stage B: retain the approved exact V51 portrait meter gradient/peak hold # and dBFS calibration. Only elide redundant WebView2 style mutations: # these are authoritative native telemetry writes, NOT simulated signal. diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index 738a9808e..8e6cd958c 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -41,7 +41,12 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) self.assertIn("make,render,findTrack,displayMeterDbfs", native) self.assertIn("installGraph(channels,main,edges)", native) self.assertIn("if(window.__JUCE__?.backend)return true;", native) - self.assertIn("consumeField?.({target:g.input,type:'change'})", native) + # V60 public pointerup emits exactly one final change. The + # native-only handleField seam owns that event/ACK; a second + # synthetic callback here would duplicate the release. + self.assertEqual(native.count("handleField({target:g.input,type:'change',altKey:!!ev.altKey});"),1) + self.assertIn("window.__ARMIX_NATIVE_M2__?.consumeField?.(event);return;", native) + self.assertNotIn("consumeField?.({target:g.input,type:'change'})", native) self.assertEqual(manifest["approvedPagesHtmlSha256"], bundle.sha256((source / "index.html").read_bytes())) self.assertNotEqual(native, (ROOT / "web/index.html").read_text("utf-8")) self.assertIn("approved-native-bridge.js", native) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 124f26b32..ce2c812c2 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -1562,11 +1562,17 @@ test("P0 native hardware IN remains selectable after ChannelId ownership, failed assert.equal(sourceCommands()[1].payload.graphRevision,base.graph.revision); assert.notEqual(sourceCommands()[1].payload.requestId,id); }); -test("M3 Windows bundle owns pointerup fader gesture and fences native FX keyboard reorder",()=>{ +test("M3/V60 Windows bundle dispatches exactly one fader release through native ACK and fences FX reorder",()=>{ const builder=read("scripts/build_approved_native_gui.py"); + const preview=read("site/preview-v2/index.html"); const bridge=read("web/approved-native-bridge.js"); - assert.ok(builder.includes("const g=faderGesture;faderGesture=null;")); - assert.ok(builder.includes("consumeField?.({target:g.input,type:'change'})")); + assert.ok(preview.includes("const g=faderGesture;faderGesture=null;")); + assert.equal(preview.split("handleField({target:g.input,type:'change',altKey:!!ev.altKey});").length-1,1); + assert.ok(builder.includes("window.__ARMIX_NATIVE_M2__?.consumeField?.(event);return;")); + assert.ok(!builder.includes("consumeField?.({target:g.input,type:'change'})"), + "V60 source already emits the final change; native must not double-publish"); + assert.ok(builder.includes("faderDbFromTravelPercent(100*(1-frac),max===6)")); + assert.ok(builder.includes("faderPercent(0,max===6)/100")); assert.ok(builder.includes("function fxNativeTransactionRequired")); assert.ok(builder.includes("__ARMIX_NATIVE_SCOPE__")); assert.ok(bridge.includes("scope.installGraph(nextTracks,nextMaster,edges)")); diff --git a/tests/native_v60_fader_assembly_contract.py b/tests/native_v60_fader_assembly_contract.py new file mode 100644 index 000000000..26fee4571 --- /dev/null +++ b/tests/native_v60_fader_assembly_contract.py @@ -0,0 +1,33 @@ +"""V60 native WebView2 fader contract: reversible exact Pages source and one ACK. + +No audio hardware is claimed. This cheap assembly gate prevents pointer-source +changes from silently breaking JUCE HTML or moving the native unity detent. +""" +import importlib.util +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +spec = importlib.util.spec_from_file_location( + "arsonmix_native_v60_bundle", ROOT / "scripts/build_approved_native_gui.py") +bundle = importlib.util.module_from_spec(spec) +spec.loader.exec_module(bundle) + + +def run(): + public = bundle.accepted_pages_html() + native = bundle.native_html(public) + assert bundle.public_from_native(native) == public, "Native Pages not reversible" + assert " let gain=Math.round((max-(max-min)*frac)*10)/10;" in public + assert " let gain=Math.round(faderDbFromTravelPercent(100*(1-frac),max===6)*10)/10;" in native + assert " const unityY=travel.top+travel.height*(max/(max-min));" in public + assert " const unityY=travel.top+travel.height*(1-faderPercent(0,max===6)/100);" in native + assert "FADER_TAPER=Object.freeze" in native + assert native.count("handleField({target:g.input,type:'change',altKey:!!ev.altKey});")==1 + assert native.count("if(window.__JUCE__?.backend){window.__ARMIX_NATIVE_M2__?.consumeField?.(event);return;}")==1 + assert "consumeField?.({target:g.input,type:'change'})" not in native + assert native.count("FADER_UNITY_CAPTURE_PX=7,FADER_UNITY_RELEASE_PX=12")==1 + print("PASS V60 native fader taper/zero detent/final native ACK and reversible Pages") + + +if __name__ == "__main__": + run()