Skip to content

Commit da0daf3

Browse files
committed
Milestone A: one native mixer session authority, correlated controls, reconcile #419
Publish a single control-thread mixerSession choosing admitted ChannelId or verified M4, route 10CH controls through only its PCM authority, correlate per-parameter M4 ACK to subsequent independent producer readback, preserve physical MAIN gain/mute with native ChannelId, fail closed unsafe JS FX rack fan-out pending #421 atomic native gate. Transfer #419 mobile GUI source exact blobs from main; no DSP callbacks or alternate preview.
2 parents c9261fc + 591444d commit da0daf3

11 files changed

Lines changed: 469 additions & 80 deletions

‎.github/workflows/ui-smoke.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ jobs:
166166
run: python tests/approved_native_meter_dirty_stage_b_smoke.py
167167
- name: Verify Stage C shipped CSS versus original-source computed and screenshot parity
168168
run: python tests/approved_stage_c_css_visual_parity_smoke.py
169+
- name: Check real mobile /preview/ touch toolbar, popup and stray chevrons
170+
run: python tests/approved_preview_mobile_navigation_smoke.py
169171
- name: Stage D one runtime CSSOM and actual stylesheet network count
170172
run: python tests/approved_css_stage_d_single_bundle_smoke.py
171173
- name: Stage C rendered CSS parity (original vs compiled, three viewports + hover)
@@ -448,5 +450,6 @@ jobs:
448450
pages-v54-*.png
449451
pages-v55-*.png
450452
pages-v28-physical-console-owner-v59-*.png
453+
pages-mobile-*.png
451454
if-no-files-found: ignore
452455
retention-days: 3

‎integration/ApprovedNativeRuntimeSnapshot.h‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,109 @@ inline bool projectInstalledNativeChannelIdGraph(
284284
// Product LIVE stays false until independent vendor/Show/hardware FAT.
285285
return true;
286286
}
287+
288+
/**
289+
* Milestone A: one authoritative control-thread SessionSnapshot projection.
290+
* The native callback remains the only PCM producer. Legacy M4 may be an
291+
* implementation detail but NEVER independently competes with ChannelId.
292+
* There is no UI, file I/O, VST preparation or RT mutation in this routine.
293+
*/
294+
inline void publishAuthoritativeMixerSession(juce::var& snapshot)
295+
{
296+
if(!snapshot.isObject())return;
297+
const auto device=snapshot.getProperty("device",{});
298+
const auto graph=snapshot.getProperty("graph",{});
299+
const auto caps=graph.getProperty("capabilities",{});
300+
const auto m4=snapshot.getProperty("legacyM4",{});
301+
const auto epoch=device.getProperty("epoch","0").toString();
302+
const auto graphRows=graph.getProperty("channels",{});
303+
const bool channelIdReady=caps.isObject() &&
304+
static_cast<bool>(caps.getProperty("callbackOwnsChannelIds",false)) &&
305+
nativeV8Decimal(epoch) && epoch!="0" &&
306+
nativeV8Decimal(graph.getProperty("revision",{})) &&
307+
graphRows.isArray() && graphRows.getArray()->size()>0;
308+
const auto sources=m4.getProperty("channels",{});
309+
const auto controls=m4.getProperty("channelControls",{});
310+
const auto peakL=m4.getProperty("channelPeaksL",{});
311+
const auto peakR=m4.getProperty("channelPeaksR",{});
312+
const bool preparedM4=!channelIdReady && m4.isObject() &&
313+
static_cast<bool>(m4.getProperty("active",false)) &&
314+
static_cast<bool>(m4.getProperty("routeAccepted",false)) &&
315+
!static_cast<bool>(m4.getProperty("nativeBusStructural",true)) &&
316+
nativeV8Decimal(epoch) && epoch!="0" &&
317+
nativeV8Decimal(m4.getProperty("routingRevision",{})) &&
318+
sources.isArray() && controls.isArray() && peakL.isArray() && peakR.isArray() &&
319+
sources.getArray()->size()==10 && controls.getArray()->size()==10 &&
320+
peakL.getArray()->size()==10 && peakR.getArray()->size()==10;
321+
juce::Array<juce::var> rows;
322+
bool validM4=preparedM4;
323+
if(preparedM4) {
324+
for(int i=0;i<10;++i) {
325+
const auto src=sources[i],ctl=controls[i];
326+
double db=0.,pan=0.,l=0.,r=0.;
327+
if(!src.isObject() || !ctl.isObject() ||
328+
!nativeV8Number(ctl.getProperty("db",{}),db) ||
329+
!nativeV8Number(ctl.getProperty("pan",{}),pan) ||
330+
!nativeV8Number(peakL[i],l) ||
331+
!nativeV8Number(peakR[i],r) ||
332+
!ctl.getProperty("mute",{}).isBool() ||
333+
!ctl.getProperty("solo",{}).isBool() ||
334+
!src.getProperty("main",{}).isBool() ||
335+
db< -60.01 || db>10.01 || pan< -100.01 || pan>100.01 ||
336+
l<0. || r<0.) {validM4=false;break;}
337+
auto c=std::make_unique<juce::DynamicObject>();
338+
c->setProperty("faderDb",db);
339+
c->setProperty("pan",pan/100.);
340+
c->setProperty("mute",ctl.getProperty("mute",{}));
341+
c->setProperty("solo",ctl.getProperty("solo",{}));
342+
auto row=std::make_unique<juce::DynamicObject>();
343+
// M4 IDs are deliberately NOT uint64 native ChannelIds.
344+
row->setProperty("id","m4:"+juce::String(i+1).paddedLeft('0',2));
345+
row->setProperty("ordinal",i);
346+
row->setProperty("role","INPUT");
347+
row->setProperty("source",src);
348+
row->setProperty("controls",juce::var(c.release()));
349+
row->setProperty("primaryOut",static_cast<bool>(
350+
src.getProperty("main",false))?"MAIN":"NONE");
351+
row->setProperty("peakL",l);
352+
row->setProperty("peakR",r);
353+
rows.add(juce::var(row.release()));
354+
}
355+
if(!validM4)rows.clear();
356+
}
357+
auto session=std::make_unique<juce::DynamicObject>();
358+
const auto authority=channelIdReady?"CHANNEL_ID":validM4?"M4":"NONE";
359+
session->setProperty("authority",authority);
360+
session->setProperty("deviceEpoch",epoch);
361+
session->setProperty("routeRevision",channelIdReady?
362+
graph.getProperty("revision","0"):validM4?
363+
m4.getProperty("routingRevision","0"):juce::var("0"));
364+
session->setProperty("rosterRevision",channelIdReady?
365+
graph.getProperty("rosterRevision","0"):juce::var("0"));
366+
session->setProperty("channels",channelIdReady?graphRows:juce::var(rows));
367+
session->setProperty("supportedOps",channelIdReady?
368+
caps.getProperty("supportedOps",juce::var(juce::Array<juce::var>{})):
369+
juce::var(juce::Array<juce::var>{}));
370+
// Actual physical post-mixer MAIN is not a second audio graph.
371+
auto master=std::make_unique<juce::DynamicObject>();
372+
if(channelIdReady) {
373+
for(const auto& ch:*graphRows.getArray())
374+
if(ch.getProperty("role","").toString()=="MAIN") {
375+
const auto c=ch.getProperty("controls",{});
376+
if(c.isObject()) {
377+
master->setProperty("db",c.getProperty("faderDb",{}));
378+
master->setProperty("mute",c.getProperty("mute",{}));
379+
}
380+
break;
381+
}
382+
}else if(validM4) {
383+
master->setProperty("db",m4.getProperty("masterDb",{}));
384+
master->setProperty("mute",m4.getProperty("masterMute",{}));
385+
}
386+
master->setProperty("outputArmed",device.getProperty("outputArmed",false));
387+
session->setProperty("main",juce::var(master.release()));
388+
snapshot.getDynamicObject()->setProperty("mixerSession",
389+
juce::var(session.release()));
390+
}
391+
287392
} // namespace armix::console

‎scripts/compile_approved_css.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
from pathlib import Path
1919
import re
2020

21-
LINK = re.compile(r'(<link\s+rel="stylesheet"\s+href="assets/)([^"?]+\.css)(\?[^"]*)?(")', re.I)
21+
# Match the WHOLE tag, including its closing >. Stage D removes 17 links;
22+
# matching only their closing quote left 18 literal '>' rendered above the GUI,
23+
# most visibly in mobile viewport. Preserve all attributes/order fail-closed.
24+
LINK = re.compile(r'(<link\s+rel="stylesheet"\s+href="assets/)([^"?]+\.css)(\?[^"]*)?("\s*/?>)', re.I)
2225
PROPERTY = re.compile(r"^\s*(--[A-Za-z0-9_-]+|[-A-Za-z_][-A-Za-z0-9_]*)\s*:", re.S)
2326
IMPORTANT = re.compile(r"!\s*important\s*$", re.I)
2427
CONTAINER = re.compile(r"^@(media|supports|container|layer|scope)(?=\s|\()", re.I)

‎site/preview-v2/assets/mixer-console-foundation.css‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
font:11px/1.32 "Segoe UI",Arial,sans-serif;
77
}
88
*{box-sizing:border-box}
9-
html,body{width:100%;height:100%;min-width:760px;min-height:540px;margin:0;overflow:hidden;background:#202123;color:var(--ink)}
9+
html,body{width:100%;height:100%;min-width:min(760px,100%);min-height:540px;margin:0;overflow:hidden;background:#202123;color:var(--ink)}
1010
button,input,select{font:inherit;color:inherit}
1111
button{cursor:pointer}
1212
button:focus-visible,input:focus-visible,select:focus-visible{outline:1px solid #8cc5da;outline-offset:-1px}
@@ -31,4 +31,30 @@ button:disabled{opacity:.45;cursor:not-allowed}
3131
.mixer-title .accent{height:12px;width:3px;background:#55afcb}
3232
.mixer-title .panel-name{font-weight:600}
3333
.mixer-title .panel-sub{color:#8f9295}
34-
.mixer-title .right{margin-left:auto;color:#808488;font-size:10px}
34+
.mixer-title .right{margin-left:auto;color:#808488;font-size:10px}
35+
36+
/* Official /preview/ on phone: the desktop console remains a real, scrollable
37+
mixer, not a second mobile skin. All selectors belong to this foundation
38+
owner; no CSS override file, repeated > arrows or changed desktop controls.
39+
More stays reachable, and its popup must not be clipped by toolbar scroll. */
40+
@media (max-width:759px){
41+
.app .window-title{min-width:0;gap:8px;overflow:hidden}
42+
.app .window-title .study{display:none}
43+
.app .window-title .file-name{min-width:0;max-width:55vw;overflow:hidden;text-overflow:ellipsis}
44+
.app .command-bar{
45+
max-width:100%;min-width:0;
46+
overflow-x:auto;overflow-y:hidden;
47+
touch-action:pan-x;overscroll-behavior-x:contain;
48+
-webkit-overflow-scrolling:touch;
49+
scrollbar-width:thin;
50+
}
51+
.app .command-bar .more-tools{
52+
order:-1;margin-left:0;left:0;position:sticky;z-index:2;
53+
}
54+
.app .command-bar .more-tools-panel{
55+
position:fixed;left:8px;right:8px;top:64px;width:auto;
56+
max-height:calc(100dvh - 76px);overflow:auto;z-index:60;
57+
}
58+
.app .console-pane{min-width:0}
59+
.app .tracks-viewport{min-width:0}
60+
}

‎src/Main.cpp‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
852852
(void) armix::console::publishVerifiedFirstSoundState (accepted, live);
853853
(void) armix::console::projectInstalledNativeChannelIdGraph (
854854
accepted, live);
855+
// Sole control-thread SessionSnapshot from the installed PCM publisher.
856+
armix::console::publishAuthoritativeMixerSession(accepted);
855857
return accepted;
856858
}
857859

@@ -1637,7 +1639,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
16371639
requestId.length()<=48 &&
16381640
!nativeShowBusy_ && !studioBackupBusy_ &&
16391641
static_cast<bool>(route.getProperty("hasAcceptedRoute",false)) &&
1640-
!static_cast<bool>(route.getProperty("nativeBusStructural",false)) &&
1642+
// Native ChannelId may own CH1..10 while the physical host
1643+
// still owns post-mixer MAIN gain/mute. Admit only MAIN in that case.
1644+
(channel==-1 ||
1645+
!static_cast<bool>(route.getProperty("nativeBusStructural",false))) &&
16411646
!static_cast<bool>(route.getProperty("topologyFault",true)) &&
16421647
engine_.directRouteAuthorized() && !engine_.independentClockActive();
16431648
const bool boolean=(name=="mute"||name=="solo"||name=="masterMute");
@@ -1665,6 +1670,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
16651670
auto ack=std::make_unique<juce::DynamicObject>();
16661671
ack->setProperty("requestId",requestId);
16671672
ack->setProperty("ok",applied);
1673+
ack->setProperty("deviceEpoch",currentEp);
1674+
ack->setProperty("routingRevision",currentRv);
1675+
ack->setProperty("channel",channel);
1676+
ack->setProperty("parameter",name);
16681677
ack->setProperty("error",applied?juce::String():
16691678
juce::String("Stale G0 route, invalid parameter or PCM authority changed"));
16701679
if(browser_.loaded)

‎tests/approved_css_stage_c_compiler_test.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,21 @@ def test_stage_d_single_cssom_preserves_owner_order_and_relative_assets(self):
153153
with self.assertRaisesRegex(ValueError,"@import"):
154154
css.compile_runtime_bundle([("a.css",'@import url("other.css");.x{opacity:1}')])
155155

156+
def test_stage_d_consumes_complete_link_tags_no_stray_gt_in_mobile_body(self):
157+
# Regression: previous LINK matched closing quote but not '>'. After
158+
# removing 18 tags the browser displayed '> > > ...' before ArSonMix.
159+
owners = "".join(
160+
f'<link rel="stylesheet" href="assets/owner-{i}.css?v=1">'
161+
for i in range(18)
162+
)
163+
document = "<html><head>" + owners + "</head><body><div>ArSonMix</div></body></html>"
164+
rebuilt = css.link_runtime_bundle(document, "0123456789abcdef")
165+
expected = ('<html><head><link rel="stylesheet" href="assets/'
166+
'arsonmix-approved-runtime.css?sha=0123456789abcdef">'
167+
'</head><body><div>ArSonMix</div></body></html>')
168+
self.assertEqual(rebuilt, expected, "No orphan > text nodes from removed links")
169+
self.assertEqual(len(list(css.LINK.finditer(rebuilt))), 1)
170+
156171
def test_stage_d_retains_fallbacks_for_older_webview2_and_missing_vars(self):
157172
original='.control{color:#fff;color:var(--preferred-color)}'
158173
optimized,stats=css.optimize_css([("a.css",original)])

‎tests/approved_native_m2_contract.test.cjs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ test("P0 DAW approved Windows GUI directly binds every IN to current JUCE ports,
135135
assert.match(bridge,/openNativeAudioIO\(\)/);
136136
assert.match(bridge,/\.armix-audio-shade\[hidden\]\{display:none\}/);
137137
assert.match(producer,/firstSound->setProperty\("channels",juce::var\(verifiedChannels\)\)/);
138+
assert.match(producer,/publishAuthoritativeMixerSession/);
139+
assert.match(nativeMain,/publishAuthoritativeMixerSession\(accepted\)/);
140+
assert.match(bridge,/session\.authority==="CHANNEL_ID"/);
141+
assert.match(bridge,/m4ControlIsOwner\(\)/);
138142
assert.match(producer,/list->size\(\)==10/);
139143
assert.match(nativeMain,/engine_\.switchDryRoutingLabSource\(channel,/);
140144
assert.match(nativeMain,/engine_\.liveOutputArmFault\(\)/);
@@ -222,9 +226,9 @@ test("P0 real slot VST3 power and native editor use verified instance tokens",()
222226
assert.match(bridge,/function requestNativeFxPower\(t,slot,bypass\)/);
223227
assert.match(bridge,/if\(action==="slotPower"\)/);
224228
assert.match(bridge,/if\(action==="fxOn"\)/);
225-
assert.match(bridge,/const rackSavedBypass=new Map\(\)/);
226-
assert.match(bridge,/saved\.get\(row\.instanceId\)/);
227-
assert.match(bridge,/rackSavedBypass\.set\(lane,original\)/);
229+
assert.doesNotMatch(bridge,/rackSavedBypass/);
230+
assert.match(bridge,/FX HEADER NOT ADMITTED/);
231+
assert.match(bridge,/individual VST3 states preserved/);
228232
assert.match(bridge,/action:"routingFxEditor"/);
229233
assert.match(bridge,/action:"routingFxBypass"/);
230234
assert.match(bridge,/backend\.addEventListener\("arMixRoutingFxBypassAck"/);

‎tests/approved_native_v8_projection_test.cpp‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,16 @@ static void installedCallbackAdmissionRegression(const juce::var& rawBus) {
308308
physicalMasterFound=true;
309309
}
310310
assert(physicalMasterFound);
311+
publishAuthoritativeMixerSession(snap);
312+
const auto session=snap.getProperty("mixerSession",{});
313+
assert(session.getProperty("authority","").toString()=="CHANNEL_ID");
314+
assert(session.getProperty("deviceEpoch","").toString()=="91");
315+
assert(session.getProperty("routeRevision","").toString()=="25");
316+
assert(session.getProperty("channels",{}).getArray()->size()==2);
317+
assert(session.getProperty("channels",{})[0].getProperty("id","").toString()
318+
=="9007199254740993");
319+
assert(std::abs(static_cast<double>(session.getProperty("main",{})
320+
.getProperty("db",0.))-(-13.5))<0.00001);
311321
// Real restart: lab routing epoch counts STOP+START, unlike M2
312322
// deviceStartCount. This G0-to-native authority switch must advance.
313323
auto disconnected=canonicalSnapshot();
@@ -327,6 +337,9 @@ static void installedCallbackAdmissionRegression(const juce::var& rawBus) {
327337
assert(disconnected.getProperty("device",{})
328338
.getProperty("epoch","").toString()=="93");
329339
assert(!projectInstalledNativeChannelIdGraph(disconnected,dead));
340+
publishAuthoritativeMixerSession(disconnected);
341+
assert(disconnected.getProperty("mixerSession",{})
342+
.getProperty("authority","").toString()=="NONE");
330343
const auto ghost=disconnected.getProperty("graph",{});
331344
assert(!static_cast<bool>(ghost.getProperty("capabilities",{})
332345
.getProperty("callbackOwnsChannelIds",false)));
@@ -561,6 +574,10 @@ int main() {
561574
installedCallbackAdmissionRegression(bus);
562575
firstSoundRouteAdmissionRegression();
563576
firstSoundMeasuredSignalEvidenceRegression();
577+
auto unadmitted=canonicalSnapshot();
578+
publishAuthoritativeMixerSession(unadmitted);
579+
assert(unadmitted.getProperty("mixerSession",{})
580+
.getProperty("authority","").toString()=="NONE");
564581

565582
auto missingMain=realBusReadbackFixture();
566583
missingMain.getProperty("channels",{})[1].getDynamicObject()

0 commit comments

Comments
 (0)