From af740c32ead9a07ea993c1c9da7953ccef5cd5b4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:43:13 +0700 Subject: [PATCH 01/64] perf(stage-a): add dormant opt-in profiler for approved GUI --- site/preview-v2/assets/gui-perf-probe.js | 204 +++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 site/preview-v2/assets/gui-perf-probe.js diff --git a/site/preview-v2/assets/gui-perf-probe.js b/site/preview-v2/assets/gui-perf-probe.js new file mode 100644 index 000000000..292541c42 --- /dev/null +++ b/site/preview-v2/assets/gui-perf-probe.js @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Opt-in measurement of the ONE approved /preview/ GUI and its native WebView2. +// No CSS, overlay, polling, rAF loop or performance observer while inactive. +// This is a JS frame/event proxy, NOT hardware input-to-photon or GPU paint timing. +(function () { + 'use strict'; + const LIMIT = 2400; + const ZONES = ['mixer', 'chrome', 'other', 'idle']; + let session = null; + let lastReport = null; + + function percentile(sorted, p) { + if (!sorted.length) return null; + const index = (sorted.length - 1) * p; + const lo = Math.floor(index), hi = Math.ceil(index); + return sorted[lo] + (sorted[hi] - sorted[lo]) * (index - lo); + } + function stats(values) { + const sorted = values.slice().sort((a, b) => a - b); + const round = value => value === null ? null : Math.round(value * 1000) / 1000; + return { + samples: sorted.length, + medianMs: round(percentile(sorted, .5)), + p95Ms: round(percentile(sorted, .95)), + p99Ms: round(percentile(sorted, .99)), + maxMs: round(sorted.length ? sorted[sorted.length - 1] : null), + over33Pct: sorted.length + ? round(sorted.filter(value => value > 33.333).length * 100 / sorted.length) : null + }; + } + function nativeEvent(name, payload) { + try { + const backend = window.__JUCE__?.backend; + if (backend && typeof backend.emitEvent === 'function') { + backend.emitEvent(name, payload); + return true; + } + } catch (_) { /* A public Pages preview is not a native JUCE host. */ } + return false; + } + function record(values, value) { + if (Number.isFinite(value) && value >= 0 && values.length < LIMIT) values.push(value); + } + function classify(target) { + if (target?.closest?.('.console-body')) return 'mixer'; + if (target?.closest?.('.window-title,.command-bar,.status-bar')) return 'chrome'; + return 'other'; + } + function onPointer(event) { + const s = session; + if (!s) return; + const zone = classify(event.target); + s.zone = zone; + s.lastPointerAt = performance.now(); + s.pendingPointerAt = s.lastPointerAt; + s.pointerMoves[zone]++; + } + function onVisibility() { + if (session && document.hidden) session.hiddenTransitions++; + } + function tick(now) { + const s = session; + if (!s) return; + if (s.lastFrameAt && now > s.lastFrameAt) { + const zone = !document.hidden && now - s.lastPointerAt < 280 ? s.zone : 'idle'; + record(s.frames[zone], now - s.lastFrameAt); + } + s.lastFrameAt = now; + if (s.pendingPointerAt !== null) { + // Event-handled-to-next-rAF proxy, NOT physical input or photon latency. + record(s.pointerToRaf, Math.max(0, now - s.pendingPointerAt)); + s.pendingPointerAt = null; + } + s.raf = requestAnimationFrame(tick); + } + function start(options) { + if (session) return false; + options = options || {}; + const requested = Number(options.durationMs); + const durationMs = Number.isFinite(requested) + ? Math.min(60000, Math.max(500, requested)) : 15000; + const s = { + label: String(options.label || 'operator-pointer-sweep').slice(0, 80), + startAt: performance.now(), durationMs, raf: 0, timeout: 0, + lastFrameAt: 0, lastPointerAt: -Infinity, pendingPointerAt: null, + zone: 'idle', hiddenTransitions: 0, pointerMoves: {mixer: 0, chrome: 0, other: 0}, + frames: {mixer: [], chrome: [], other: [], idle: []}, + pointerToRaf: [], samples: Object.create(null), + longTaskAvailable: false, longTasks: 0, longTaskMs: 0, observer: null, + nativeConnected: false + }; + session = s; + const supports = window.PerformanceObserver?.supportedEntryTypes; + if (Array.isArray(supports) && supports.includes('longtask')) { + try { + s.observer = new PerformanceObserver(list => { + for (const entry of list.getEntries()) { + s.longTasks++; + s.longTaskMs += entry.duration; + } + }); + s.observer.observe({entryTypes: ['longtask']}); + s.longTaskAvailable = true; + } catch (_) { s.observer = null; } + } + document.addEventListener('pointermove', onPointer, {capture: true, passive: true}); + document.addEventListener('visibilitychange', onVisibility); + s.nativeConnected = nativeEvent('arMixPerfControl', {action: 'start'}); + s.raf = requestAnimationFrame(tick); + s.timeout = setTimeout(stop, durationMs); + console.info('[ArSonMix P0] opt-in profiler started:', s.label); + return true; + } + function sample(name, elapsedMs) { + const s = session; + if (!s || typeof name !== 'string' || name.length > 60) return; + if (!Object.prototype.hasOwnProperty.call(s.samples, name)) { + if (Object.keys(s.samples).length >= 12) return; + s.samples[name] = []; + } + record(s.samples[name], elapsedMs); + } + function stop() { + const s = session; + if (!s) return lastReport; + session = null; + cancelAnimationFrame(s.raf); + clearTimeout(s.timeout); + document.removeEventListener('pointermove', onPointer, true); + document.removeEventListener('visibilitychange', onVisibility); + s.observer?.disconnect(); + const perZone = {}; + for (const zone of ZONES) perZone[zone] = stats(s.frames[zone]); + const operations = {}; + for (const key of Object.keys(s.samples)) operations[key] = stats(s.samples[key]); + const report = { + schema: 'arsonmix.gui-perf-stage-a.v1', + label: s.label, + capturedAt: new Date().toISOString(), + durationMs: Math.round(performance.now() - s.startAt), + platform: navigator.platform || 'unknown', + renderer: window.__JUCE__?.backend ? 'JUCE-WebView2' : 'browser-preview', + display: {width: innerWidth, height: innerHeight, devicePixelRatio: devicePixelRatio}, + measurement: 'JS rAF pacing and handled-pointer-to-rAF only; not OS cursor, GPU paint or input-to-photon', + zoneFrames: perZone, + pointerMoves: s.pointerMoves, + handledPointerToRafMs: stats(s.pointerToRaf), + operations, + hiddenTransitions: s.hiddenTransitions, + longTaskAvailable: s.longTaskAvailable, + longTasks: s.longTaskAvailable ? s.longTasks : null, + longTaskMs: s.longTaskAvailable ? Math.round(s.longTaskMs * 1000) / 1000 : null, + native: s.nativeConnected ? 'separate diagnostic log / native event' : 'not connected' + }; + lastReport = report; + // Native control thread emits its own independent timing summary at STOP. + if (s.nativeConnected) { + nativeEvent('arMixPerfControl', {action: 'stop'}); + nativeEvent('arMixPerfTrace', report); + } + console.info('[ArSonMix P0] GUI profile (copy ArSonMixPerf.exportJSON()):', report); + return report; + } + function download() { + if (!lastReport) return false; + const blob = new Blob([JSON.stringify(lastReport, null, 2)], {type: 'application/json'}); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = 'arsonmix-gui-perf-stage-a.json'; + link.click(); + setTimeout(() => URL.revokeObjectURL(url), 1000); + return true; + } + function exportJSON() { + return lastReport ? JSON.stringify(lastReport, null, 2) : null; + } + const api = Object.freeze({ + get active() { return session !== null; }, + get last() { return lastReport; }, + start, stop, sample, download, exportJSON + }); + Object.defineProperty(window, 'ArSonMixPerf', {value: api, configurable: false}); + + try { + window.__JUCE__?.backend?.addEventListener?.('arMixPerfNativeResult', raw => { + if (lastReport && raw?.schema === 'arsonmix.native-message-thread.v1') { + lastReport.native = raw; + console.info('[ArSonMix P0] native JUCE message-thread profile:', raw); + } + }); + } catch (_) { /* WebView integration is optional in the public Pages view. */ } + + document.addEventListener('keydown', event => { + if (!(event.ctrlKey && event.altKey && event.shiftKey && event.code === 'F9')) return; + event.preventDefault(); + if (session) stop(); + else start({label: 'Windows pointer A/B'}); + }, {capture: true}); + + if (new URLSearchParams(location.search).get('armixperf') === '1') { + start({label: 'opt-in-url'}); + } +})(); From c8006c0e05c2e47609b62369361908c4682bb874 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:43:41 +0700 Subject: [PATCH 02/64] perf(stage-a): load dormant profiler in only approved Pages/native GUI --- site/preview-v2/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 7be436edb..73c62acbe 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -2886,5 +2886,6 @@ + \ No newline at end of file From 6deede2301f562f7adf7780e60c7962a447efdd8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:43:56 +0700 Subject: [PATCH 03/64] perf(stage-a): time accepted native JS snapshot only while recording --- web/approved-native-bridge.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 7e548a6e3..3693a2617 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -317,7 +317,14 @@ } } }); - backend.addEventListener("arMixConsoleSnapshot", snapshot=>controller.onSnapshot(snapshot)); + backend.addEventListener("arMixConsoleSnapshot", snapshot=>{ + // Stage A: do not add time-sampling overhead unless explicitly armed. + const profiler=window.ArSonMixPerf; + if(!profiler?.active){controller.onSnapshot(snapshot);return;} + const started=performance.now(); + try{controller.onSnapshot(snapshot);} + finally{profiler.sample("nativeSnapshotJsMs",performance.now()-started);} + }); backend.addEventListener("arMixConsoleAck", ack=>controller.onAck(ack)); backend.addEventListener("arMixSourceSwitchAck", ack=>{ if(!pendingSourceId||ack?.requestId!==pendingSourceId)return; From 8e52bb9c91645717d278406c2442fa52cb7b2d68 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:44:57 +0700 Subject: [PATCH 04/64] perf(stage-a): opt-in JUCE message-thread timings and separate bounded trace evidence --- src/Main.cpp | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index f410bce6b..e62604582 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -207,6 +207,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // No GUI-side PCM, no legacy ordinal fallback and no fake ACK. handleApprovedNativeControl(args); }) + .withEventListener ("arMixPerfControl", [this] (juce::var args) { onGuiPerfControl(args); }) + .withEventListener ("arMixPerfTrace", [this] (juce::var args) { + if (args.getProperty("schema",{}).toString() != "arsonmix.gui-perf-stage-a.v1") return; + auto evidence = juce::JSON::toString(args, false); + if (evidence.length() > 3500) evidence = evidence.substring(0, 3500) + " [TRUNCATED]"; + diagnostics_.record("GUI_PERF_JS", evidence); + }) .withEventListener ("arMixParameter", [this] (juce::var args) { onParameter (args); }) .withEventListener ("arMixAction", [this] (juce::var args) { onAction (args); }) .withResourceProvider (assetFor)) @@ -282,6 +289,51 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr bool audioEngineStarted_ = false; bool setupLaunching_ = false; unsigned int timerTicks_ = 0; + // Opt-in and bounded: message-thread timing only, NEVER the audio callback. + struct GuiPerfStats + { + bool active = false; + unsigned int ticks = 0, statusReads = 0, snapshotEmits = 0, duplicateSnapshots = 0; + double prevTickMs = 0.0, maxTickGapMs = 0.0; + double totalTickMs = 0.0, maxTickMs = 0.0; + double totalStatusMs = 0.0, maxStatusMs = 0.0; + double totalSnapshotMs = 0.0, maxSnapshotMs = 0.0; + } guiPerf_; + + void onGuiPerfControl(const juce::var& args) + { + const auto action = args.getProperty("action", {}).toString(); + if (action == "start") + { + guiPerf_ = {}; + guiPerf_.active = true; + diagnostics_.record("GUI_PERF_CONTROL", "start"); + } + else if (action == "stop" && guiPerf_.active) + { + guiPerf_.active = false; + const auto average = [](double total, unsigned int count) + { + return count ? total / static_cast(count) : 0.0; + }; + auto object = std::make_unique(); + object->setProperty("schema", "arsonmix.native-message-thread.v1"); + object->setProperty("timerTicks", static_cast(guiPerf_.ticks)); + object->setProperty("timerMeanMs", average(guiPerf_.totalTickMs, guiPerf_.ticks)); + object->setProperty("timerMaxMs", guiPerf_.maxTickMs); + object->setProperty("timerMaxGapMs", guiPerf_.maxTickGapMs); + object->setProperty("statusReads", static_cast(guiPerf_.statusReads)); + object->setProperty("statusMeanMs", average(guiPerf_.totalStatusMs, guiPerf_.statusReads)); + object->setProperty("statusMaxMs", guiPerf_.maxStatusMs); + object->setProperty("snapshotEmits", static_cast(guiPerf_.snapshotEmits)); + object->setProperty("snapshotMeanMs", average(guiPerf_.totalSnapshotMs, guiPerf_.snapshotEmits)); + object->setProperty("snapshotMaxMs", guiPerf_.maxSnapshotMs); + object->setProperty("duplicateSnapshots", static_cast(guiPerf_.duplicateSnapshots)); + const juce::var result(object.release()); + diagnostics_.record("GUI_PERF_NATIVE", juce::JSON::toString(result, false)); + browser_.emitEventIfBrowserIsVisible("arMixPerfNativeResult", result); + } + } bool deviceSettingsDirty_ = false; bool unexpectedRouteNoticeSent_ = false; armix::device::DirectRestoreBackoff directRestore_; @@ -2466,6 +2518,16 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr void timerCallback() override { + // Always disabled unless the user explicitly starts a bounded trace. + const bool timing = guiPerf_.active; + const double tickStart = timing ? juce::Time::getMillisecondCounterHiRes() : 0.0; + if (timing) + { + if (guiPerf_.prevTickMs > 0.0) + guiPerf_.maxTickGapMs = std::max(guiPerf_.maxTickGapMs, + tickStart - guiPerf_.prevTickMs); + guiPerf_.prevTickMs = tickStart; + } ++timerTicks_; // A hidden JUCE/WebView2 peer may defer first navigation. Expose the // compositor behind the opaque startup splash after the first tick; @@ -2571,8 +2633,12 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr crackleEvidence_.push (makeEvidenceSample(health)); diagnostics_.record ("AUDIO_HEALTH", juce::JSON::toString (health, false)); if (consoleSubscribed_ && browser_.loaded) + { + // This extra 1 Hz publication is retained in Stage A for A/B evidence. + if (timing) ++guiPerf_.duplicateSnapshots; browser_.emitEventIfBrowserIsVisible ("arMixConsoleSnapshot", approvedNativeSnapshot (health)); + } } if (deviceSettingsDirty_) @@ -2616,7 +2682,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } if (catalog_.busy() && timerTicks_ % 3 == 0) emitScanProgress(); + const double statusStart = timing ? juce::Time::getMillisecondCounterHiRes() : 0.0; auto state = engine_.status(); + if (timing) + { + const double elapsed = juce::Time::getMillisecondCounterHiRes() - statusStart; + ++guiPerf_.statusReads; + guiPerf_.totalStatusMs += elapsed; + guiPerf_.maxStatusMs = std::max(guiPerf_.maxStatusMs, elapsed); + } if(routedEditorOwner_) { // Unplug/reopen may bypass normal GUI actions. Never keep a // vendor editor on an invalid device epoch or removed instance. @@ -2651,8 +2725,25 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // PCM meters update after startup, source patch, ARM and hotplug. // No additional DSP callback, allocation or work on realtime thread. if (consoleSubscribed_) + { + const double snapshotStart = timing ? juce::Time::getMillisecondCounterHiRes() : 0.0; browser_.emitEventIfBrowserIsVisible ( "arMixConsoleSnapshot", approvedNativeSnapshot(state)); + if (timing) + { + const double elapsed = juce::Time::getMillisecondCounterHiRes() - snapshotStart; + ++guiPerf_.snapshotEmits; + guiPerf_.totalSnapshotMs += elapsed; + guiPerf_.maxSnapshotMs = std::max(guiPerf_.maxSnapshotMs, elapsed); + } + } + if (timing) + { + const double elapsed = juce::Time::getMillisecondCounterHiRes() - tickStart; + ++guiPerf_.ticks; + guiPerf_.totalTickMs += elapsed; + guiPerf_.maxTickMs = std::max(guiPerf_.maxTickMs, elapsed); + } } }; From bec16a622aa21082b000fd231ff5fdf7109f68d8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:45:38 +0700 Subject: [PATCH 05/64] quality(css): forbid new cross-owner CSS stacking in approved mixer --- scripts/check_preview_css_ownership.py | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 scripts/check_preview_css_ownership.py diff --git a/scripts/check_preview_css_ownership.py b/scripts/check_preview_css_ownership.py new file mode 100644 index 000000000..c297c2ceb --- /dev/null +++ b/scripts/check_preview_css_ownership.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Prevent new cross-owner CSS declaration stacking in the ONE approved /preview/. + +This gate deliberately freezes the current debt, not the entire CSS file. +Deleting a duplicate is allowed. Adding an overlapping selector+property in a +new file, restoring an old owner, or adding another late stylesheet is blocked. +The lightweight leaf parser is deterministic and intentionally conservative. +Complex media queries/selector equivalence still require browser computed-style +and visual tests; this is NOT a complete CSS parser or proof of zero specificity +conflicts. +""" +from __future__ import annotations + +from collections import defaultdict +import json +from pathlib import Path +import re + +ROOT = Path(__file__).resolve().parents[1] +PAGE = ROOT / "site/preview-v2/index.html" +BASELINE = ROOT / "contracts/approved-preview-css-owner-baseline.json" +LINK = re.compile(r' list[str]: + if re.search(r")", html, re.I): + raise ValueError("Approved GUI must not regain late inline CSS override blocks") + names = LINK.findall(html) + if not names or len(names) != len(set(names)): + raise ValueError("Duplicate or missing stylesheet links in approved GUI") + return names + + +def source_path(name: str) -> Path: + if name == "mixer-control-keys.css": + # The approved hardware PNG buttons own this CSS, NOT base preview-v2. + return ROOT / "site/preview-buttons/assets" / name + return ROOT / "site/preview-v2/assets" / name + + +def declarations(css: str) -> set[str]: + clean = COMMENT.sub("", css) + found: set[str] = set() + for match in LEAF.finditer(clean): + selector = " ".join(match.group(1).split()) + if not selector or selector.startswith("@"): + continue + for property_match in PROP.finditer(match.group(2)): + found.add(selector + "||" + property_match.group(1)) + return found + + +def inspect() -> tuple[list[str], dict[str, list[str]]]: + names = stylesheet_names(PAGE.read_text(encoding="utf-8")) + owner_map: dict[str, set[str]] = defaultdict(set) + for name in names: + for key in declarations(source_path(name).read_text(encoding="utf-8")): + owner_map[key].add(name) + overlap = {key: sorted(owners) for key, owners in owner_map.items() if len(owners) > 1} + return names, dict(sorted(overlap.items())) + + +def verify() -> dict: + baseline = json.loads(BASELINE.read_text(encoding="utf-8")) + names, conflicts = inspect() + if names != baseline["linkedStylesheets"]: + raise ValueError("CSS source-owner order changed: review/update single-owner contract") + allowed = baseline["crossOwners"] + newly_stacked = { + key: actual for key, actual in conflicts.items() + if key not in allowed or not set(actual).issubset(allowed[key]) + } + if newly_stacked: + sample = list(newly_stacked.items())[:8] + raise ValueError("NEW CROSS-OWNER CSS STACKING FORBIDDEN: " + repr(sample)) + return { + "stylesheets": len(names), + "crossOwnerBaseline": len(allowed), + "crossOwnerCurrent": len(conflicts), + "eliminated": len(allowed) - len(conflicts), + "newCrossOwnerConflicts": 0, + } + + +if __name__ == "__main__": + print("APPROVED_CSS_OWNERSHIP_NO_NEW_STACKING", json.dumps(verify(), sort_keys=True)) From 9ac45c772eb411040eab6405e7c92ec00129f1a3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:45:58 +0700 Subject: [PATCH 06/64] quality(css): baseline 114 inherited approved-preview cross-owner declarations --- .../approved-preview-css-owner-baseline.json | 485 ++++++++++++++++++ 1 file changed, 485 insertions(+) create mode 100644 contracts/approved-preview-css-owner-baseline.json diff --git a/contracts/approved-preview-css-owner-baseline.json b/contracts/approved-preview-css-owner-baseline.json new file mode 100644 index 000000000..36e7cbf66 --- /dev/null +++ b/contracts/approved-preview-css-owner-baseline.json @@ -0,0 +1,485 @@ +{ + "schema": "arsonmix.approved-css-cross-owner-baseline.v1", + "sourceMainHead": "e477b3ebb8b2a1ab71fd7226b3f03a81868b70ab", + "linkedStylesheets": [ + "mixer-console-foundation.css", + "mixer-channel-grid.css", + "mixer-section-controls.css", + "mixer-section-layout.css", + "mixer-hardware-artwork.css", + "mixer-v3-layout-contract.css", + "mixer-chrome-material.css", + "mixer-control-keys.css", + "mixer-fx-rack.css", + "mixer-plugin-browser.css", + "mixer-pan-controls.css", + "mixer-fader-assembly.css", + "mixer-meter-display.css", + "mixer-utility-controls.css", + "inter-embedded.css", + "mixer-wire-dots.css", + "mixer-wire-out-align-v48.css", + "mixer-contextual-buttons.css" + ], + "crossOwners": { + ".bank-arrow||font-size": [ + "mixer-section-controls.css", + "mixer-v3-layout-contract.css" + ], + ".bank-arrow||min-width": [ + "mixer-section-controls.css", + "mixer-v3-layout-contract.css" + ], + ".command-bar .sep||margin": [ + "mixer-chrome-material.css", + "mixer-section-controls.css" + ], + ".command-bar .toolbar-label||display": [ + "mixer-chrome-material.css", + "mixer-section-controls.css" + ], + ".command-bar||background": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".command-bar||border-bottom": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".command-bar||display": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".command-bar||flex": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".command-bar||gap": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css", + "mixer-section-controls.css", + "mixer-section-layout.css" + ], + ".command-bar||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".command-bar||padding": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css", + "mixer-section-controls.css" + ], + ".command-bar||z-index": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".console-body .ari-horizontal::-webkit-slider-thumb||margin-top": [ + "mixer-chrome-material.css", + "mixer-pan-controls.css" + ], + ".console-body .bottom-section||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .eq-line||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .eq-line||border": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label .color-strip||height": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label .name||font-size": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label .name||font-weight": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label||border": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .footer-label||border-radius": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .route-caption||font-size": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-field||align-items": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-field||display": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-field||gap": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-field||grid-template-columns": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-field||min-height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-section||flex": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-section||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-section||padding": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||border": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||color": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||display": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||font-size": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||min-width": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .route-select||padding": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||text-overflow": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||white-space": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-select||width": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-top||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .route-top||min-height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .section||border-bottom": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .section||box-shadow": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .strip.master .footer-label||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .strip.selected||box-shadow": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .strip||background": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .strip||border-right": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .strip||box-shadow": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch-section||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch-section||display": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch-section||flex": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch-section||gap": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch-section||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch-section||padding": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .switch.on.mute||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch.on.mute||color": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch.on.solo||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch.on.solo||color": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch||background": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch||border": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .switch||box-shadow": [ + "mixer-section-layout.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .tracks||grid-template-columns": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body .trim-section||flex": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .trim-section||gap": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body .trim-section||height": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body #master||flex": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body #master||min-width": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body #master||width": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body.collapsed-fx||--fx-h": [ + "mixer-chrome-material.css", + "mixer-v3-layout-contract.css" + ], + ".console-body.plugin-open #viewport||margin-right": [ + "mixer-plugin-browser.css", + "mixer-v3-layout-contract.css" + ], + ".console-body.wire-routing-v15 .strip .wire-tray .wire-node-out||padding": [ + "mixer-wire-dots.css", + "mixer-wire-out-align-v48.css" + ], + ".console-body.wire-routing-v15 .wire-node-out, .console-body.wire-routing-v15 .wire-node-in||min-width": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".console-body.wire-routing-v15 .wire-node-out, .console-body.wire-routing-v15 .wire-node-in||width": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".console-body.wire-routing-v15 .wire-tray||gap": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".console-body.wire-routing-v15.collapsed-send||--send-h": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".console-body.wire-routing-v15[data-density=\"compact\"] .strip .wire-tray .wire-node-out||padding": [ + "mixer-wire-dots.css", + "mixer-wire-out-align-v48.css" + ], + ".console-body||--eq-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--footer-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--fx-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--pan-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--route-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--send-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--switch-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--trim-h": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".console-body||--v13-fader-h": [ + "mixer-chrome-material.css", + "mixer-fx-rack.css" + ], + ".eq-header||height": [ + "mixer-section-controls.css", + "mixer-section-layout.css" + ], + ".eq-header||min-height": [ + "mixer-section-controls.css", + "mixer-section-layout.css" + ], + ".mixer-title .accent||background": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title .right||color": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title .right||margin-left": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||align-items": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||background": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".mixer-title||border-bottom": [ + "mixer-chrome-material.css", + "mixer-section-layout.css" + ], + ".mixer-title||display": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||flex": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||gap": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||height": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".mixer-title||padding": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".status-bar||flex": [ + "mixer-chrome-material.css", + "mixer-section-controls.css" + ], + ".status-bar||height": [ + "mixer-chrome-material.css", + "mixer-section-controls.css" + ], + ".strip||width": [ + "mixer-channel-grid.css", + "mixer-section-controls.css" + ], + ".window-title .file-name||color": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".window-title .study||color": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".window-title||background": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".window-title||border-bottom": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".window-title||flex": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".window-title||height": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + ".wire-master||min-width": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".wire-master||padding": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + ".wire-mode-select||max-width": [ + "mixer-chrome-material.css", + "mixer-wire-dots.css" + ], + "html,body||background": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ], + "html,body||color": [ + "mixer-chrome-material.css", + "mixer-console-foundation.css" + ] + } +} From 65ed621f05c41ba64c16b241fb191bcc497ee493 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:46:54 +0700 Subject: [PATCH 07/64] test(stage-a): exercise approved PNG WebView profiler in Chromium --- tests/approved_gui_perf_stage_a_smoke.py | 84 ++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tests/approved_gui_perf_stage_a_smoke.py diff --git a/tests/approved_gui_perf_stage_a_smoke.py b/tests/approved_gui_perf_stage_a_smoke.py new file mode 100644 index 000000000..ecfc55bc4 --- /dev/null +++ b/tests/approved_gui_perf_stage_a_smoke.py @@ -0,0 +1,84 @@ +"""Stage A: actual assembled /preview/ probe, zero default profiling, A/B activation. + +This is a functional instrumentation test, not synthetic evidence that the +user's Windows mouse stutter has been fixed. +""" +import asyncio +from pathlib import Path +from playwright.async_api import async_playwright + +ROOT = Path(__file__).resolve().parents[1] +PREVIEW = ROOT / "dist-pages/preview/index.html" + + +async def main(): + assert PREVIEW.exists(), "Build the approved /preview/ bundle first" + async with async_playwright() as engine: + browser = await engine.chromium.launch(headless=True) + try: + page = await browser.new_page(viewport={"width": 1366, "height": 768}) + errors = [] + page.on("pageerror", lambda error: errors.append(str(error))) + await page.goto(PREVIEW.as_uri()) + await page.wait_for_selector("#tracks .strip[data-id='1']") + assert await page.evaluate("typeof window.ArSonMixPerf") == "object" + assert await page.evaluate("window.ArSonMixPerf.active") is False + assert await page.evaluate("window.ArSonMixPerf.last") is None + assert await page.locator(".mx-hw-key[data-hw-kind='mute']").count() > 0 + before = await page.locator(".mx-hw-key[data-hw-kind='mute']").first.evaluate( + "node => getComputedStyle(node).backgroundImage" + ) + + # No CSS, DOM controls or demo audio state are modified by profiling. + assert await page.evaluate( + "window.ArSonMixPerf.start({durationMs: 2500, label: 'chromium-test'})" + ) is True + assert await page.evaluate("window.ArSonMixPerf.active") is True + bounds = await page.locator("#tracks .strip[data-id='1']").bounding_box() + assert bounds + for step in range(6): + await page.mouse.move(bounds["x"] + 18, bounds["y"] + 70 + step * 16) + await asyncio.sleep(.03) + await asyncio.sleep(.18) + result = await page.evaluate("window.ArSonMixPerf.stop()") + assert result["schema"] == "arsonmix.gui-perf-stage-a.v1" + assert result["renderer"] == "browser-preview" + assert result["zoneFrames"]["mixer"]["samples"] > 0, result + assert result["pointerMoves"]["mixer"] > 0, result + assert result["handledPointerToRafMs"]["samples"] > 0, result + for label, stats in result["zoneFrames"].items(): + if stats["samples"]: + assert 0 <= stats["medianMs"] <= stats["p95Ms"] <= stats["p99Ms"] <= stats["maxMs"], label + assert isinstance(result["longTaskAvailable"], bool) + if not result["longTaskAvailable"]: + assert result["longTasks"] is None and result["longTaskMs"] is None + assert await page.evaluate("window.ArSonMixPerf.active") is False + assert await page.evaluate("window.ArSonMixPerf.exportJSON()") is not None + after = await page.locator(".mx-hw-key[data-hw-kind='mute']").first.evaluate( + "node => getComputedStyle(node).backgroundImage" + ) + assert before == after, "Profiling must not alter approved buttons" + + # Keyboard on/off works independently of the query-string test mode. + await page.keyboard.press("Control+Alt+Shift+F9") + assert await page.evaluate("window.ArSonMixPerf.active") is True + await page.keyboard.press("Control+Alt+Shift+F9") + assert await page.evaluate("window.ArSonMixPerf.active") is False + + query = await browser.new_page(viewport={"width": 1366, "height": 768}) + query.on("pageerror", lambda error: errors.append(str(error))) + await query.goto(PREVIEW.as_uri() + "?armixperf=1") + await query.wait_for_selector("#tracks .strip[data-id='1']") + assert await query.evaluate("window.ArSonMixPerf.active") is True + await query.evaluate("window.ArSonMixPerf.stop()") + assert not errors, errors + await query.close() + await page.close() + finally: + await browser.close() + print("PASS Stage A: dormant default; assembled approved PNG GUI, opt-in profiling, " + "pointer/rAF evidence, keyboard/URL activation, no fake hardware FPS claim") + + +if __name__ == "__main__": + asyncio.run(main()) From 508874501a5f214375319cb07e161749c29504ad Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:47:15 +0700 Subject: [PATCH 08/64] test(css): lock single approved stylesheet order and reject new cascade overlap --- ...ed_preview_css_owner_nonregression_test.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/approved_preview_css_owner_nonregression_test.py diff --git a/tests/approved_preview_css_owner_nonregression_test.py b/tests/approved_preview_css_owner_nonregression_test.py new file mode 100644 index 000000000..52860e3ca --- /dev/null +++ b/tests/approved_preview_css_owner_nonregression_test.py @@ -0,0 +1,52 @@ +"""Non-regression: approved /preview/ may eliminate, never add cross-owner CSS stacks.""" +import importlib.util +from pathlib import Path +from unittest.mock import patch +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location( + "css_owner", ROOT / "scripts/check_preview_css_ownership.py") +OWNER = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(OWNER) + + +class ApprovedCssOwnership(unittest.TestCase): + def test_approved_png_owner_and_locked_cross_file_stack(self): + result = OWNER.verify() + self.assertEqual(result["stylesheets"], 18) + self.assertEqual(result["crossOwnerBaseline"], 114) + self.assertEqual(result["newCrossOwnerConflicts"], 0) + self.assertTrue(str(OWNER.source_path("mixer-control-keys.css")) + .endswith("site/preview-buttons/assets/mixer-control-keys.css")) + + def test_new_cross_owner_declaration_is_rejected(self): + names, current = OWNER.inspect() + added = dict(current) + added[".new-overlap||filter"] = ["mixer-meter-display.css", + "mixer-chrome-material.css"] + with patch.object(OWNER, "inspect", return_value=(names, added)): + with self.assertRaisesRegex(ValueError, "NEW CROSS-OWNER"): + OWNER.verify() + + def test_new_owner_of_old_overlapping_declaration_is_rejected(self): + names, current = OWNER.inspect() + key = next(iter(current)) + added = dict(current) + added[key] = [*current[key], "mixer-fx-rack.css"] + if "mixer-fx-rack.css" in current[key]: + added[key] = [*current[key], "mixer-meter-display.css"] + with patch.object(OWNER, "inspect", return_value=(names, added)): + with self.assertRaisesRegex(ValueError, "NEW CROSS-OWNER"): + OWNER.verify() + + def test_late_stylesheet_and_inline_css_are_rejected(self): + with self.assertRaisesRegex(ValueError, "inline CSS"): + OWNER.stylesheet_names('') + with self.assertRaisesRegex(ValueError, "Duplicate"): + OWNER.stylesheet_names('' + '') + + +if __name__ == "__main__": + unittest.main() From 0505eea59343ca91b2da402a5d49bbf2737df964 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:47:59 +0700 Subject: [PATCH 09/64] ci(stage-a): gate CSS owner overlap and approved-preview profiler --- .github/workflows/ui-smoke.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 781d8332d..a7215508c 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -125,11 +125,16 @@ jobs: run: node scripts/check_console_puzzle.mjs --release - name: Verify CSS ownership build and offline/WebView2 parity run: python scripts/build_ui_css.py --check + - name: Prevent any NEW CSS stacking across approved /preview/ owners + run: | + python scripts/check_preview_css_ownership.py + python -m unittest discover -s tests -p approved_preview_css_owner_nonregression_test.py -v - name: Verify immutable approved Brushed Metal CSS and non-destructive preview run: python tests/theme_reference_fixture_test.py - name: Validate JavaScript syntax run: | node --check web/app.js + node --check site/preview-v2/assets/gui-perf-probe.js node --check web/plugin-ui.js node --check web/mixer-io.js node --check web/mixer-layout.js @@ -153,6 +158,8 @@ jobs: python -m pip install --upgrade pip python -m pip install playwright python -m playwright install --with-deps chromium + - name: Verify opt-in actual /preview/ GUI profiling, default OFF + run: python tests/approved_gui_perf_stage_a_smoke.py - name: WIRE A main edge and safe graph integration in real Chromium DOM run: python tests/pages_wire_first_canonical_main_smoke.py - name: Verify V49 direct WIRE, gain wheel, connected status, replug and scoped undo From d81fdab3ceac1345cc2ad7c91401df3e2b8cb3ac Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:49:14 +0700 Subject: [PATCH 10/64] docs(stage-a): reproducible Windows capture and CSS anti-stacking gate --- ...APPROVED_GUI_LATENCY_PROFILING_20261105.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md diff --git a/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md b/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md new file mode 100644 index 000000000..88825ece0 --- /dev/null +++ b/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md @@ -0,0 +1,50 @@ +# P0 Stage A — Approved ArSonMix GUI latency measurement (2026-11-05) + +**Issue:** https://github.com/masarray/arsonmix/issues/56 +**Status:** instrumented + CI gate; **affected Windows hardware FAT PENDING**. +**Target:** only the ONE approved /preview/ GUI, including the PNG hardware keys and its exact JUCE WebView2-bundled counterpart. Historical web/app.js performance probes are NOT this product. + +## Exact Windows EXE: reproducible operator test + +1. Record EXE artifact SHA, source commit, Windows/GPU/driver, screen resolution, DPI scaling, monitor refresh rate and audio state. Avoid publishing private device details. +2. Press **Ctrl+Alt+Shift+F9** to start the opt-in 15-second trace; press again to stop early. No visible overlay, profiler rAF, style override or periodic sampling exists while idle; the audio callback never receives instrumentation. +3. Sweep the pointer over blank mixer space, labels, FX controls, PAN, faders, WIRE sockets and top chrome without clicking; repeat 3 times for each hardware/audio condition. +4. Read **GUI_PERF_JS** and independent **GUI_PERF_NATIVE** entries in the existing settings/diagnostics/audio-diagnostics.log. Native results also appear in browser-console messages if DevTools is available. Browser console exposes ArSonMixPerf.last, ArSonMixPerf.exportJSON(), and ArSonMixPerf.download() for controlled export. +5. For Pages testing only, use /preview/?armixperf=1. Do not use /preview-v2/ or a second UI renderer. + +## What the measurements mean + +JS: rAF frame intervals (median/p95/p99/max, % >33.333ms) by pointer region, event-handled-to-next-rAF proxy, optional Long Task API entries, hidden-page transitions and accepted native snapshot JS processing durations. + +JUCE: message-thread timer work mean/max, maximum tick gap, status-read mean/max, snapshot construction/emit mean/max, and count of preexisting extra 1Hz snapshot publications. + +**NOT measured:** actual OS cursor position latency, GPU raster/composition, external-window FPS, full hardware input-to-photon latency, or physical audio dropout. These require affected-PC Windows Performance Analyzer/ETW and/or Edge WebView2/Chromium Performance trace. Unsupported Long Task API results are null (unknown), not zero. + +## Controlled A/B matrix (3 runs per case, same exact EXE SHA) + +| Condition | Target | +| --- | --- | +| Audio disconnected, idle sweep | Basic GUI/hover cost | +| Audio connected, silent | Native control/snapshot cost | +| Audio connected, live channel + MASTER meters | Meter paint/telemetry | +| WIRE expanded, sockets-only sweep | Geometry and interactive drag hints | +| FX rack open, row sweep | Hover compositor and CSS | +| Same assembled /preview/ in standalone Chromium | Browser/native differential (not a substitute for real GPU proof) | +| Optional acceleration A/B with fixed geometry | WebView2/GPU/driver hypothesis only | + +Capture environment, output JSON/log summary and DevTools/ETW trace under Issue #56. Do not claim a fix from headless tests. + +## CSS architecture non-regression + +Approved GUI links **18 source-owned CSS modules**. For the hardware button asset, shipped mixer-control-keys.css comes specifically from site/preview-buttons/assets (not the rejected base skin). Static audit identified **114 cross-owner selector+property conflicts** at baseline, now documented in contracts/approved-preview-css-owner-baseline.json. + +The check in scripts/check_preview_css_ownership.py and negative test gates reject: +- new conflicting selector+property in another module; +- additional owner for an existing conflict; +- new duplicated CSS links, link-order drift or new late inline style blocks. + +Deleting prior duplicated declarations is explicitly allowed. No new emergency CSS override modules are introduced by this milestone. The ownership gate does NOT prove absence of single-file duplicates, semantically equivalent selectors, specificity conflicts or runtime inline styles: retained CSS architecture + computed-style tests remain binding. Stage B/C should remove debt at its actual source owner. + +## Qualification / nonclaims + +Stage A qualification needs exact SHA browser functional smoke, CSS ownership nonregression, approved Pages/native byte parity, native JUCE Windows build/CTest and the physical trace collection process. Hardware FAT is PENDING until tested by the affected Windows user. Preserve original GUI dimensions/materials, native meter truth, one JUCE audio callback, safe First Sound PATCH/ARM/MUTE, accepted ACK+later readback, physical routing, VST3 and WIRE interactions. From 85a0781cbbadaaf4536df81c1a62e9fbc1693b63 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:51:05 +0700 Subject: [PATCH 11/64] perf(stage-a): optional bounded Windows WebView2 CPU/memory evidence collector --- scripts/collect_gui_perf_windows.ps1 | 79 ++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 scripts/collect_gui_perf_windows.ps1 diff --git a/scripts/collect_gui_perf_windows.ps1 b/scripts/collect_gui_perf_windows.ps1 new file mode 100644 index 000000000..4d6a4619c --- /dev/null +++ b/scripts/collect_gui_perf_windows.ps1 @@ -0,0 +1,79 @@ +# Stage A: optional Windows-side process evidence for the affected ArSonMix PC. +# Run alongside the Ctrl+Alt+Shift+F9 JavaScript/JUCE capture. +# No installation, admin access, ETW provider or continuous background service. +[CmdletBinding()] +param( + [ValidateRange(5, 120)][int]$Seconds = 20, + [ValidateRange(250, 2000)][int]$IntervalMs = 500, + [string]$ExePath = "", + [string]$OutputDirectory = "" +) +$ErrorActionPreference = "Stop" +if (-not $OutputDirectory) { + $OutputDirectory = Join-Path (Get-Location) ("gui-perf-" + (Get-Date -Format "yyyyMMdd-HHmmss")) +} +New-Item -ItemType Directory -Path $OutputDirectory -Force | Out-Null +$start = Get-Date +$gpu = @() +try { + $gpu = @(Get-CimInstance Win32_VideoController | Select-Object Name, DriverVersion) +} catch { + Write-Warning "GPU model/driver unavailable without CIM access; continue with process metrics." +} +$sha = $null +if ($ExePath) { + if (-not (Test-Path -LiteralPath $ExePath -PathType Leaf)) { + throw "EXE path was supplied but does not exist." + } + $sha = (Get-FileHash -Algorithm SHA256 -LiteralPath $ExePath).Hash +} +$environment = [ordered]@{ + schema = "arsonmix.windows-gui-process-sampling.v1" + recordedAt = $start.ToString("o") + seconds = $Seconds + intervalMs = $IntervalMs + exeSHA256 = $sha + # No username, hostname or private folder paths are exported. + osVersion = [System.Environment]::OSVersion.VersionString + processors = [System.Environment]::ProcessorCount + gpu = $gpu + limits = "Process CPU/memory only; no GPU raster, pointer input-to-photon, or ETW scheduling evidence" +} +$environment | ConvertTo-Json -Depth 5 | Set-Content -Path (Join-Path $OutputDirectory "environment.json") -Encoding UTF8 +$previous = @{} +$rows = [System.Collections.Generic.List[object]]::new() +$steps = [math]::Ceiling($Seconds * 1000.0 / $IntervalMs) +for ($i = 0; $i -lt $steps; $i++) { + $now = Get-Date + $processes = @(Get-Process -ErrorAction SilentlyContinue | + Where-Object { $_.ProcessName -match "^(ARMixConsole|msedgewebview2)$" }) + foreach ($p in $processes) { + $id = [string]$p.Id + $cpu = [double]$p.CPU + $delta = $null + if ($previous.ContainsKey($id)) { + $old = $previous[$id] + $elapsed = ($now - $old.time).TotalSeconds + if ($elapsed -gt 0 -and $cpu -ge $old.cpu) { + # CPU relative to ONE logical core; values above 100% possible. + $delta = [math]::Round(100.0 * ($cpu - $old.cpu) / $elapsed, 2) + } + } + $previous[$id] = @{cpu = $cpu; time = $now} + $rows.Add([pscustomobject]@{ + timestamp = $now.ToString("o") + elapsedMs = [math]::Round(($now - $start).TotalMilliseconds) + processName = $p.ProcessName + pid = $p.Id + cpuPctOneCore = $delta + workingSetMB = [math]::Round($p.WorkingSet64 / 1MB, 2) + privateMB = [math]::Round($p.PrivateMemorySize64 / 1MB, 2) + handles = $p.HandleCount + }) + } + Start-Sleep -Milliseconds $IntervalMs +} +$out = Join-Path $OutputDirectory "process-timeline.csv" +$rows | Export-Csv -Path $out -NoTypeInformation -Encoding UTF8 +Write-Host "ArSonMix P0 process capture: $($rows.Count) samples -> $out" +Write-Host "Pair with GUI_PERF_JS + GUI_PERF_NATIVE logs and WebView2 GPU trace for Issue #56." From 5b7b2c073c14978ad440bec758828e84df8bb991 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:51:18 +0700 Subject: [PATCH 12/64] docs(stage-a): include optional Windows WebView2 process telemetry --- docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md b/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md index 88825ece0..588d57040 100644 --- a/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md +++ b/docs/P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md @@ -11,6 +11,7 @@ 3. Sweep the pointer over blank mixer space, labels, FX controls, PAN, faders, WIRE sockets and top chrome without clicking; repeat 3 times for each hardware/audio condition. 4. Read **GUI_PERF_JS** and independent **GUI_PERF_NATIVE** entries in the existing settings/diagnostics/audio-diagnostics.log. Native results also appear in browser-console messages if DevTools is available. Browser console exposes ArSonMixPerf.last, ArSonMixPerf.exportJSON(), and ArSonMixPerf.download() for controlled export. 5. For Pages testing only, use /preview/?armixperf=1. Do not use /preview-v2/ or a second UI renderer. +6. Optional concurrent Windows process sampling: run PowerShell scripts/collect_gui_perf_windows.ps1 -Seconds 20 -ExePath from a terminal. It saves local environment.json and process-timeline.csv for ARMixConsole and msedgewebview2. This measures process CPU/memory only; GPU rendering still needs a separate ETW/DevTools trace. ## What the measurements mean From 83ad8fe956e434bd36ea69b9003340d44665675c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:53:23 +0700 Subject: [PATCH 13/64] quality(stage-a): preserve archival approved source HTML exact CSS V28 checksum --- site/preview-v2/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 73c62acbe..7be436edb 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -2886,6 +2886,5 @@ - \ No newline at end of file From f823e4112f7bd6758953b10d31881b78c0ee0920 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:53:40 +0700 Subject: [PATCH 14/64] perf(stage-a): inject dormant profiler via one official Pages/native assembler --- scripts/build_pages.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index e224b7882..e5576fbce 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -48,6 +48,16 @@ revisions[name]=digest match=matches[0] canonical_html=canonical_html[:match.start()]+token+'?rev='+digest+canonical_html[match.end():] +# Add the opt-in, CSS-free performance probe in the ONE canonical assembler. +# Do not rewrite historical source HTML: CSS V28 exact-source checkpoints remain +# valid, and the generated /preview/ plus JUCE WebView2 bundle stay identical. +probe='gui-perf-probe.js' +if not (buttons_dest/'assets'/probe).is_file(): + raise SystemExit('Approved GUI performance probe asset missing') +probe_tag='' +if canonical_html.count('')!=1 or probe_tag in canonical_html: + raise SystemExit('Approved Pages profiler injection must have exactly one body') +canonical_html=canonical_html.replace('',probe_tag+'\n',1) (buttons_dest/'index.html').write_text(canonical_html,encoding='utf-8') (buttons_dest/'build.json').write_text(json.dumps({ 'canonical_url':'/preview/', From 6699950118caa3de96b2067e2e6466f53288b92b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 11:54:15 +0700 Subject: [PATCH 15/64] test(stage-a): enforce only approved profiler injection plus exact PNG GUI parity --- tests/single_preview_publication_contract_test.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index 3603b1d76..74bc13281 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -13,7 +13,7 @@ def require(ok,why): require(build.get('live_audio') is False,'browser must not claim PCM') require('id="console"' not in html and 'preview-buttons/index.html' not in html,'old iframe variant still published') require('console-body' in html and 'mixer-control-keys.css' in html,'not the actual approved console') -# The only DOM change from source is the two content-hashed approved PNG-button links. +# The only compiled DOM changes are two hashed approved PNG links and the dormant profiling script. revisions=build.get('button_css_js_revisions',{}) expected=source for name in ('mixer-control-keys.css','mixer-control-keys.js'): @@ -25,7 +25,16 @@ def require(ok,why): approved=ROOT/'site/preview-buttons/assets'/name target=gui/'assets'/name require(target.read_bytes()==approved.read_bytes(),'wrong PNG-button CSS/JS: '+name) -require(html==expected,'rendered /preview/ DOM differs from exact source + approved PNG-key revision assembly') +# The dormant Stage A profiler is added by that SAME deterministic assembler, +# without modifying the V28 source-HTML checkpoint or creating another UI. +probe='' +require(expected.count('')==1,'approved source has multiple bodies') +expected=expected.replace('',probe+'\n',1) +require(html.count(probe)==1,'profiler missing or duplicated') +require((gui/'assets/gui-perf-probe.js').read_bytes()== + (ROOT/'site/preview-v2/assets/gui-perf-probe.js').read_bytes(), + 'opt-in performance probe was not copied byte-for-byte') +require(html==expected,'rendered /preview/ DOM differs from source + approved buttons + nonvisual profiler') for name in ('mixer-wire-dots.css','knob-ICON.svg'): require((gui/'assets'/name).read_bytes()==(ROOT/'site/preview-v2/assets'/name).read_bytes(),'WIRE source drift: '+name) require((gui/'assets/mute-solo-pfl-56x37.png').read_bytes()==(ROOT/'site/preview-buttons/assets/mute-solo-pfl-56x37.png').read_bytes(),'approved PNG sprite mismatch') From 56675490d9f3326c5aef3f486d352bdf43caa1a8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:11:18 +0700 Subject: [PATCH 16/64] perf(stage-b): collapse duplicate 1Hz status/snapshot into one authoritative 12Hz publication --- src/Main.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index e62604582..90d494f60 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -2627,18 +2627,14 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr pendingPresetUI_ = juce::var(); pendingPresetName_.clear(); } - if (timerTicks_ % 12 == 0) + // A disconnected WebView still needs the 1 Hz safety/health trace. + // Once the browser is ready, reuse the exact status read below: + // no duplicate engine_.status() and NO second 1 Hz GUI snapshot. + if (timerTicks_ % 12 == 0 && !browser_.loaded) { - auto health = engine_.status(); - crackleEvidence_.push (makeEvidenceSample(health)); + const auto health = engine_.status(); + crackleEvidence_.push (makeEvidenceSample (health)); diagnostics_.record ("AUDIO_HEALTH", juce::JSON::toString (health, false)); - if (consoleSubscribed_ && browser_.loaded) - { - // This extra 1 Hz publication is retained in Stage A for A/B evidence. - if (timing) ++guiPerf_.duplicateSnapshots; - browser_.emitEventIfBrowserIsVisible ("arMixConsoleSnapshot", - approvedNativeSnapshot (health)); - } } if (deviceSettingsDirty_) @@ -2691,6 +2687,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr guiPerf_.totalStatusMs += elapsed; guiPerf_.maxStatusMs = std::max(guiPerf_.maxStatusMs, elapsed); } + // Share the 12 Hz control-thread status with the 1 Hz health log. + // Preserve real device/hotplug/First Sound evidence and the async writer. + if (timerTicks_ % 12 == 0) + { + crackleEvidence_.push (makeEvidenceSample (state)); + diagnostics_.record ("AUDIO_HEALTH", juce::JSON::toString (state, false)); + } if(routedEditorOwner_) { // Unplug/reopen may bypass normal GUI actions. Never keep a // vendor editor on an invalid device epoch or removed instance. @@ -2718,12 +2721,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if (startupError_.isNotEmpty() && !bool (state.getProperty ("connected", false))) state.getDynamicObject()->setProperty ("error", startupError_); browser_.emitEventIfBrowserIsVisible ("arMixStatus", state); - // The WebView subscribes BEFORE audio startup. A one-shot G0 snapshot - // can therefore precede JUCE initialise() and leave PATCH CH1 grayed - // out forever. Publish the SAME real engine status at the existing - // 12 Hz control-thread cadence: physical pins, accepted ChannelIds and - // PCM meters update after startup, source patch, ARM and hotplug. - // No additional DSP callback, allocation or work on realtime thread. + // One authoritative 12 Hz console snapshot, NOT a second 1 Hz burst. + // Keep continuous real meters, safe native ACK/readback, PATCH/ARM, + // hot-plug recovery and future subscribed channels observable. + // All work stays on JUCE's message thread; RT PCM remains untouched. if (consoleSubscribed_) { const double snapshotStart = timing ? juce::Time::getMillisecondCounterHiRes() : 0.0; From 9ab0b409186f2efe3166a4d5a450e1ef8239f05d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:12:40 +0700 Subject: [PATCH 17/64] perf(stage-b): cache connected native meter DOM and dirty-update hardware/status UI --- web/approved-native-bridge.js | 55 +++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 3693a2617..212cd2d9f 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -17,21 +17,29 @@ const wireByUiId = new Map(); // view-only EdgeId -> EXACT decimal-string native EdgeId const uiByWireId = new Map(); let lastPaintedSignature = "", lastNativeError = "NATIVE_NOT_SUBSCRIBED"; + // B-stage: attached-node-only meter caches; a structural render invalidates + // them atomically. Never retain detached WebView2 strips or stale channel IDs. + const meterElements = new Map(); let controller = null; const status = message => { lastNativeError = message; const info = document.getElementById("info"); - if (info) info.textContent = message; + if (info && info.textContent !== message) info.textContent = message; }; const stopDemo = () => { // The public Pages demo remains unchanged. In native, DEMO meters and // reference-only physical operations are never passed off as live audio. const demo = document.getElementById("preview"); - if (demo) {demo.disabled = true;demo.title = "Demo meters disabled in native Windows application";} + if (demo) { + if (!demo.disabled) demo.disabled = true; + const title = "Demo meters disabled in native Windows application"; + if (demo.title !== title) demo.title = title; + } scope?.stopDemo?.(); - document.documentElement.dataset.armixNativeAuthority = - flags.productionCallbackLive ? "product-live" : + const authority = flags.productionCallbackLive ? "product-live" : flags.acceptedGraphConnected ? "pcm-accepted" : "not-admitted"; + if (document.documentElement.dataset.armixNativeAuthority !== authority) + document.documentElement.dataset.armixNativeAuthority = authority; }; const nativeIdFor = t => nativeByUiId.get(t?.id) || null; const intent = (operation,t,payload) => { @@ -113,6 +121,7 @@ nativeByUiId.clear();for(const [ui,id] of nextNativeByUi)nativeByUiId.set(ui,id); wireByUiId.clear();for(const [ui,id] of newWireByUi)wireByUiId.set(ui,id); uiByWireId.clear();for(const [id,ui] of newUiByWire)uiByWireId.set(id,ui); + meterElements.clear(); // installGraph() replaces strip HTML and meter nodes scope.installGraph(nextTracks,nextMaster,edges); return true; } @@ -126,8 +135,16 @@ for (const ch of next.graph.channels) { const ui=uiByNativeId.get(ch.id); if (ui===undefined)continue; - const root=document.querySelector('.strip[data-id="'+ui+'"]'); - if (!root)continue; + let elements=meterElements.get(ui); + if (!elements?.root?.isConnected || + elements.root.dataset.id!==String(ui)) { + const root=document.querySelector('.strip[data-id="'+ui+'"]'); + if (!root) {meterElements.delete(ui);continue;} + elements={root, + left:root.querySelector('.meter-fill.left'), + right:root.querySelector('.meter-fill.right')}; + meterElements.set(ui,elements); + } const entry=data[ch.id]; const one=typeof entry==="number"&&Number.isFinite(entry)&&entry>=0?entry:null; const l=typeof entry?.peakL==="number"&&Number.isFinite(entry.peakL)&&entry.peakL>=0? @@ -135,7 +152,7 @@ const right=typeof entry?.peakR==="number"&&Number.isFinite(entry.peakR)&&entry.peakR>=0? entry.peakR:ch.processingFormat==="MONO"?l:null; const paint=(side,peak)=>{ - const fill=root.querySelector('.meter-fill.'+side); + const fill=elements[side]; if(!fill)return; const db=peak===null || peak===0?-90:20*Math.log10(peak); scope.displayMeterDbfs(fill,Math.max(-90,Math.min(6,db)),ts,ui+':'+(side==="left"?"L":"R")); @@ -166,14 +183,16 @@ const deviceOpen=Boolean(d?.backend && d.sampleRate>0 && d.enabledOutputs.length>=2); const label=document.getElementById("transport"); - if(label)label.textContent=!deviceOpen?"Device not ready": + const transport=!deviceOpen?"Device not ready": d.outputArmed?"Output armed":"Output muted"; + if(label && label.textContent!==transport)label.textContent=transport; const warning=document.querySelector?.(".status-bar .warning"); - if(warning)warning.textContent=!deviceOpen?"NO VERIFIED AUDIO DEVICE": + const warningText=!deviceOpen?"NO VERIFIED AUDIO DEVICE": d.outputArmed?(next.admitted?"NATIVE PCM · HARDWARE FAT PENDING": "MAIN ARMED · PCM NOT YET ADMITTED"): legacy()?.routeAccepted?"INPUT PATCHED · OUTPUT MUTED": "NO AUDIBLE OUTPUT · PATCH INPUT + ARM"; + if(warning && warning.textContent!==warningText)warning.textContent=warningText; if(!inputSelect)return; const pins=deviceOpen?d.inputEndpoints.filter(p=> p.active===true && d.enabledInputs.includes(p.port)):[]; @@ -193,19 +212,23 @@ } if(pins.some(p=>String(p.port)===before))inputSelect.value=before; } - inputSelect.disabled=!deviceReady(); - if(routeBtn)routeBtn.disabled=!deviceReady() || - inputSelect.value==="" || pendingSourceId!==0; - if(armBtn)armBtn.disabled=!deviceReady() || - legacy()?.routeAccepted!==true || d.outputArmed; - if(muteBtn)muteBtn.disabled=!deviceOpen || !d.outputArmed; + const ready=deviceReady(); + const selectDisabled=!ready; + if(inputSelect.disabled!==selectDisabled)inputSelect.disabled=selectDisabled; + const routeDisabled=!ready || inputSelect.value==="" || pendingSourceId!==0; + if(routeBtn && routeBtn.disabled!==routeDisabled)routeBtn.disabled=routeDisabled; + const armDisabled=!ready || legacy()?.routeAccepted!==true || d.outputArmed; + if(armBtn && armBtn.disabled!==armDisabled)armBtn.disabled=armDisabled; + const muteDisabled=!deviceOpen || !d.outputArmed; + if(muteBtn && muteBtn.disabled!==muteDisabled)muteBtn.disabled=muteDisabled; if(hardwareNote) { const evidence=protocol.diagnoseFirstSound?.(next,inputSelect.value); // Human-readable PCM stages from the ORIGINAL native callback only. // These values are NOT evidence that the DAC or speaker is audible. - hardwareNote.textContent=evidence? + const note=evidence? evidence.readout+" · "+evidence.nextAction: "No verified hardware PCM readback available."; + if(hardwareNote.textContent!==note)hardwareNote.textContent=note; } } function installFirstSoundMenu() { From 4f4b2c08f7ac5ca9dae9fee872f40ac9b6fed294 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:13:29 +0700 Subject: [PATCH 18/64] perf(stage-b): native-only reversible dirty-write guard for calibrated meter and peak hold --- scripts/build_approved_native_gui.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index e93910d68..0265b2119 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -87,6 +87,31 @@ def accepted_pages_html() -> str: " 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"), + # 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. + # The ORIGINAL Pages model and CSS are untouched; native_html is exactly + # reversible by public_from_native, and no new stylesheet is loaded. + ("const meterPeakHolds=new Map();\n", + "const meterPeakHolds=new Map();\n" + "const nativeMeterPainted=new WeakMap(); // native only, freed with detached fills\n"), + (" const litPx=Math.min(geometry.height,steps*METER_STEP_PX);\n" + " fill.style.setProperty('--lit',(100*litPx/geometry.height)+'%');\n", + " const litPx=Math.min(geometry.height,steps*METER_STEP_PX);\n" + " let painted=nativeMeterPainted.get(fill);\n" + " if(!painted){painted={marker:lane.querySelector('.meter-peak-hold')};nativeMeterPainted.set(fill,painted);}\n" + " const lit=(100*litPx/geometry.height)+'%';\n" + " if(painted.lit!==lit){fill.style.setProperty('--lit',lit);painted.lit=lit;}\n"), + (" const marker=lane.querySelector('.meter-peak-hold');\n" + " if(marker){\n" + " marker.style.opacity=peak.steps>0?'1':'0';\n", + " const marker=painted.marker;\n" + " if(marker){\n" + " const opacity=peak.steps>0?'1':'0';\n" + " if(painted.opacity!==opacity){marker.style.opacity=opacity;painted.opacity=opacity;}\n"), + (" marker.style.setProperty('--peak-extent',extent+'px');\n", + " const peakExtent=extent+'px';\n" + " if(painted.peakExtent!==peakExtent){marker.style.setProperty('--peak-extent',peakExtent);painted.peakExtent=peakExtent;}\n"), # Native WebView2 only: expose the original Pages IIFE model to the thin # bridge. No second renderer/state reducer, no change to public /preview/. ("restorePluginPreferences();init();\n})();", From be7f3835caa4b0bfc0e8f5ff7096d665ae88d88c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:14:08 +0700 Subject: [PATCH 19/64] test(stage-b): exercise native HTML dirty-paint metering with screenshot-safe original Pages --- ...proved_native_meter_dirty_stage_b_smoke.py | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tests/approved_native_meter_dirty_stage_b_smoke.py diff --git a/tests/approved_native_meter_dirty_stage_b_smoke.py b/tests/approved_native_meter_dirty_stage_b_smoke.py new file mode 100644 index 000000000..790771596 --- /dev/null +++ b/tests/approved_native_meter_dirty_stage_b_smoke.py @@ -0,0 +1,79 @@ +"""Stage B: native-only cached meter writes preserve exact public /preview/ source. + +This test exercises the real assembled JUCE HTML in Chromium. It is a JS DOM +regression, NOT physical Windows GPU/input-to-photon certification. +""" +import asyncio +import importlib.util +from pathlib import Path +import tempfile +from playwright.async_api import async_playwright + +ROOT=Path(__file__).resolve().parents[1] +spec=importlib.util.spec_from_file_location("approved_bundle",ROOT/"scripts/build_approved_native_gui.py") +bundle=importlib.util.module_from_spec(spec) +spec.loader.exec_module(bundle) + +async def main(): + with tempfile.TemporaryDirectory(prefix="armix-stage-b-meter-") as folder: + out=Path(folder)/"native" + bundle.stage(out) + public=bundle.accepted_pages_html() + native=(out/"index.html").read_text("utf-8") + assert bundle.public_from_native(native)==public + assert "nativeMeterPainted" not in public + assert "nativeMeterPainted" in native + async with async_playwright() as p: + browser=await p.chromium.launch(headless=True) + try: + page=await browser.new_page(viewport={"width":1366,"height":768}) + errors=[] + page.on("pageerror",lambda e:errors.append(str(e))) + # Host WebView2 is represented only for the native-only JS hook; + # no synthetic native PCM or fake ACK is provided. + await page.add_init_script("""window.__JUCE__={backend:{ + emitEvent(){}, addEventListener(){}}};""") + await page.goto((out/"index.html").as_uri()) + await page.wait_for_function("""()=> + !!window.__ARMIX_NATIVE_SCOPE__ && + !!document.querySelector('#tracks .meter-fill.left')""") + measured=await page.evaluate("""() => { + const scope=window.__ARMIX_NATIVE_SCOPE__; + const fill=document.querySelector('#tracks .meter-fill.left'); + const marker=fill.parentElement.querySelector('.meter-peak-hold'); + const original=CSSStyleDeclaration.prototype.setProperty; + let writes=[]; + CSSStyleDeclaration.prototype.setProperty=function(k,v,...rest) { + if(k==='--lit'||k==='--peak-extent')writes.push([k,String(v)]); + return original.call(this,k,v,...rest); + }; + try{ + const t=performance.now(); + scope.displayMeterDbfs(fill,-30,t,'native-stage-b-test-L'); + scope.displayMeterDbfs(fill,-30,t+70,'native-stage-b-test-L'); + const repeats=writes.slice(); + scope.displayMeterDbfs(fill,-10,t+140,'native-stage-b-test-L'); + const raised=writes.slice(); + // Held peak must still release even with unchanged live level. + scope.displayMeterDbfs(fill,-10,t+1100,'native-stage-b-test-L'); + scope.displayMeterDbfs(fill,-10,t+1350,'native-stage-b-test-L'); + return {repeats,raised,after:writes, + markerOpacity:marker.style.opacity, + litValue:fill.style.getPropertyValue('--lit')}; + } finally {CSSStyleDeclaration.prototype.setProperty=original;} + }""") + first=measured["repeats"] + assert len([w for w in first if w[0]=="--lit"])==1,measured + assert len([w for w in first if w[0]=="--peak-extent"])==1,measured + assert len([w for w in measured["raised"] if w[0]=="--lit"])==2,measured + assert measured["markerOpacity"]=="1",measured + assert measured["litValue"].endswith("%"),measured + assert not errors,errors + await page.close() + finally: + await browser.close() + print("PASS Stage B: native-only meter writes coalesced, real portrait peak held, " + "approved Pages unchanged, native reconstruction byte-identical") + +if __name__=="__main__": + asyncio.run(main()) From 2756edfde439ef27609f0040c89c7466dfb3b6b7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:14:35 +0700 Subject: [PATCH 20/64] ci(stage-b): gate native DOM dirty-meter parity against exact compiled Pages --- .github/workflows/ui-smoke.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index a7215508c..77d6c1d8c 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -160,6 +160,8 @@ jobs: python -m playwright install --with-deps chromium - name: Verify opt-in actual /preview/ GUI profiling, default OFF run: python tests/approved_gui_perf_stage_a_smoke.py + - name: Validate Stage B native meter dirty-write / authoritative Pages parity + run: python tests/approved_native_meter_dirty_stage_b_smoke.py - name: WIRE A main edge and safe graph integration in real Chromium DOM run: python tests/pages_wire_first_canonical_main_smoke.py - name: Verify V49 direct WIRE, gain wheel, connected status, replug and scoped undo From 9290b2caa160eb0f089e4ec5c72290f1a75fe46c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:17:27 +0700 Subject: [PATCH 21/64] test(stage-b): prove 1Hz crackle evidence retained without duplicate native status/snapshot --- tests/p0_diagnostic_contract_test.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/p0_diagnostic_contract_test.mjs b/tests/p0_diagnostic_contract_test.mjs index f44fd5a20..976813788 100644 --- a/tests/p0_diagnostic_contract_test.mjs +++ b/tests/p0_diagnostic_contract_test.mjs @@ -50,7 +50,12 @@ test('P0 crackle marker records a bounded pre-event source-labeled evidence wind assert.match(host,/AUDIO_GLITCH_WINDOW/); assert.match(host,/PRE_MARK_EVIDENCE_5S/); assert.match(host,/RENDER_HARDWARE_XRUN=UNAVAILABLE_THROUGH_JUCE/); - assert.match(host,/crackleEvidence_\.push \(makeEvidenceSample\(health\)\)/); + // Stage B: a connected WebView reuses the native 12 Hz status sample for + // health logging; an unready WebView still records safety evidence at 1 Hz. + assert.match(host,/crackleEvidence_\\.push \\(makeEvidenceSample \\(state\\)\\)/); + assert.match(host,/timerTicks_ % 12 == 0 && !browser_\\.loaded/); + assert.match(host,/crackleEvidence_\\.push \\(makeEvidenceSample \\(health\\)\\)/); + assert.doesNotMatch(host,/approvedNativeSnapshot \\(health\\)/); assert.match(host,/crackleEvidence_\.mark \(makeEvidenceSample\(status\)\)/); assert.match(host,/if \(timerTicks_ % 12 == 0\)/); assert.match(build,/P0PreMarkerFiveSecondEvidenceWindow/); From a4afedb7f6b83d8ca33d9dbf929b448319a7293d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:17:50 +0700 Subject: [PATCH 22/64] test(stage-b): fix exact regex for single 1Hz health and snapshot evidence --- tests/p0_diagnostic_contract_test.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/p0_diagnostic_contract_test.mjs b/tests/p0_diagnostic_contract_test.mjs index 976813788..53aa9db6c 100644 --- a/tests/p0_diagnostic_contract_test.mjs +++ b/tests/p0_diagnostic_contract_test.mjs @@ -50,12 +50,12 @@ test('P0 crackle marker records a bounded pre-event source-labeled evidence wind assert.match(host,/AUDIO_GLITCH_WINDOW/); assert.match(host,/PRE_MARK_EVIDENCE_5S/); assert.match(host,/RENDER_HARDWARE_XRUN=UNAVAILABLE_THROUGH_JUCE/); - // Stage B: a connected WebView reuses the native 12 Hz status sample for - // health logging; an unready WebView still records safety evidence at 1 Hz. - assert.match(host,/crackleEvidence_\\.push \\(makeEvidenceSample \\(state\\)\\)/); - assert.match(host,/timerTicks_ % 12 == 0 && !browser_\\.loaded/); - assert.match(host,/crackleEvidence_\\.push \\(makeEvidenceSample \\(health\\)\\)/); - assert.doesNotMatch(host,/approvedNativeSnapshot \\(health\\)/); + // Stage B: connected WebView reuses the 12 Hz status sample for + // health logging; an unready WebView still retains safety evidence at 1 Hz. + assert.match(host,/crackleEvidence_\.push \(makeEvidenceSample \(state\)\)/); + assert.match(host,/timerTicks_ % 12 == 0 && !browser_\.loaded/); + assert.match(host,/crackleEvidence_\.push \(makeEvidenceSample \(health\)\)/); + assert.doesNotMatch(host,/approvedNativeSnapshot \(health\)/); assert.match(host,/crackleEvidence_\.mark \(makeEvidenceSample\(status\)\)/); assert.match(host,/if \(timerTicks_ % 12 == 0\)/); assert.match(build,/P0PreMarkerFiveSecondEvidenceWindow/); From 871c838e48dca6383268fb6769688177c6113a17 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:18:28 +0700 Subject: [PATCH 23/64] quality(stage-b): prohibit growing same-file CSS selector/property stacking --- scripts/check_preview_css_ownership.py | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/scripts/check_preview_css_ownership.py b/scripts/check_preview_css_ownership.py index c297c2ceb..4b47f85f8 100644 --- a/scripts/check_preview_css_ownership.py +++ b/scripts/check_preview_css_ownership.py @@ -63,6 +63,31 @@ def inspect() -> tuple[list[str], dict[str, list[str]]]: return names, dict(sorted(overlap.items())) +def count_same_file_repeated_declarations(names: list[str]) -> dict[str, int]: + """Conservative same-file stacking counter; CSS context still needs QA. + + An identical normalized selector + property repeated later in the same + owner is debt even if the current cascade intentionally uses it. New debt + is not permitted, but removing existing duplicate declarations is. + """ + totals: dict[str, int] = {} + for name in names: + css = COMMENT.sub("", source_path(name).read_text(encoding="utf-8")) + seen: set[str] = set() + repeated = 0 + for match in LEAF.finditer(css): + selector = " ".join(match.group(1).split()) + if not selector or selector.startswith("@"): + continue + for prop in PROP.finditer(match.group(2)): + key = selector + "||" + prop.group(1) + if key in seen: + repeated += 1 + seen.add(key) + totals[name] = repeated + return totals + + def verify() -> dict: baseline = json.loads(BASELINE.read_text(encoding="utf-8")) names, conflicts = inspect() @@ -76,12 +101,27 @@ def verify() -> dict: if newly_stacked: sample = list(newly_stacked.items())[:8] raise ValueError("NEW CROSS-OWNER CSS STACKING FORBIDDEN: " + repr(sample)) + # Stage B: forbid growing same-owner selector/property layering too. + # V28 historical source byte checks remain valid; no stylesheet changed. + same_file = count_same_file_repeated_declarations(names) + caps = baseline["sameFileRepeatedDeclarationCaps"] + if set(caps) != set(names): + raise ValueError("Missing/stale same-file CSS ownership baseline") + new_stacking = { + name: (count, caps[name]) + for name, count in same_file.items() if count > caps[name] + } + if new_stacking: + raise ValueError("NEW SAME-OWNER CSS STACKING FORBIDDEN: " + repr(new_stacking)) return { "stylesheets": len(names), "crossOwnerBaseline": len(allowed), "crossOwnerCurrent": len(conflicts), "eliminated": len(allowed) - len(conflicts), "newCrossOwnerConflicts": 0, + "sameOwnerRepeatedBaseline": sum(caps.values()), + "sameOwnerRepeatedCurrent": sum(same_file.values()), + "newSameOwnerStacking": 0, } From dabf90486ddf6f38ce80700f754d43facfa617a2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:18:43 +0700 Subject: [PATCH 24/64] quality(stage-b): baseline 252 same-owner CSS repeats without adding styles --- .../approved-preview-css-owner-baseline.json | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/contracts/approved-preview-css-owner-baseline.json b/contracts/approved-preview-css-owner-baseline.json index 36e7cbf66..acea44301 100644 --- a/contracts/approved-preview-css-owner-baseline.json +++ b/contracts/approved-preview-css-owner-baseline.json @@ -1,5 +1,5 @@ { - "schema": "arsonmix.approved-css-cross-owner-baseline.v1", + "schema": "arsonmix.approved-css-owner-debt-baseline.v2", "sourceMainHead": "e477b3ebb8b2a1ab71fd7226b3f03a81868b70ab", "linkedStylesheets": [ "mixer-console-foundation.css", @@ -481,5 +481,25 @@ "mixer-chrome-material.css", "mixer-console-foundation.css" ] + }, + "sameFileRepeatedDeclarationCaps": { + "mixer-console-foundation.css": 4, + "mixer-channel-grid.css": 0, + "mixer-section-controls.css": 4, + "mixer-section-layout.css": 14, + "mixer-hardware-artwork.css": 0, + "mixer-v3-layout-contract.css": 0, + "mixer-chrome-material.css": 36, + "mixer-control-keys.css": 1, + "mixer-fx-rack.css": 8, + "mixer-plugin-browser.css": 13, + "mixer-pan-controls.css": 18, + "mixer-fader-assembly.css": 99, + "mixer-meter-display.css": 18, + "mixer-utility-controls.css": 1, + "inter-embedded.css": 0, + "mixer-wire-dots.css": 36, + "mixer-wire-out-align-v48.css": 0, + "mixer-contextual-buttons.css": 0 } } From b82f0af6cc09cecc5836b1c5874d8474ededd90f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:19:05 +0700 Subject: [PATCH 25/64] test(stage-b): negative CSS single-file stacking and allowed debt removal --- ...ed_preview_css_owner_nonregression_test.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/approved_preview_css_owner_nonregression_test.py b/tests/approved_preview_css_owner_nonregression_test.py index 52860e3ca..c27dcd856 100644 --- a/tests/approved_preview_css_owner_nonregression_test.py +++ b/tests/approved_preview_css_owner_nonregression_test.py @@ -1,4 +1,4 @@ -"""Non-regression: approved /preview/ may eliminate, never add cross-owner CSS stacks.""" +"""Non-regression: approved /preview/ may eliminate, never add cross-file or same-file CSS stacks.""" import importlib.util from pathlib import Path from unittest.mock import patch @@ -17,6 +17,9 @@ def test_approved_png_owner_and_locked_cross_file_stack(self): self.assertEqual(result["stylesheets"], 18) self.assertEqual(result["crossOwnerBaseline"], 114) self.assertEqual(result["newCrossOwnerConflicts"], 0) + self.assertEqual(result["sameOwnerRepeatedBaseline"], 252) + self.assertEqual(result["sameOwnerRepeatedCurrent"], 252) + self.assertEqual(result["newSameOwnerStacking"], 0) self.assertTrue(str(OWNER.source_path("mixer-control-keys.css")) .endswith("site/preview-buttons/assets/mixer-control-keys.css")) @@ -40,6 +43,27 @@ def test_new_owner_of_old_overlapping_declaration_is_rejected(self): with self.assertRaisesRegex(ValueError, "NEW CROSS-OWNER"): OWNER.verify() + def test_new_same_file_stack_is_rejected_without_visual_patch(self): + names, _ = OWNER.inspect() + present = OWNER.count_same_file_repeated_declarations(names) + invented = dict(present) + invented["mixer-fader-assembly.css"] += 1 + with patch.object(OWNER, "count_same_file_repeated_declarations", + return_value=invented): + with self.assertRaisesRegex(ValueError, "NEW SAME-OWNER"): + OWNER.verify() + + def test_deleting_existing_same_file_duplicates_is_allowed(self): + names, _ = OWNER.inspect() + present = OWNER.count_same_file_repeated_declarations(names) + reduced = dict(present) + reduced["mixer-fader-assembly.css"] -= 1 + with patch.object(OWNER, "count_same_file_repeated_declarations", + return_value=reduced): + result = OWNER.verify() + self.assertEqual(result["newSameOwnerStacking"], 0) + self.assertEqual(result["sameOwnerRepeatedCurrent"], 251) + def test_late_stylesheet_and_inline_css_are_rejected(self): with self.assertRaisesRegex(ValueError, "inline CSS"): OWNER.stylesheet_names('') From 34edd69f1618d30a85ed6fad4be34c30c364c2cf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:20:14 +0700 Subject: [PATCH 26/64] perf(stage-b): cache WIRE idle hover geometry, refresh 120ms or layout invalidation --- scripts/build_approved_native_gui.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py index 0265b2119..0aa79f524 100644 --- a/scripts/build_approved_native_gui.py +++ b/scripts/build_approved_native_gui.py @@ -112,6 +112,23 @@ def accepted_pages_html() -> str: (" marker.style.setProperty('--peak-extent',extent+'px');\n", " const peakExtent=extent+'px';\n" " if(painted.peakExtent!==peakExtent){marker.style.setProperty('--peak-extent',peakExtent);painted.peakExtent=peakExtent;}\n"), + # Stage B: WIRE idle pointer proximity still works, but avoid forcing a + # synchronous layout read for *every mousemove* while a 12 Hz snapshot + # updates native meters. Bound geometry age and invalidate on scroll/resize. + ("let nearWireOut=null;\n", + "let nearWireOut=null;\n" + "let nativeWireBounds=new WeakMap();\n" + "window.addEventListener('resize',()=>{nativeWireBounds=new WeakMap();},{passive:true});\n" + "window.addEventListener('scroll',()=>{nativeWireBounds=new WeakMap();},true);\n"), + (" let out=tray?.querySelector('.wire-node-out:not(:disabled)')||null;\n" + " if(out){\n" + " const r=out.getBoundingClientRect();\n", + " let out=tray?.querySelector('.wire-node-out:not(:disabled)')||null;\n" + " if(out){\n" + " const now=performance.now();\n" + " let box=nativeWireBounds.get(out);\n" + " if(!box||now-box.at>=120){box={at:now,rect:out.getBoundingClientRect()};nativeWireBounds.set(out,box);}\n" + " const r=box.rect;\n"), # Native WebView2 only: expose the original Pages IIFE model to the thin # bridge. No second renderer/state reducer, no change to public /preview/. ("restorePluginPreferences();init();\n})();", From 70632d17863d39c363fff039f74e247d727aaf01 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 12:22:37 +0700 Subject: [PATCH 27/64] test+docs(stage-b): native meter/WIRE proof, PNG parity and CSS debt disclosure --- ...PROVED_GUI_RUNTIME_PERFORMANCE_20261105.md | 19 +++++++++++ tests/approved_native_gui_bundle_test.py | 6 ++++ ...proved_native_meter_dirty_stage_b_smoke.py | 32 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 docs/P0_STAGE_B_APPROVED_GUI_RUNTIME_PERFORMANCE_20261105.md diff --git a/docs/P0_STAGE_B_APPROVED_GUI_RUNTIME_PERFORMANCE_20261105.md b/docs/P0_STAGE_B_APPROVED_GUI_RUNTIME_PERFORMANCE_20261105.md new file mode 100644 index 000000000..6679576e9 --- /dev/null +++ b/docs/P0_STAGE_B_APPROVED_GUI_RUNTIME_PERFORMANCE_20261105.md @@ -0,0 +1,19 @@ +# P0 Stage B — runtime hot-path simplification (2026-11-05) + +**Parent:** [PR #414](https://github.com/masarray/arsonmix/pull/414) — one integrated single-owner PR; [Issue #56](https://github.com/masarray/arsonmix/issues/56) remains open pending physical Windows benchmarks. + +## Actual changes — approved native GUI, not historical standalone + +1. **Native message thread:** remove the EXTRA 1 Hz accepted snapshot and EXTRA 1 Hz engine.status() read when the WebView is live. Keep precisely one authoritative 12 Hz native readback stream and continuous meter telemetry. Connected 1 Hz AUDIO_HEALTH uses that tick's pre-existing status; an unready browser still logs independent 1 Hz safety evidence. Preserve hotplug, PATCH, ARM, ACK, proper rejected/stale readback, native VST3 and audio callback isolation. +2. **Native bridge:** cache attached strip meter-fill nodes by accepted local ChannelId. Clear on every structural installGraph(), re-read nodes if detached/changed. Dirty-write transport text, warning, menu actions, hardware details, state label and demo-state attributes only when values differ. +3. **Native meter:** a WeakMap remembers the last actual --lit and --peak-extent CSS values and peak opacity for each live DOM meter. The V51 LED step/gradient mapping, native measured PCM and 850ms held marker with timed release continue computing; identical values no longer mutate style. Resizing re-evaluates actual meter geometry. No animations or CSS override. +4. **Native WIRE pointer:** proximity checks reuse a bounded 120ms socket rectangle while the pointer moves within the same tray, invalidated on resize and scroll. Native WIRE gesture/ACK and the original public Pages source remain unchanged. The test verifies one geometric query for a burst, another after resize. +5. **CSS ownership quality:** 18 original approved source-owned stylesheets remain byte-identical; no extra CSS layer. Stage A had 114 existing cross-owner overlaps; Stage B additionally locks **252 pre-existing same-file selector+property repeats**, rejecting any numerical growth while allowing removals. These are baseline **technical debt**, NOT a claim of zero existing duplication. CSS source modernization must be independent, visual-parity-tested, and never rebase immutable historical V28 evidence blindly. + +## Qualification and limitations + +CI: source CSS no-new-stacking checks + negative tests; deterministic Pages/native bundle parity; exact CSS V28 checkpoints and full Chromium visual controls; native Chromium meter/WIRE dirty-write functional smoke; Windows JUCE compile/CTest, built executable and real hardware FAT when available. + +**Expected mechanical improvement** from the 1Hz dedup: remove one redundant engine status read and full snapshot construction+bridge event per second while subscribed (~1 out of the previous 13/s). Actual CPU, GPU/compositor p95/p99, external-window pointer feel and PCM glitch rates require affected-PC evidence in [Stage A profiling instructions](P0_STAGE_A_APPROVED_GUI_LATENCY_PROFILING_20261105.md). No claimed mouse stutter fix without profiling and FAT. + +No second mixer, no JS PCM, no auto-arm, no output rerouting, no fader/portrait meter visual redesign, and no changes in the realtime callback. diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index 58e439a32..46746456a 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -28,6 +28,12 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) # no visual duplication; it must be stripped in public_from_native. self.assertIn("window.__ARMIX_NATIVE_SCOPE__=Object.freeze({", native) self.assertNotIn("__ARMIX_NATIVE_SCOPE__", approved) + self.assertIn("nativeMeterPainted", native) + self.assertNotIn("nativeMeterPainted", approved) + self.assertIn("nativeWireBounds", native) + self.assertNotIn("nativeWireBounds", approved) + # No new CSS override or second mixer: native HTML differs only + # through exactly reversible data/events/DOM-write optimizations. self.assertIn("make,render,findTrack,displayMeterDbfs", native) self.assertIn("installGraph(channels,main,edges)", native) self.assertIn("if(window.__JUCE__?.backend)return true;", native) diff --git a/tests/approved_native_meter_dirty_stage_b_smoke.py b/tests/approved_native_meter_dirty_stage_b_smoke.py index 790771596..6a5618151 100644 --- a/tests/approved_native_meter_dirty_stage_b_smoke.py +++ b/tests/approved_native_meter_dirty_stage_b_smoke.py @@ -68,6 +68,38 @@ async def main(): assert len([w for w in measured["raised"] if w[0]=="--lit"])==2,measured assert measured["markerOpacity"]=="1",measured assert measured["litValue"].endswith("%"),measured + # Native-only WIRE proximity never synchronously queries a + # socket box on each high-rate idle pointermove. + wire=await page.evaluate("""() => { + const tray=document.querySelector('.console-body .wire-tray'); + const out=tray?.querySelector('.wire-node-out'); + if(!out)return {missing:true}; + const disabled=out.disabled; + out.disabled=false; + const original=Element.prototype.getBoundingClientRect; + const bounds=original.call(out); + let reads=0; + Element.prototype.getBoundingClientRect=function(){ + if(this===out)reads++; + return original.call(this); + }; + const ev=()=>new PointerEvent('pointermove',{ + bubbles:true,pointerType:'mouse',buttons:0, + clientX:bounds.left+bounds.width/2, + clientY:bounds.top+bounds.height/2 + }); + try { + for(let i=0;i<12;i++)tray.dispatchEvent(ev()); + const burst=reads; + window.dispatchEvent(new Event('resize')); + tray.dispatchEvent(ev()); + return {burst,afterResize:reads}; + } finally { + Element.prototype.getBoundingClientRect=original; + out.disabled=disabled; + } + }""") + assert wire=={"burst":1,"afterResize":2},wire assert not errors,errors await page.close() finally: From 29159dcf747e42a4e006e1bd3659e1ebbc68294c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:15:57 +0700 Subject: [PATCH 28/64] perf(stage-c): compile approved CSS without redundant same-cascade declarations or override layers --- scripts/compile_approved_css.py | 224 ++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 scripts/compile_approved_css.py diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py new file mode 100644 index 000000000..a56ec79da --- /dev/null +++ b/scripts/compile_approved_css.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python3 +"""Stage C: deterministic, source-preserving CSS cascade pruning for APPROVED /preview/. + +Keep the historical CSS authoring and V28 exact-source restoration intact. +Only the copied Pages/WebView2 assets are optimized. Never add an override +stylesheet, rewrite selectors, change stylesheet order or move asset URLs. + +This intentionally removes only provably shadowed *same selector, same +property, same priority origin, same at-rule context* declarations. Identical +selectors in distinct @media/@supports/@container scopes are not collapsed. +Unrecognized/nested rule syntax and @font-face/@keyframes are preserved. +""" +from __future__ import annotations + +from collections import defaultdict +from dataclasses import dataclass +import hashlib +from pathlib import Path +import re + +LINK = re.compile(r'( b[0] for a, b in zip(spans, spans[1:])): + raise ValueError("CSS optimization spans overlap: " + filename) + for a, b in reversed(spans): + css = css[:a] + css[b:] + compiled[filename] = css + stats = { + "sourceDeclarations": len(entries), + "candidateRedundantDeclarations": potential, + "removedDeclarations": sum(map(len, removals.values())), + "removedCrossFileDeclarations": across, + "lockedCandidateDeclarations": locked, + "sourceStylesheetCount": len(stylesheets), + "generatedStylesheetCount": len(compiled), + "addedOverrideStylesheets": 0, + } + if stats["removedDeclarations"] + locked != potential: + raise ValueError("CSS loser accounting does not balance") + return compiled, stats + + +def optimize_assets(html: str, assets: Path): + """Change only copied CSS asset bytes and add content-addressing to URLs.""" + names = [match.group(2) for match in LINK.finditer(html)] + if not names or len(set(names)) != len(names): + raise ValueError("Approved preview has duplicate/missing CSS links") + files = [(name, (assets / name).read_text(encoding="utf-8")) for name in names] + optimized, stats = optimize_css(files) + revisions = {} + for name, old in files: + new = optimized[name] + if name in LOCKED_ASSETS and new != old: + raise ValueError("Locked native/PNG CSS must remain byte identical") + if name not in LOCKED_ASSETS: + (assets / name).write_text(new, encoding="utf-8", newline="") + revisions[name] = hashlib.sha256(new.encode("utf-8")).hexdigest()[:16] + + def link(match): + prefix, name, query, trailing = match.groups() + # Stable existing CSS ownership/cache keys stay intact. One additional + # deterministic hash makes the ACTUAL compiled CSS cache-safe. + base = query or "" + if "armixc=" in base: + raise ValueError("Stage C URL compiled twice") + delim = "&" if base else "?" + return prefix + name + base + delim + "armixc=" + revisions[name] + trailing + + rendered = LINK.sub(link, html) + stats["shaByCssOwner"] = revisions + return rendered, stats From 4696a2468525e76ef7b9fbc5ec801dc76b34e408 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:16:53 +0700 Subject: [PATCH 29/64] perf(stage-c): use source-safe CSS optimizer for one published Pages/native asset bundle --- scripts/build_pages.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index e5576fbce..64901dd6d 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -1,6 +1,7 @@ """Build public Pages landing and interactive console from canonical standalone HTML.""" from pathlib import Path import argparse,os,json,shutil,subprocess,sys +from compile_approved_css import optimize_assets ROOT=Path(__file__).resolve().parents[1] p=argparse.ArgumentParser() p.add_argument('--out',default='dist-pages') @@ -57,7 +58,12 @@ probe_tag='' if canonical_html.count('')!=1 or probe_tag in canonical_html: raise SystemExit('Approved Pages profiler injection must have exactly one body') -canonical_html=canonical_html.replace('',probe_tag+'\n',1) +canonical_html=canonical_html.replace('',probe_tag+'\\n',1) +# Stage C: compile only DEPLOYED copies, never modify locked V28 source +# owners or approved PNG artwork. No new CSS/override or second renderer. +canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets') +if css_compilation['removedDeclarations']<1: + raise SystemExit('CSS Stage C produced no obsolete-declaration removals') (buttons_dest/'index.html').write_text(canonical_html,encoding='utf-8') (buttons_dest/'build.json').write_text(json.dumps({ 'canonical_url':'/preview/', @@ -66,7 +72,8 @@ 'wire_source':'site/preview-v2/index.html', 'wire_source_sha256':hashlib.sha256((canonical/'index.html').read_bytes()).hexdigest(), 'button_asset_source':'site/preview-buttons/assets/', - 'button_css_js_revisions':revisions + 'button_css_js_revisions':revisions, + 'css_compilation':css_compilation },indent=2),encoding='utf-8') # Fail closed if routing has no identical source files in the variant. for name in ('mixer-wire-dots.css','knob-ICON.svg'): From e1df3e16a322a5e7ab8b818da2a03a46d7653e91 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:17:20 +0700 Subject: [PATCH 30/64] fix(stage-c): preserve original exact newline of approved profiler injection --- scripts/build_pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index 64901dd6d..11791549f 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -58,7 +58,7 @@ probe_tag='' if canonical_html.count('')!=1 or probe_tag in canonical_html: raise SystemExit('Approved Pages profiler injection must have exactly one body') -canonical_html=canonical_html.replace('',probe_tag+'\\n',1) +canonical_html=canonical_html.replace('',probe_tag+'\n',1) # Stage C: compile only DEPLOYED copies, never modify locked V28 source # owners or approved PNG artwork. No new CSS/override or second renderer. canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets') From 564b35f10704fa5ac81ff84a14d70a58b6a9859b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:18:01 +0700 Subject: [PATCH 31/64] test(stage-c): verify every compiled CSS owner byte, link hash and source-derived cascade winners --- ...ingle_preview_publication_contract_test.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index 74bc13281..530e21bb9 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -1,6 +1,7 @@ """Fail closed: GitHub Pages must expose ONE approved ArSonMix GUI at /preview/.""" from pathlib import Path import json, re, sys, hashlib +from scripts.compile_approved_css import LINK, optimize_css ROOT=Path(__file__).resolve().parents[1] DST=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else ROOT/'dist-pages' gui=DST/'preview' @@ -34,6 +35,35 @@ def require(ok,why): require((gui/'assets/gui-perf-probe.js').read_bytes()== (ROOT/'site/preview-v2/assets/gui-perf-probe.js').read_bytes(), 'opt-in performance probe was not copied byte-for-byte') +# Stage C: the source HTML remains byte-exact, but the 18 deployed CSS files +# contain only proven cascade winners. Verify every *generated* byte and query +# hash; never approve an extra stylesheet, different owner or PNG mutation. +linked=[match.group(2) for match in LINK.finditer(expected)] +require(len(linked)==18 and len(set(linked))==18,'approved CSS owners changed') +source_css=[(name,(ROOT / ("site/preview-buttons/assets" + if name=="mixer-control-keys.css" + else "site/preview-v2/assets") / name) + .read_text(encoding="utf-8")) for name in linked] +compiled,counts=optimize_css(source_css) +record=build.get('css_compilation') or {} +require(counts['removedDeclarations']>0,'Stage C did not reduce actual runtime CSS') +for stat in ('sourceDeclarations','removedDeclarations', + 'removedCrossFileDeclarations','lockedCandidateDeclarations'): + require(record.get(stat)==counts[stat],'CSS compiler accounting mismatch: '+stat) +require(record.get('sourceStylesheetCount')==18 and + record.get('generatedStylesheetCount')==18 and + record.get('addedOverrideStylesheets')==0,'CSS compiler created an override') +for name in linked: + data=(gui/'assets'/name).read_bytes() + require(data==compiled[name].encode('utf-8'), + 'Runtime CSS differs from source-derived winning declarations: '+name) + digest=hashlib.sha256(data).hexdigest()[:16] + require(record.get('shaByCssOwner',{}).get(name)==digest, + 'Runtime CSS digest mismatch: '+name) +def css_rewrite(match): + prefix,name,query,end=match.groups() + return prefix+name+(query or '')+('&' if query else '?')+'armixc='+record['shaByCssOwner'][name]+end +expected=LINK.sub(css_rewrite,expected) require(html==expected,'rendered /preview/ DOM differs from source + approved buttons + nonvisual profiler') for name in ('mixer-wire-dots.css','knob-ICON.svg'): require((gui/'assets'/name).read_bytes()==(ROOT/'site/preview-v2/assets'/name).read_bytes(),'WIRE source drift: '+name) From 3f449e4865455b0a80b00cb71054fe27516db34b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:18:22 +0700 Subject: [PATCH 32/64] test(stage-c): resolve compiler import in direct Python CI invocation --- tests/single_preview_publication_contract_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index 530e21bb9..88baaaefd 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -1,7 +1,8 @@ """Fail closed: GitHub Pages must expose ONE approved ArSonMix GUI at /preview/.""" from pathlib import Path import json, re, sys, hashlib -from scripts.compile_approved_css import LINK, optimize_css +sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts')) +from compile_approved_css import LINK, optimize_css ROOT=Path(__file__).resolve().parents[1] DST=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else ROOT/'dist-pages' gui=DST/'preview' From 3d8cb1529b0075557c0442af13efb1be52d14489 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:19:04 +0700 Subject: [PATCH 33/64] test(stage-c): prove cascade priority, conditional safety, keyframes and byte-exact PNG/WIRE owners --- tests/approved_css_stage_c_compiler_test.py | 108 ++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 tests/approved_css_stage_c_compiler_test.py diff --git a/tests/approved_css_stage_c_compiler_test.py b/tests/approved_css_stage_c_compiler_test.py new file mode 100644 index 000000000..037330e93 --- /dev/null +++ b/tests/approved_css_stage_c_compiler_test.py @@ -0,0 +1,108 @@ +"""P0 Stage C: deterministic CSS cascade loser removal and immutable source assets.""" +from pathlib import Path +import importlib.util +import hashlib +import tempfile +import unittest + +ROOT=Path(__file__).resolve().parents[1] +spec=importlib.util.spec_from_file_location( + "css_compiler", ROOT/"scripts/compile_approved_css.py") +css=importlib.util.module_from_spec(spec) +# dataclasses needs module to exist in sys.modules when constructing classes. +import sys +sys.modules[spec.name]=css +spec.loader.exec_module(css) + + +class StageCCssCompiler(unittest.TestCase): + def test_same_selector_same_property_keeps_only_cascade_winner(self): + originals=[ + ("a.css", ".strip{color:#111; margin:2px; background:#000;}\n"), + ("b.css", ".strip { color:#222; }\n.strip{color:#333;}\n") + ] + compiled, data=css.optimize_css(originals) + self.assertNotIn("color:#111",compiled["a.css"]) + self.assertIn("margin:2px",compiled["a.css"]) + self.assertNotIn("color:#222",compiled["b.css"]) + self.assertIn("color:#333",compiled["b.css"]) + self.assertEqual(data["removedDeclarations"],2) + self.assertEqual(data["removedCrossFileDeclarations"],1) + self.assertEqual(data["addedOverrideStylesheets"],0) + + def test_important_wins_even_if_ordinary_is_later(self): + compiled,stats=css.optimize_css([ + ("a.css", ".strip{color:red!important;color:orange}\n"), + ("b.css", ".strip{color:blue}\n"), + ]) + self.assertIn("color:red!important",compiled["a.css"]) + self.assertNotIn("color:orange",compiled["a.css"]) + self.assertNotIn("color:blue",compiled["b.css"]) + self.assertEqual(stats["removedDeclarations"],2) + + def test_media_and_supports_conditions_never_confused(self): + compiled,stats=css.optimize_css([ + ("a.css", ".meter{color:red}@media(max-width:700px){.meter{color:orange}}"), + ("b.css", "@media(min-width:701px){.meter{color:blue}}" + "@media(max-width:700px){.meter{color:green}}" + "@supports (display:grid){.meter{color:cyan}}") + ]) + self.assertIn("color:red",compiled["a.css"]) + self.assertNotIn("color:orange",compiled["a.css"]) + self.assertIn("color:green",compiled["b.css"]) + self.assertIn("color:blue",compiled["b.css"]) + self.assertIn("color:cyan",compiled["b.css"]) + self.assertEqual(stats["removedDeclarations"],1) + + def test_preserves_comments_semicolon_in_strings_font_face_and_keyframes(self): + source=('/* A { } */\n' + '@font-face{src:url("data:font/woff2;base64,AB;{CD}");font-weight:300}\n' + '@keyframes blink{0%{opacity:0}100%{opacity:1}}\n' + '.strip{content:"text; {bar}";opacity:0.4;opacity:0.7}\n') + optimized,stats=css.optimize_css([("a.css",source)]) + self.assertEqual(stats["removedDeclarations"],1) + self.assertIn('data:font/woff2;base64,AB;{CD}',optimized["a.css"]) + self.assertIn("@keyframes blink",optimized["a.css"]) + self.assertIn('content:"text; {bar}"',optimized["a.css"]) + self.assertIn("opacity:0.7",optimized["a.css"]) + self.assertNotIn("opacity:0.4",optimized["a.css"]) + + def test_png_buttons_and_wire_css_are_literal_bytes(self): + css_assets=[ + ("a.css",".mx-hw-key{background:#aaa}"), + ("mixer-control-keys.css",".mx-hw-key{background:#bbb}"), + ("mixer-wire-dots.css",".wire-node{color:red}"), + ("c.css",".wire-node{color:blue}") + ] + compiled,stats=css.optimize_css(css_assets) + self.assertEqual(compiled["mixer-control-keys.css"],css_assets[1][1]) + self.assertEqual(compiled["mixer-wire-dots.css"],css_assets[2][1]) + self.assertIn("color:red",compiled["mixer-wire-dots.css"]) + self.assertIn("color:blue",compiled["c.css"]) + self.assertEqual(stats["lockedCandidateDeclarations"],1) + self.assertEqual(stats["removedDeclarations"],1) + + def test_idempotent_and_no_new_link_or_authority(self): + with tempfile.TemporaryDirectory() as root: + assets=Path(root) + (assets/"a.css").write_text(".x{width:1px;width:2px}\n",encoding="utf-8") + (assets/"b.css").write_text(".x{width:3px}\n",encoding="utf-8") + markup=('' + '') + compiled,stats=css.optimize_assets(markup,assets) + self.assertEqual(stats["sourceStylesheetCount"],2) + self.assertEqual(compiled.count("armixc="),2) + self.assertEqual(compiled.count(' Date: Thu, 5 Nov 2026 13:20:12 +0700 Subject: [PATCH 34/64] ci(stage-c): enforce compiler safety and true baseline-vs-compiled Chromium visual parity --- .github/workflows/ui-smoke.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 77d6c1d8c..9dfaef7fd 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -125,6 +125,8 @@ jobs: run: node scripts/check_console_puzzle.mjs --release - name: Verify CSS ownership build and offline/WebView2 parity run: python scripts/build_ui_css.py --check + - name: Stage C deterministic CSS compiler priority and safety regression + run: python -m unittest discover -s tests -p approved_css_stage_c_compiler_test.py -v - name: Prevent any NEW CSS stacking across approved /preview/ owners run: | python scripts/check_preview_css_ownership.py @@ -162,6 +164,8 @@ jobs: run: python tests/approved_gui_perf_stage_a_smoke.py - name: Validate Stage B native meter dirty-write / authoritative Pages parity run: python tests/approved_native_meter_dirty_stage_b_smoke.py + - name: Verify Stage C shipped CSS versus original-source computed and screenshot parity + run: python tests/approved_stage_c_css_visual_parity_smoke.py - name: WIRE A main edge and safe graph integration in real Chromium DOM run: python tests/pages_wire_first_canonical_main_smoke.py - name: Verify V49 direct WIRE, gain wheel, connected status, replug and scoped undo From d1bff83ead64b38d224c61e70eaf3967a570e8cf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:21:15 +0700 Subject: [PATCH 35/64] test(stage-c): enforce screenshot and computed-style byte parity with original official GUI --- ...pproved_stage_c_css_visual_parity_smoke.py | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 tests/approved_stage_c_css_visual_parity_smoke.py diff --git a/tests/approved_stage_c_css_visual_parity_smoke.py b/tests/approved_stage_c_css_visual_parity_smoke.py new file mode 100644 index 000000000..ed1f849d7 --- /dev/null +++ b/tests/approved_stage_c_css_visual_parity_smoke.py @@ -0,0 +1,110 @@ +"""Stage C: visual + computed CSS parity between original and deployed owner sheets. + +Compare the real *compiled* /preview/ to exactly the SAME assembled GUI/PNG +assets with unoptimized original authoring CSS restored. Never use legacy +web/app.js, preview-v2 routes, a demo-renderer substitute, or another layout. +""" +import asyncio +import hashlib +from pathlib import Path +import re +import shutil +import tempfile + +from playwright.async_api import async_playwright + +ROOT=Path(__file__).resolve().parents[1] +COMPILED=ROOT/"dist-pages/preview" + + +STYLE_EVIDENCE=r"""() => { + const props=['display','position','width','height','min-width','max-width', + 'padding','margin','gap','grid-template-columns','flex','transform', + 'color','background','background-color','background-image', + 'border','border-radius','box-shadow','text-shadow','filter', + 'clip-path','opacity','visibility','font','line-height','z-index', + '--lit','--peak-extent','--ch']; + const included='.app,.app *,#wireWorkspace,#wireWorkspace *,#moreTools,#moreTools *'; + const nodes=[...document.querySelectorAll(included)]; + return nodes.map((node,i)=>{ + const style=getComputedStyle(node); + const name=typeof node.className==='string'?node.className:''; + const values=props.map(p=>style.getPropertyValue(p)); + const pseudo=node.matches('.strip,.meter-fill,.meter-lane,.mx-hw-key,.fader-travel,.wire-node-out,.strip-identity-top'); + const before=pseudo?getComputedStyle(node,'::before'):null; + const after=pseudo?getComputedStyle(node,'::after'):null; + const pseudoValue=s=>s?[s.content,s.backgroundImage,s.border,s.boxShadow, + s.transform,s.filter,s.opacity]:null; + return [i,node.tagName,name,values,pseudoValue(before),pseudoValue(after)]; + }); +}""" + + +async def render(browser, path, viewport, state): + page=await browser.new_page(viewport={"width":viewport[0],"height":viewport[1]}, + reduced_motion="reduce") + errors=[] + page.on("pageerror",lambda e:errors.append(str(e))) + try: + await page.goto(path.resolve().as_uri()) + await page.wait_for_selector("#tracks .strip[data-id='1']") + await page.evaluate("document.fonts.ready") + await page.wait_for_timeout(100) + if state=="hover-identity": + await page.locator("#tracks .strip[data-id='1'] .strip-identity-top").hover() + await page.wait_for_timeout(130) + elif state=="hover-hardware": + await page.locator("#tracks .strip[data-id='1'] .mx-hw-key[data-hw-kind='mute']").hover() + await page.wait_for_timeout(130) + assert not errors,errors + styles=await page.evaluate(STYLE_EVIDENCE) + screenshot=await page.screenshot(animations="disabled",full_page=False) + return styles,hashlib.sha256(screenshot).hexdigest() + finally: + await page.close() + + +async def main(): + assert (COMPILED/"build.json").is_file(),"build_pages.py must run first" + with tempfile.TemporaryDirectory(prefix="armix-stage-c-original-") as tmp: + baseline=Path(tmp)/"preview" + shutil.copytree(COMPILED,baseline) + cssnames=[p.name for p in (COMPILED/"assets").glob("*.css")] + for name in cssnames: + source=(ROOT/("site/preview-buttons/assets" + if name=="mixer-control-keys.css" + else "site/preview-v2/assets")/name) + if source.is_file(): + shutil.copyfile(source,baseline/"assets"/name) + async with async_playwright() as playwright: + browser=await playwright.chromium.launch(headless=True) + try: + for viewport,state in [ + ((1366,768),"default"), + ((1366,768),"hover-identity"), + ((1366,768),"hover-hardware"), + ((1600,900),"default"), + ]: + original_style,original_image=await render( + browser,baseline/"index.html",viewport,state) + optimized_style,optimized_image=await render( + browser,COMPILED/"index.html",viewport,state) + assert len(original_style)==len(optimized_style),( + "DOM changed",viewport,state) + assert original_style==optimized_style,( + "computed CSS cascade changed",viewport,state, + next(((a,b) for a,b in zip(original_style,optimized_style) + if a!=b),None)) + assert original_image==optimized_image,( + "approved GUI pixel screenshot changed",viewport,state, + original_image,optimized_image) + print("PASS Stage C computed/screenshot parity:", + viewport,state,len(original_style),"elements") + finally: + await browser.close() + print("PASS: same actual /preview/ PNG GUI, compiled CSS declarations are invisible " + "across 1366x768, 1600x900 and pointer-hover states") + + +if __name__=="__main__": + asyncio.run(main()) From deab8631252f7ab7e11e014a12b0d3bb95511ba5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:22:01 +0700 Subject: [PATCH 36/64] fix(stage-c): parse compact @media(...) and @supports(...) context conservatively --- scripts/compile_approved_css.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index a56ec79da..5f24b39ae 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -21,7 +21,7 @@ LINK = re.compile(r'( Date: Thu, 5 Nov 2026 13:22:34 +0700 Subject: [PATCH 37/64] fix(stage-c): correct Python regex escapes for conditional CSS at-rules --- scripts/compile_approved_css.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index 5f24b39ae..c571a7608 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -21,7 +21,7 @@ LINK = re.compile(r'( Date: Thu, 5 Nov 2026 13:25:34 +0700 Subject: [PATCH 38/64] test(stage-c): normalize only differing file:// asset roots for exact CSS parity --- tests/approved_stage_c_css_visual_parity_smoke.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/approved_stage_c_css_visual_parity_smoke.py b/tests/approved_stage_c_css_visual_parity_smoke.py index ed1f849d7..f7c800e65 100644 --- a/tests/approved_stage_c_css_visual_parity_smoke.py +++ b/tests/approved_stage_c_css_visual_parity_smoke.py @@ -26,14 +26,18 @@ '--lit','--peak-extent','--ch']; const included='.app,.app *,#wireWorkspace,#wireWorkspace *,#moreTools,#moreTools *'; const nodes=[...document.querySelectorAll(included)]; + // Baseline resides in a temporary folder; shipped CSS resides in dist-pages. + // Absolute file:// asset URLs are equivalent only when their final /assets/ + // path matches. Normalize path prefixes, NOT colors, selector, query or image. + const norm=value=>String(value).replace(/file:\/\/\/[^"')]+\/assets\//g,'assets/'); return nodes.map((node,i)=>{ const style=getComputedStyle(node); const name=typeof node.className==='string'?node.className:''; - const values=props.map(p=>style.getPropertyValue(p)); + const values=props.map(p=>norm(style.getPropertyValue(p))); const pseudo=node.matches('.strip,.meter-fill,.meter-lane,.mx-hw-key,.fader-travel,.wire-node-out,.strip-identity-top'); const before=pseudo?getComputedStyle(node,'::before'):null; const after=pseudo?getComputedStyle(node,'::after'):null; - const pseudoValue=s=>s?[s.content,s.backgroundImage,s.border,s.boxShadow, + const pseudoValue=s=>s?[s.content,norm(s.backgroundImage),s.border,s.boxShadow, s.transform,s.filter,s.opacity]:null; return [i,node.tagName,name,values,pseudoValue(before),pseudoValue(after)]; }); From e36ecb2b4c16bbdb0773e741ab551a2562af0b3c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:25:56 +0700 Subject: [PATCH 39/64] ci(stage-c): print deterministic compiled CSS removal and owner counts --- scripts/build_pages.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index 11791549f..f01d95da0 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -62,6 +62,10 @@ # Stage C: compile only DEPLOYED copies, never modify locked V28 source # owners or approved PNG artwork. No new CSS/override or second renderer. canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets') +print("Stage C approved CSS: removed",css_compilation["removedDeclarations"], + "redundant declarations (cross-file", + css_compilation["removedCrossFileDeclarations"],"), kept original", + css_compilation["sourceStylesheetCount"],"CSS owners; zero new overrides") if css_compilation['removedDeclarations']<1: raise SystemExit('CSS Stage C produced no obsolete-declaration removals') (buttons_dest/'index.html').write_text(canonical_html,encoding='utf-8') From c63c029c794903807e21ab518961ac35eff00d48 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:27:43 +0700 Subject: [PATCH 40/64] docs(stage-c): explain exact runtime CSS consolidation, correctness gates and hardware limits --- ...OVED_CSS_CASCADE_CONSOLIDATION_20261105.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/P0_STAGE_C_APPROVED_CSS_CASCADE_CONSOLIDATION_20261105.md diff --git a/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_CONSOLIDATION_20261105.md b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_CONSOLIDATION_20261105.md new file mode 100644 index 000000000..e207e5acf --- /dev/null +++ b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_CONSOLIDATION_20261105.md @@ -0,0 +1,26 @@ +# P0 Stage C — deterministic CSS consolidation (2026-11-05) + +**Scope:** exactly the official generated /preview/ GUI and its JUCE WebView2 native equivalent. Tracking [issue #56](https://github.com/masarray/arsonmix/issues/56), integrated [PR #414](https://github.com/masarray/arsonmix/pull/414). + +## Architecture + +Stage A/B added an opt-in profile and guarded the historic 114 cross-file plus 252 same-owner selector/property repetitions against further growth. Stage C implements genuine build-time pruning of **provably redundant runtime declarations**, via scripts/compile_approved_css.py integrated in the ONE official assembler scripts/build_pages.py. The source-owned CSS files and V28 byte-exact historical fixtures are NOT modified. + +For the **same exact normalized selector**, **same property**, **same conditional at-rule chain** and the actual ordered CSS modules, retain only the last !important declaration if one exists, otherwise the last normal declaration. A declaration that can never be the cascade winner is removed from the COPIED output CSS. 18 existing CSS module links stay in their original order: NO new stylesheet, no stylesheet layer on top and no CSS specificity/selector/value rewrite. Build-manifest counters and content-addressed CSS URLs make this inspectable and cache-safe. + +Excluded intentionally: different @media/@supports/@container/@scope/@layer contexts; nested or unrecognized rules; @font-face and @keyframes; and byte-locked approved PNG hardware-key CSS plus WIRE CSS source. This is a conservative compiler, not a false claim that unrelated semantic selectors or different responsive states can always be collapsed. Technical debt in source remains visible for subsequent source-owned consolidation with visual proof. + +## Tests (must remain fail-closed) + +- Compiler unit test covers normal versus !important priority, cross-file and same-file losers, conditional media/supports, URL/comment quote syntax, keyframes, original PNG/WIRE bytes, idempotence and cache hashing. +- Publication gate independently derives the exact compiled bytes of every CSS owner from immutable source, verifies every per-owner hash and original DOM, approved PNG hardware art, and only one /preview/ renderer. +- Browser visual parity test renders the ORIGINAL approved GUI at 1366×768 and 1600×900 with unoptimized source CSS and with Stage C compiled CSS, comparing computed properties, pseudo-elements and PNG screenshots, including pointer hover. Only the absolute temporary file:// asset root is normalized; actual asset name, URL query, style and visual output must remain equal. +- Prior immutable V28 CSS recovery, full UI workflows, native JUCE resource parity, Windows compile/CTest and physical audio FAT remain separate binding checks. A failed visual comparison is not overridden by subjective assertion. + +## Performance and qualification + +This eliminates avoidable CSS style-resolution declarations in the actual shipped Pages/native GUI without adding runtime JavaScript sampling, CSS overrides, duplicated renderers, or changing PCM/ASIO/WASAPI, meter truth, VST3, PAN, fader, physical routing, and native ACK/readback. + +Exact removed-declaration counts, cross-file reductions and SHA-256 digest data are emitted in the generated /preview/build.json -> css_compilation. Build via python scripts/build_pages.py --out dist-pages. The native WebView bundles exactly that generated asset set. + +This milestone DOES NOT independently prove physical Windows cursor latency, GPU compositor cost, or audible PCM correctness. Keep #56 open until affected-PC WebView2/ETW traces, pointer feel, p95/p99 and hardware FAT provide repeatable evidence, as documented in the Stage A profiling procedure. From ed8988a6bba49d785a4f58bb7226d41ad734b20b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:39:15 +0700 Subject: [PATCH 41/64] fix(stage-c): preserve case-sensitive CSS variables and quoted selectors; allow fully clean future sources --- scripts/build_pages.py | 2 - scripts/compile_approved_css.py | 63 +++++++++++++++++-- tests/approved_css_stage_c_compiler_test.py | 9 +++ ...ingle_preview_publication_contract_test.py | 1 - 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index f01d95da0..19c9b7d85 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -66,8 +66,6 @@ "redundant declarations (cross-file", css_compilation["removedCrossFileDeclarations"],"), kept original", css_compilation["sourceStylesheetCount"],"CSS owners; zero new overrides") -if css_compilation['removedDeclarations']<1: - raise SystemExit('CSS Stage C produced no obsolete-declaration removals') (buttons_dest/'index.html').write_text(canonical_html,encoding='utf-8') (buttons_dest/'build.json').write_text(json.dumps({ 'canonical_url':'/preview/', diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index c571a7608..b4ee06281 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -88,7 +88,59 @@ def _close_brace(source: str, open_pos: int, end: int): def _visible(text: str): - return re.sub(r"/\*.*?\*/", "", text, flags=re.S).strip() + """Strip CSS comments, never quoted strings or CSS escapes.""" + result = [] + quote = "" + i = 0 + while i < len(text): + c = text[i] + if quote: + if c == "\\" and i + 1 < len(text): + result.extend((c, text[i + 1])) + i += 2 + continue + result.append(c) + if c == quote: + quote = "" + elif text.startswith("/*", i): + stop = text.find("*/", i + 2) + if stop < 0: + raise ValueError("unterminated CSS comment") + i = stop + 2 + continue + else: + result.append(c) + if c in "'\"": + quote = c + i += 1 + return "".join(result).strip() + + +def _normalize_header(text: str): + """Normalize whitespace only OUTSIDE quoted selector/at-rule strings.""" + parts = [] + quote = "" + escaped = False + pending_space = False + for c in text: + if quote: + parts.append(c) + if escaped: + escaped = False + elif c == "\\": + escaped = True + elif c == quote: + quote = "" + elif c.isspace(): + pending_space = True + else: + if pending_space and parts: + parts.append(" ") + pending_space = False + parts.append(c) + if c in "'\"": + quote = c + return "".join(parts).strip() def _declarations(source: str, filename: str): @@ -108,7 +160,7 @@ def walk(begin: int, end: int, context: tuple[str, ...]): if close < 0: raise ValueError(f"{filename}: unmatched CSS brace near {at}") if header.startswith("@"): - normalized = " ".join(header.split()) + normalized = _normalize_header(header) if CONTAINER.match(normalized): walk(at + 1, close, context + (normalized,)) cursor = close + 1 @@ -116,14 +168,17 @@ def walk(begin: int, end: int, context: tuple[str, ...]): if header and not _seek(source, at + 1, close, "{}")[1]: # Never optimize nested-rule bodies (e.g. modern nesting). p = at + 1 - selector = " ".join(header.split()) + selector = _normalize_header(header) while p < close: stop, divider = _seek(source, p, close, ";") piece = source[p:stop] visible = _visible(piece) match = PROPERTY.match(visible) if match and visible[match.end():].strip(): - prop = match.group(1).lower() + raw_property = match.group(1) + # Custom property names are CASE SENSITIVE in CSS. + prop = (raw_property if raw_property.startswith("--") + else raw_property.lower()) important = bool(IMPORTANT.search(visible)) result.append(Declaration(filename, context, selector, prop, important, p, stop + int(divider == ";"))) diff --git a/tests/approved_css_stage_c_compiler_test.py b/tests/approved_css_stage_c_compiler_test.py index 037330e93..7bb4c317f 100644 --- a/tests/approved_css_stage_c_compiler_test.py +++ b/tests/approved_css_stage_c_compiler_test.py @@ -82,6 +82,15 @@ def test_png_buttons_and_wire_css_are_literal_bytes(self): self.assertEqual(stats["lockedCandidateDeclarations"],1) self.assertEqual(stats["removedDeclarations"],1) + def test_custom_property_case_and_quoted_attribute_spaces_are_distinct(self): + authored=('.x{--Ch:red;--ch:blue}' + '.x[title="a b"]{opacity:.5}' + '.x[title="a b"]{opacity:.7}') + built,stats=css.optimize_css([("a.css",authored)]) + self.assertEqual(stats["removedDeclarations"],0, + "CSS custom properties are case-sensitive and quoted selector whitespace matters") + self.assertEqual(built["a.css"],authored) + def test_idempotent_and_no_new_link_or_authority(self): with tempfile.TemporaryDirectory() as root: assets=Path(root) diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index 88baaaefd..1dc46adac 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -47,7 +47,6 @@ def require(ok,why): .read_text(encoding="utf-8")) for name in linked] compiled,counts=optimize_css(source_css) record=build.get('css_compilation') or {} -require(counts['removedDeclarations']>0,'Stage C did not reduce actual runtime CSS') for stat in ('sourceDeclarations','removedDeclarations', 'removedCrossFileDeclarations','lockedCandidateDeclarations'): require(record.get(stat)==counts[stat],'CSS compiler accounting mismatch: '+stat) From 082cf243626aaca8740a09cddd71e6fafb3416cf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:46:14 +0700 Subject: [PATCH 42/64] test(stage-c): compare computed layout/styles of original vs compiled approved GUI at 3 Windows viewports --- ...roved_css_stage_c_computed_parity_smoke.py | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 tests/approved_css_stage_c_computed_parity_smoke.py diff --git a/tests/approved_css_stage_c_computed_parity_smoke.py b/tests/approved_css_stage_c_computed_parity_smoke.py new file mode 100644 index 000000000..5ca2ad597 --- /dev/null +++ b/tests/approved_css_stage_c_computed_parity_smoke.py @@ -0,0 +1,132 @@ +"""Stage C: compare compiled and original CSS in the EXACT approved /preview/ DOM. + +The baseline is the byte-for-byte accepted CSS before optimization, with the +same approved PNG buttons, JS, font, layout and hardware-neutral demo. +This is a differential regression test, NOT physical Windows GPU FAT. +""" +import asyncio +from pathlib import Path +import shutil +import tempfile +from playwright.async_api import async_playwright + +ROOT = Path(__file__).resolve().parents[1] +PRODUCTION = ROOT / "dist-pages" / "preview" +SHEETS = ( + "mixer-console-foundation.css", "mixer-channel-grid.css", + "mixer-section-controls.css", "mixer-section-layout.css", + "mixer-hardware-artwork.css", "mixer-v3-layout-contract.css", + "mixer-chrome-material.css", "mixer-control-keys.css", + "mixer-fx-rack.css", "mixer-plugin-browser.css", + "mixer-pan-controls.css", "mixer-fader-assembly.css", + "mixer-meter-display.css", "mixer-utility-controls.css", + "inter-embedded.css", "mixer-wire-dots.css", + "mixer-wire-out-align-v48.css", "mixer-contextual-buttons.css", +) +PROPERTIES = ( + "display", "position", "visibility", "opacity", "width", "height", + "min-width", "min-height", "max-width", "max-height", "top", "left", + "right", "bottom", "padding", "margin", "flex", "flex-basis", + "grid-template-columns", "grid-template-rows", "gap", "overflow", + "background", "background-image", "background-color", "color", + "border", "border-color", "border-width", "border-radius", + "box-shadow", "text-shadow", "filter", "transform", "transition", + "clip-path", "font", "font-size", "font-weight", "line-height", + "justify-content", "align-items", "pointer-events", "cursor", + "--lit", "--peak-extent", "--meter-led-ramp", "--track-color", + "--identity-h", "--meter-pitch", "--ch", +) +SAMPLE = ( + ".app", ".window-title", ".command-bar", + ".console-body", ".section-rail", ".tracks-viewport", + ".strip", ".strip *", ".wire-tray", ".wire-node-out", + ".wire-node-in", "#wireWorkspace", ".more-tools-panel", +) + + +async def snapshot(page): + return await page.evaluate("""({selectors, properties}) => { + const elements = Array.from(document.querySelectorAll(selectors.join(','))); + const rows = elements.map((el, index) => { + const c = getComputedStyle(el); + const rect = el.getBoundingClientRect(); + const values = properties.map(p => c.getPropertyValue(p)); + const pseudo = ['::before','::after'].map(part => { + const s = getComputedStyle(el,part); + return [s.content,s.display,s.opacity,s.filter,s.transform, + s.backgroundImage,s.backgroundColor,s.boxShadow]; + }); + return { + tag:el.tagName,cls:typeof el.className==='string'?el.className:'', + id:el.id||'',index,values,pseudo, + rect:[rect.x,rect.y,rect.width,rect.height] + .map(x => Math.round(x*100)/100) + }; + }); + return rows; + }""", {"selectors": list(SAMPLE), "properties": list(PROPERTIES)}) + + +async def inspect_page(browser, url, width, height): + page = await browser.new_page(viewport={"width": width, "height": height}) + errors = [] + page.on("pageerror", lambda err: errors.append(str(err))) + try: + await page.goto(url) + await page.wait_for_selector("#tracks .strip[data-id='1']") + await page.evaluate("document.fonts.ready") + samples = {} + samples["idle"] = await snapshot(page) + # Hover is not optional; passive hover previously caused user stutter. + identity = page.locator("#tracks .strip[data-id='1'] .strip-identity-top") + if await identity.count(): + await identity.hover() + samples["identity-hover"] = await snapshot(page) + key = page.locator("#tracks .strip[data-id='1'] .mx-hw-key[data-hw-kind='mute']") + if await key.count(): + await key.hover() + samples["hardware-key-hover"] = await snapshot(page) + await key.click() + samples["mute-selected"] = await snapshot(page) + return samples, errors + finally: + await page.close() + + +async def main(): + assert PRODUCTION.is_dir(), "Stage C requires approved Pages assembled first" + with tempfile.TemporaryDirectory(prefix="armix-css-c-baseline-") as tmp: + before = Path(tmp) / "approved-original-css" + shutil.copytree(PRODUCTION, before) + for name in SHEETS: + source = (ROOT / ("site/preview-buttons/assets" + if name == "mixer-control-keys.css" + else "site/preview-v2/assets") / name) + shutil.copy2(source, before / "assets" / name) + async with async_playwright() as playwright: + browser = await playwright.chromium.launch(headless=True) + try: + for width, height in [(1366,768),(1680,900),(1920,1080)]: + original, e1 = await inspect_page( + browser, (before/"index.html").as_uri(), width, height) + compiled, e2 = await inspect_page( + browser, (PRODUCTION/"index.html").as_uri(), width, height) + assert not e1 and not e2, (e1,e2) + assert original.keys() == compiled.keys() + for state in original: + left, right = original[state], compiled[state] + assert len(left)==len(right), ( + width,height,state,"DOM node count",len(left),len(right)) + for i,(a,b) in enumerate(zip(left,right)): + assert a==b, ( + "CSS COMPUTED-STYLE/GEOMETRY REGRESSION", + width,height,state,i, + {k:a[k] for k in ("tag","cls","id")}, + {k:(a[k],b[k]) for k in a if a[k]!=b[k]}) + print("PASS approved compiled CSS parity",width,height, + "states",len(original),"nodes",len(original["idle"])) + finally: + await browser.close() + +if __name__ == "__main__": + asyncio.run(main()) From 4920384d2a7bf51b2db397f14eb765154fcfedac Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:46:47 +0700 Subject: [PATCH 43/64] ci(stage-c): fail on computed-style or geometry drift after CSS pruning --- .github/workflows/ui-smoke.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 9dfaef7fd..3522ceecc 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -166,6 +166,8 @@ jobs: run: python tests/approved_native_meter_dirty_stage_b_smoke.py - name: Verify Stage C shipped CSS versus original-source computed and screenshot parity run: python tests/approved_stage_c_css_visual_parity_smoke.py + - name: Stage C rendered CSS parity (original vs compiled, three viewports + hover) + run: python tests/approved_css_stage_c_computed_parity_smoke.py - name: WIRE A main edge and safe graph integration in real Chromium DOM run: python tests/pages_wire_first_canonical_main_smoke.py - name: Verify V49 direct WIRE, gain wheel, connected status, replug and scoped undo From 4eaa9cd68669520d790dd4fdb314e07d517dd636 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:50:21 +0700 Subject: [PATCH 44/64] test(stage-c): normalize only baseline/build file URL roots in computed CSS parity --- tests/approved_css_stage_c_computed_parity_smoke.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/approved_css_stage_c_computed_parity_smoke.py b/tests/approved_css_stage_c_computed_parity_smoke.py index 5ca2ad597..b3dd612a1 100644 --- a/tests/approved_css_stage_c_computed_parity_smoke.py +++ b/tests/approved_css_stage_c_computed_parity_smoke.py @@ -50,11 +50,15 @@ async def snapshot(page): const rows = elements.map((el, index) => { const c = getComputedStyle(el); const rect = el.getBoundingClientRect(); - const values = properties.map(p => c.getPropertyValue(p)); + // Compare computed values, not deployment-specific file:// roots. + // Preserve every filename, query string, color and dimension. + const normalized = value => value.replace( + /file:\/\/\/[^"')]*\/assets\//g,'assets/'); + const values = properties.map(p => normalized(c.getPropertyValue(p))); const pseudo = ['::before','::after'].map(part => { const s = getComputedStyle(el,part); return [s.content,s.display,s.opacity,s.filter,s.transform, - s.backgroundImage,s.backgroundColor,s.boxShadow]; + s.backgroundImage,s.backgroundColor,s.boxShadow].map(normalized); }); return { tag:el.tagName,cls:typeof el.className==='string'?el.className:'', From c964f2531d08ece4afba5cf733fea98a5e6152a3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:52:15 +0700 Subject: [PATCH 45/64] docs(stage-c): CSS runtime pruning, visual proof and remaining debt transparency --- ...ROVED_CSS_CASCADE_OPTIMIZATION_20261105.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md diff --git a/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md new file mode 100644 index 000000000..e86e1c643 --- /dev/null +++ b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md @@ -0,0 +1,32 @@ +# ArSonMix Stage C — CSS Cascade Optimization and Visual-Parity Gate + +**P0 pointer lag issue:** https://github.com/masarray/arsonmix/issues/56 +**Integration:** https://github.com/masarray/arsonmix/pull/414 + +## Runtime milestone + +The ONE public `/preview/` GUI and the matching JUCE WebView2 resource use a **deterministic CSS source compiler** in `scripts/compile_approved_css.py`, executed only by `scripts/build_pages.py`. + +The compiler inspects the approved 18 ordered CSS owners. For matching *exact selector, property, priority and at-rule context*, it retains the effective cascade winner and omits earlier redundant declarations **from the deployed copies**. It does not add a late stylesheet, move CSS between owners, edit the accepted buttons' PNG assets or replace the UI renderer. URLs are content-addressed for browser-cache safety. + +On the checked Stage C implementation, build logs report **242 declarations removed, of which 89 were cross-file**. The authored CSS source still contains its historical debt; source hashes are deliberately preserved because legacy V28 source restoration tests rely on those bytes. + +Two especially sensitive assets — `mixer-control-keys.css` (approved physical PNG buttons) and `mixer-wire-dots.css` — remain byte-identical even in the built output. No new `!important` overrides are introduced. + +## Proof required + +- `tests/approved_css_stage_c_compiler_test.py`: source-preserving compiler unit tests; cascade priority and nested conditions; string/comment parsing; locked hardware controls. +- `tests/single_preview_publication_contract_test.py`: original source + approved PNG revision + compiled hashed CSS is **exactly** the sole published /preview/, with deterministic owner hashes; no independent preview-v2. +- `tests/approved_stage_c_css_visual_parity_smoke.py`: screenshot and computed style comparison between original and deployed CSS, including hover states. +- `tests/approved_css_stage_c_computed_parity_smoke.py`: independent deeper computed style + geometry comparison across 1366×768, 1680×900, 1920×1080; idle, strip hover, hardware key hover and MUTE press. The only normalized difference is absolute *test folder* prefix for asset file:// URLs. It never normalizes numeric styles, colors, CSS filenames, URLs' trailing paths or dimensions. +- The inherited CSS V28 exact-source and full WIRE/fader/meter visual regression suites remain enforced; Windows JUCE/CTest/EXE must also succeed at the final PR SHA. + +## Technical debt and what is NOT proven + +The existing source inventory shows **114 cross-owner selector/property overlaps and 252 within-owner repeats** under its conservative static counter. That does **not** equal the number of independently removable browser declarations: priority, scope, fallbacks, PNG/WIRE preservation, and vendor compatibility limit safe pruning. Do not advertise "zero CSS duplicates" in source; the new compiler removes only validated runtime losers, while gates forbid adding new ones. + +Actual mouse input-to-photon latency and GPU compositor performance on the affected Windows machine have **not** been measured. A successful Chromium/Windows CI cannot certify physical cursor smoothness, ASIO/WASAPI playback or full hardware FAT. Keep issue #56 open and capture Stage A evidence on the user's machine before claiming a stutter fix. + +## Maintainability rule + +Do not append an override stylesheet or an additional `!important` patch. Author future UI changes in the existing owner, maintain one deterministic compiler output, preserve link order, and first demonstrate exact compiled CSS parity plus Stage A+B runtime behavior. Reduce the remaining source debt separately with a deliberate checkpoint migration, never by weakening historical fixture checks. From 20f0802b97fd3081a98d9911d55cf0c86075bda6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:54:57 +0700 Subject: [PATCH 46/64] fix(stage-c): preserve CSS fallbacks for var/color-mix/vendor values across WebView2 versions --- scripts/compile_approved_css.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index b4ee06281..9404f9998 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -22,6 +22,9 @@ PROPERTY = re.compile(r"^\s*(--[A-Za-z0-9_-]+|[-A-Za-z_][-A-Za-z0-9_]*)\s*:", re.S) IMPORTANT = re.compile(r"!\s*important\s*$", re.I) CONTAINER = re.compile(r"^@(media|supports|container|layer|scope)(?=\s|\()", re.I) +# Keep older declarations as browser/undefined-variable fallbacks when the +# chosen modern value may be unsupported. P0 WebView2 runtime versions vary. +FALLBACK_SENSITIVE = re.compile(r"\b(?:var|env|color-mix|image-set|paint|oklch|oklab|lab|lch|light-dark|color)\s*\(|-webkit-|-moz-", re.I) # Explicit byte parity with the owner-approved PNG buttons and VIRE historical # socket source: these 2 assets participate as winners but never change bytes. LOCKED_ASSETS = frozenset({"mixer-control-keys.css", "mixer-wire-dots.css"}) @@ -198,6 +201,7 @@ def optimize_css(stylesheets: list[tuple[str, str]]): retain duplicate declarations; no winner is deleted without a later equivalent-context winner and an explicit scoped proof. """ + source_by_owner = dict(stylesheets) entries = [] for filename, css in stylesheets: for record in _declarations(css, filename): @@ -215,9 +219,18 @@ def optimize_css(stylesheets: list[tuple[str, str]]): potential += len(declarations) - 1 important = [d for d in declarations if d.important] winner = important[-1] if important else declarations[-1] + # A later var()/color-mix()/vendor declaration may be invalid in an + # older WebView2 or when a custom property is unset. Its earlier + # declaration is a genuine CSS fallback, not dead CSS. + winner_text = _visible( + source_by_owner[winner.filename][winner.start:winner.end]) + preserve_fallbacks = bool(FALLBACK_SENSITIVE.search(winner_text)) for item in declarations: if item is winner: continue + if preserve_fallbacks: + locked += 1 + continue if item.filename in LOCKED_ASSETS: locked += 1 continue From 59eb11ac8cb2d0692704d6651241b54e60afb44e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:55:19 +0700 Subject: [PATCH 47/64] quality(stage-c): account for preserved browser fallbacks separately from locked artwork --- scripts/compile_approved_css.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index 9404f9998..858037546 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -212,6 +212,7 @@ def optimize_css(stylesheets: list[tuple[str, str]]): removals = defaultdict(list) potential = 0 locked = 0 + fallback = 0 across = 0 for declarations in groups.values(): if len(declarations) < 2: @@ -229,7 +230,7 @@ def optimize_css(stylesheets: list[tuple[str, str]]): if item is winner: continue if preserve_fallbacks: - locked += 1 + fallback += 1 continue if item.filename in LOCKED_ASSETS: locked += 1 @@ -252,11 +253,12 @@ def optimize_css(stylesheets: list[tuple[str, str]]): "removedDeclarations": sum(map(len, removals.values())), "removedCrossFileDeclarations": across, "lockedCandidateDeclarations": locked, + "preservedFallbackDeclarations": fallback, "sourceStylesheetCount": len(stylesheets), "generatedStylesheetCount": len(compiled), "addedOverrideStylesheets": 0, } - if stats["removedDeclarations"] + locked != potential: + if stats["removedDeclarations"] + locked + fallback != potential: raise ValueError("CSS loser accounting does not balance") return compiled, stats From 1e34f2d4d1f00696d60a0f08d2f15cebe12f7c4e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:55:40 +0700 Subject: [PATCH 48/64] test(stage-c): retain CSS custom-property and color-mix fallbacks with modern WebView2 safety --- tests/approved_css_stage_c_compiler_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/approved_css_stage_c_compiler_test.py b/tests/approved_css_stage_c_compiler_test.py index 7bb4c317f..4b4daa217 100644 --- a/tests/approved_css_stage_c_compiler_test.py +++ b/tests/approved_css_stage_c_compiler_test.py @@ -40,6 +40,27 @@ def test_important_wins_even_if_ordinary_is_later(self): self.assertNotIn("color:blue",compiled["b.css"]) self.assertEqual(stats["removedDeclarations"],2) + def test_variable_and_modern_color_keep_old_runtime_fallbacks(self): + original=[ + ("a.css",".strip{color:#ededed;color:var(--unbound)}"), + ("b.css",".meter{background:#153028;" + "background:color-mix(in srgb,#153028 80%,#000)}") + ] + compiled,stats=css.optimize_css(original) + self.assertEqual(compiled,dict(original), + "WebView2 versions and unset custom properties need fallback") + self.assertEqual(stats["removedDeclarations"],0) + self.assertEqual(stats["preservedFallbackDeclarations"],2) + self.assertEqual(stats["lockedCandidateDeclarations"],0) + + def test_redundant_non_fallback_still_pruned(self): + compiled,stats=css.optimize_css([ + ("a.css",".strip{border-radius:2px;border-radius:3px}") + ]) + self.assertNotIn("2px",compiled["a.css"]) + self.assertIn("3px",compiled["a.css"]) + self.assertEqual(stats["removedDeclarations"],1) + def test_media_and_supports_conditions_never_confused(self): compiled,stats=css.optimize_css([ ("a.css", ".meter{color:red}@media(max-width:700px){.meter{color:orange}}"), From 4875226dc48f4601fd715faa171b1be55dc238cd Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 13:57:19 +0700 Subject: [PATCH 49/64] docs(stage-c): distinguish initial pruning count from fallback-safe final compiler result --- docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md index e86e1c643..959cd380d 100644 --- a/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md +++ b/docs/P0_STAGE_C_APPROVED_CSS_CASCADE_OPTIMIZATION_20261105.md @@ -9,7 +9,7 @@ The ONE public `/preview/` GUI and the matching JUCE WebView2 resource use a **d The compiler inspects the approved 18 ordered CSS owners. For matching *exact selector, property, priority and at-rule context*, it retains the effective cascade winner and omits earlier redundant declarations **from the deployed copies**. It does not add a late stylesheet, move CSS between owners, edit the accepted buttons' PNG assets or replace the UI renderer. URLs are content-addressed for browser-cache safety. -On the checked Stage C implementation, build logs report **242 declarations removed, of which 89 were cross-file**. The authored CSS source still contains its historical debt; source hashes are deliberately preserved because legacy V28 source restoration tests rely on those bytes. +The first Stage C build removed **242 declarations (89 cross-file)**. After the additional WebView2 compatibility safeguard, the final number must be read from the exact-head `css_compilation` build manifest; do not reuse the earlier count as a final result. The compiler now retains older declarations when the winning value uses `var()`, `color-mix()`, or other support-sensitive syntax, so browser-version and unset-variable fallbacks remain intact. The authored CSS source still contains its historical debt; source hashes are deliberately preserved because legacy V28 source restoration tests rely on those bytes. Two especially sensitive assets — `mixer-control-keys.css` (approved physical PNG buttons) and `mixer-wire-dots.css` — remain byte-identical even in the built output. No new `!important` overrides are introduced. From 0829b8133559f95840d61a5dd0cacf3fb22943f9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:03:32 +0700 Subject: [PATCH 50/64] perf(stage-d): compile one source-ordered CSSOM bundle for official Pages and native WebView2 --- scripts/compile_approved_css.py | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index 858037546..ef48758b4 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -263,6 +263,61 @@ def optimize_css(stylesheets: list[tuple[str, str]]): return compiled, stats +# Stage D: one runtime CSSOM owner; the 18 historical sources and their +# original cascade order remain independently maintainable. +RUNTIME_CSS = "arsonmix-approved-runtime.css" + + +def compile_runtime_bundle(stylesheets: list[tuple[str, str]]) -> str: + """Concatenate source-ordered *compiled* CSS, without changing selector scope. + + Every owner lives in /assets/: url(...) resolution is unchanged. Fail + closed on top-level CSS at-rules whose semantics depend on file location. + Do not minify/rewrite original selectors or reorder @media/@font-face. + """ + if not stylesheets or len({name for name, _ in stylesheets}) != len(stylesheets): + raise ValueError("Runtime CSS requires unique, ordered approved owners") + if any(name == RUNTIME_CSS for name, _ in stylesheets): + raise ValueError("Runtime CSS output must not be an authored owner") + parts = ["/* ArSonMix approved runtime CSS: generated; edit source owners only. */\n"] + for name, css in stylesheets: + # Remove only comments for detecting forbidden at-rules, not for output. + plain = re.sub(r"/\*[\s\S]*?\*/", "", css) + if re.search(r"@(?:charset|import|namespace)\b", plain, re.I): + raise ValueError("CSS owner cannot be bundled with @import/charset/namespace: " + name) + if not re.fullmatch(r"[a-zA-Z0-9._-]+\.css", name): + raise ValueError("Unsafe runtime CSS owner: " + name) + # Separators prevent neighboring tokens merging; comments document + # provenance but are NOT a second override/cascade layer. + parts.append("\n/* BEGIN approved owner " + name + " */\n") + parts.append(css) + parts.append("\n/* END approved owner " + name + " */\n") + return "".join(parts) + + +def link_runtime_bundle(html: str, css_sha: str) -> str: + """Replace exactly the approved CSS owner links with ONE runtime link.""" + if not re.fullmatch(r"[a-f0-9]{16}", css_sha): + raise ValueError("Invalid generated runtime CSS digest") + original = list(LINK.finditer(html)) + if len(original) != 18 or len({m.group(2) for m in original}) != 18: + raise ValueError("Approved GUI must list its 18 unique CSS owners") + if RUNTIME_CSS in (m.group(2) for m in original): + raise ValueError("Runtime CSS would recursively import itself") + count = 0 + def rewrite(match): + nonlocal count + count += 1 + if count == 1: + return ('') + return "" + rewritten = LINK.sub(rewrite, html) + if count != len(original) or rewritten.count('href="assets/' + RUNTIME_CSS) != 1: + raise ValueError("CSS runtime bundling failed closed") + return rewritten + + def optimize_assets(html: str, assets: Path): """Change only copied CSS asset bytes and add content-addressing to URLs.""" names = [match.group(2) for match in LINK.finditer(html)] @@ -290,5 +345,18 @@ def link(match): return prefix + name + base + delim + "armixc=" + revisions[name] + trailing rendered = LINK.sub(link, html) + # Keep all per-owner compiled CSS copies as inspectable provenance. + # The browser/native WebView2 now *request just one* generated CSS file. + # Packaging may discard redundant unreferenced owner copies separately + # after the established exact-approved-PNG and WIRE provenance checks. + bundled = compile_runtime_bundle([(name, optimized[name]) for name, _ in files]) + digest = hashlib.sha256(bundled.encode("utf-8")).hexdigest()[:16] + (assets / RUNTIME_CSS).write_text(bundled, encoding="utf-8", newline="") + rendered = link_runtime_bundle(rendered, digest) stats["shaByCssOwner"] = revisions + stats["runtimeStylesheetCount"] = 1 + stats["removedStylesheetRequests"] = len(files) - 1 + stats["runtimeBundleCssSHA256"] = digest + stats["runtimeBundleBytes"] = len(bundled.encode("utf-8")) + stats["compiledOwnerBytes"] = sum(len(optimized[name].encode("utf-8")) for name, _ in files) return rendered, stats From 490bcf95cd4e9ec341ab656059799b52a4d7830c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:04:23 +0700 Subject: [PATCH 51/64] refactor(stage-d): explicit bundle mode preserves source CSS optimizer tooling contract --- scripts/compile_approved_css.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/compile_approved_css.py b/scripts/compile_approved_css.py index ef48758b4..0410dca59 100644 --- a/scripts/compile_approved_css.py +++ b/scripts/compile_approved_css.py @@ -318,7 +318,7 @@ def rewrite(match): return rewritten -def optimize_assets(html: str, assets: Path): +def optimize_assets(html: str, assets: Path, *, runtime_bundle: bool = False): """Change only copied CSS asset bytes and add content-addressing to URLs.""" names = [match.group(2) for match in LINK.finditer(html)] if not names or len(set(names)) != len(names): @@ -345,6 +345,12 @@ def link(match): return prefix + name + base + delim + "armixc=" + revisions[name] + trailing rendered = LINK.sub(link, html) + stats["shaByCssOwner"] = revisions + if not runtime_bundle: + # Low-level optimizer retains its original per-owner API for tools, + # unit fixtures and source migration; only the official assembler + # opts into Stage D's single runtime CSSOM. + return rendered, stats # Keep all per-owner compiled CSS copies as inspectable provenance. # The browser/native WebView2 now *request just one* generated CSS file. # Packaging may discard redundant unreferenced owner copies separately @@ -353,7 +359,6 @@ def link(match): digest = hashlib.sha256(bundled.encode("utf-8")).hexdigest()[:16] (assets / RUNTIME_CSS).write_text(bundled, encoding="utf-8", newline="") rendered = link_runtime_bundle(rendered, digest) - stats["shaByCssOwner"] = revisions stats["runtimeStylesheetCount"] = 1 stats["removedStylesheetRequests"] = len(files) - 1 stats["runtimeBundleCssSHA256"] = digest From a6508b3af39599ada70840e6bd72a38ba17dbd73 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:04:35 +0700 Subject: [PATCH 52/64] perf(stage-d): official Pages/native assembler serves a single versioned CSS bundle --- scripts/build_pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index 19c9b7d85..e0e92b0c3 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -61,7 +61,7 @@ canonical_html=canonical_html.replace('',probe_tag+'\n',1) # Stage C: compile only DEPLOYED copies, never modify locked V28 source # owners or approved PNG artwork. No new CSS/override or second renderer. -canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets') +canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets',runtime_bundle=True) print("Stage C approved CSS: removed",css_compilation["removedDeclarations"], "redundant declarations (cross-file", css_compilation["removedCrossFileDeclarations"],"), kept original", From da89b068720dc5d940ec4e464403f73ef9b4332e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:04:59 +0700 Subject: [PATCH 53/64] test(stage-d): reconstruct original 18 CSS links only in diff-test fixture --- tests/approved_css_original_bundle_fixture.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/approved_css_original_bundle_fixture.py diff --git a/tests/approved_css_original_bundle_fixture.py b/tests/approved_css_original_bundle_fixture.py new file mode 100644 index 000000000..2162f2a99 --- /dev/null +++ b/tests/approved_css_original_bundle_fixture.py @@ -0,0 +1,28 @@ +"""Only for CSS visual-parity tests: reconstruct original ordered CSS links. + +Do not recreate another GUI. HTML+JS+PNG are copied from compiled /preview/, +and only the ONE generated runtime stylesheet link is exchanged for the +18 original source owner links before testing the original owner CSS files. +""" +from pathlib import Path +import re + +ROOT = Path(__file__).resolve().parents[1] +SOURCE = ROOT / "site/preview-v2/index.html" +ORIGINAL_LINK = re.compile( + r'' +) +RUNTIME_LINK = re.compile( + r'' +) + + +def reconstructed_original_css_html(shipped_html: str) -> str: + original = ORIGINAL_LINK.findall(SOURCE.read_text(encoding="utf-8")) + if len(original) != 18 or len(set(original)) != 18: + raise ValueError("Approved source CSS ownership changed unexpectedly") + if len(RUNTIME_LINK.findall(shipped_html)) != 1: + raise ValueError("Approved runtime CSS must be one content-addressed link") + if len(ORIGINAL_LINK.findall(shipped_html)) != 1: + raise ValueError("Unexpected extra runtime CSS stack") + return RUNTIME_LINK.sub("\n".join(original), shipped_html, count=1) From 3ef97d664df6680b22dee634fcd5d0cea6f8f743 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:05:19 +0700 Subject: [PATCH 54/64] test(stage-d): compare one compiled CSS bundle against original 18-style authoring visually --- tests/approved_stage_c_css_visual_parity_smoke.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/approved_stage_c_css_visual_parity_smoke.py b/tests/approved_stage_c_css_visual_parity_smoke.py index f7c800e65..b19696e21 100644 --- a/tests/approved_stage_c_css_visual_parity_smoke.py +++ b/tests/approved_stage_c_css_visual_parity_smoke.py @@ -12,6 +12,7 @@ import tempfile from playwright.async_api import async_playwright +from approved_css_original_bundle_fixture import reconstructed_original_css_html ROOT=Path(__file__).resolve().parents[1] COMPILED=ROOT/"dist-pages/preview" @@ -73,6 +74,8 @@ async def main(): with tempfile.TemporaryDirectory(prefix="armix-stage-c-original-") as tmp: baseline=Path(tmp)/"preview" shutil.copytree(COMPILED,baseline) + original_html=reconstructed_original_css_html((baseline/'index.html').read_text(encoding='utf-8')) + (baseline/'index.html').write_text(original_html,encoding='utf-8') cssnames=[p.name for p in (COMPILED/"assets").glob("*.css")] for name in cssnames: source=(ROOT/("site/preview-buttons/assets" From 09d80065ff416384f8d0867e81ad59ed3a3a6636 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:05:23 +0700 Subject: [PATCH 55/64] test(stage-d): compare one compiled CSS bundle against original 18-style authoring visually --- tests/approved_css_stage_c_computed_parity_smoke.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/approved_css_stage_c_computed_parity_smoke.py b/tests/approved_css_stage_c_computed_parity_smoke.py index b3dd612a1..26f967a7d 100644 --- a/tests/approved_css_stage_c_computed_parity_smoke.py +++ b/tests/approved_css_stage_c_computed_parity_smoke.py @@ -9,6 +9,7 @@ import shutil import tempfile from playwright.async_api import async_playwright +from approved_css_original_bundle_fixture import reconstructed_original_css_html ROOT = Path(__file__).resolve().parents[1] PRODUCTION = ROOT / "dist-pages" / "preview" @@ -102,6 +103,8 @@ async def main(): with tempfile.TemporaryDirectory(prefix="armix-css-c-baseline-") as tmp: before = Path(tmp) / "approved-original-css" shutil.copytree(PRODUCTION, before) + original_html=reconstructed_original_css_html((before/'index.html').read_text(encoding='utf-8')) + (before/'index.html').write_text(original_html,encoding='utf-8') for name in SHEETS: source = (ROOT / ("site/preview-buttons/assets" if name == "mixer-control-keys.css" From 2c753a74ebd51618f1f0e840e350b02ed1b03d0b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:05:55 +0700 Subject: [PATCH 56/64] test(stage-d): verify one runtime CSSOM, exact 18-source hash and no duplicate runtime links --- ...ingle_preview_publication_contract_test.py | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index 1dc46adac..ea2397a95 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -2,7 +2,7 @@ from pathlib import Path import json, re, sys, hashlib sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts')) -from compile_approved_css import LINK, optimize_css +from compile_approved_css import LINK, optimize_css, compile_runtime_bundle, link_runtime_bundle, RUNTIME_CSS ROOT=Path(__file__).resolve().parents[1] DST=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else ROOT/'dist-pages' gui=DST/'preview' @@ -14,7 +14,7 @@ def require(ok,why): require(build.get('kind')=='APPROVED_SINGLE_GUI' and build.get('canonical_url')=='/preview/','wrong public GUI identity') require(build.get('live_audio') is False,'browser must not claim PCM') require('id="console"' not in html and 'preview-buttons/index.html' not in html,'old iframe variant still published') -require('console-body' in html and 'mixer-control-keys.css' in html,'not the actual approved console') +require('console-body' in html and RUNTIME_CSS in html and 'mixer-control-keys.js' in html,'not the actual approved console') # The only compiled DOM changes are two hashed approved PNG links and the dormant profiling script. revisions=build.get('button_css_js_revisions',{}) expected=source @@ -48,7 +48,8 @@ def require(ok,why): compiled,counts=optimize_css(source_css) record=build.get('css_compilation') or {} for stat in ('sourceDeclarations','removedDeclarations', - 'removedCrossFileDeclarations','lockedCandidateDeclarations'): + 'removedCrossFileDeclarations','lockedCandidateDeclarations', + 'preservedFallbackDeclarations'): require(record.get(stat)==counts[stat],'CSS compiler accounting mismatch: '+stat) require(record.get('sourceStylesheetCount')==18 and record.get('generatedStylesheetCount')==18 and @@ -64,7 +65,24 @@ def css_rewrite(match): prefix,name,query,end=match.groups() return prefix+name+(query or '')+('&' if query else '?')+'armixc='+record['shaByCssOwner'][name]+end expected=LINK.sub(css_rewrite,expected) -require(html==expected,'rendered /preview/ DOM differs from source + approved buttons + nonvisual profiler') +# Stage D: exactly ONE CSS link used by the Pages/Windows WebView2 runtime, +# while 18 source owners remain ordered and inspectable (not 18 CSSOM sheets). +runtime=compile_runtime_bundle([(name,compiled[name]) for name in linked]) +digest=hashlib.sha256(runtime.encode('utf-8')).hexdigest()[:16] +require((gui/'assets'/RUNTIME_CSS).read_bytes()==runtime.encode('utf-8'), + 'actual runtime stylesheet differs from source-owned winner sequence') +require(record.get('runtimeBundleCssSHA256')==digest and + record.get('runtimeBundleBytes')==len(runtime.encode('utf-8')), + 'runtime stylesheet integrity/provenance mismatch') +require(record.get('runtimeStylesheetCount')==1 and + record.get('removedStylesheetRequests')==17 and + record.get('addedOverrideStylesheets')==0, + 'Stage D loaded an extra CSS layer or a second renderer') +expected=link_runtime_bundle(expected,digest) +shipped=list(LINK.finditer(html)) +require(len(shipped)==1 and shipped[0].group(2)==RUNTIME_CSS, + 'Only the single compiled runtime CSS is allowed to load') +require(html==expected,'rendered /preview/ DOM differs from source + approved buttons + one runtime CSS + nonvisual profiler') for name in ('mixer-wire-dots.css','knob-ICON.svg'): require((gui/'assets'/name).read_bytes()==(ROOT/'site/preview-v2/assets'/name).read_bytes(),'WIRE source drift: '+name) require((gui/'assets/mute-solo-pfl-56x37.png').read_bytes()==(ROOT/'site/preview-buttons/assets/mute-solo-pfl-56x37.png').read_bytes(),'approved PNG sprite mismatch') From c59456ecf25e93c9a4883106c560443d93e94e49 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:06:10 +0700 Subject: [PATCH 57/64] test(stage-d): enforce exact one native CSSOM and generated resource identity --- tests/approved_native_gui_bundle_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py index 46746456a..2d12c4882 100644 --- a/tests/approved_native_gui_bundle_test.py +++ b/tests/approved_native_gui_bundle_test.py @@ -48,7 +48,11 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self) for name in ("mixer-control-keys.css", "mixer-control-keys.js", "mute-solo-pfl-56x37.png"): button = (ROOT / "site/preview-buttons/assets" / name).read_bytes() self.assertEqual((out / "assets" / name).read_bytes(), button) - self.assertIn("assets/mixer-control-keys.css?rev=", native) + # Stage D uses ONE compiled CSSOM for both Pages and WebView2. + self.assertEqual(native.count(' Date: Thu, 5 Nov 2026 14:07:14 +0700 Subject: [PATCH 58/64] test(stage-d): prove single CSSOM and one stylesheet request in actual approved Chromium GUI --- ...pproved_css_stage_d_single_bundle_smoke.py | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/approved_css_stage_d_single_bundle_smoke.py diff --git a/tests/approved_css_stage_d_single_bundle_smoke.py b/tests/approved_css_stage_d_single_bundle_smoke.py new file mode 100644 index 000000000..358c65f0f --- /dev/null +++ b/tests/approved_css_stage_d_single_bundle_smoke.py @@ -0,0 +1,62 @@ +"""Stage D: the EXACT approved /preview/ GUI loads one CSSOM, no override stack. + +Resource-count proof only. It cannot claim Windows cursor or GPU latency. +""" +import asyncio +from pathlib import Path +from playwright.async_api import async_playwright + +ROOT = Path(__file__).resolve().parents[1] +PAGE = ROOT / "dist-pages/preview/index.html" + + +async def main(): + assert PAGE.is_file(), "Build the only approved /preview/ GUI first" + async with async_playwright() as p: + browser = await p.chromium.launch(headless=True) + try: + for size in ((1366,768), (1680,900), (1920,1080)): + page = await browser.new_page(viewport={"width":size[0],"height":size[1]}) + css_requests = [] + errors = [] + page.on("request", lambda r: css_requests.append(r.url) + if r.resource_type == "stylesheet" else None) + page.on("pageerror", lambda e: errors.append(str(e))) + await page.goto(PAGE.as_uri()) + await page.wait_for_selector("#tracks .strip[data-id='1']") + await page.evaluate("document.fonts.ready") + stats = await page.evaluate("""() => { + const links=[...document.querySelectorAll('link[rel="stylesheet"]')]; + const sheets=[...document.styleSheets].filter(x => + x.ownerNode?.tagName==="LINK"); + const keys=document.querySelector( + "#tracks .strip[data-id='1'] .mx-hw-key[data-hw-kind='mute']"); + const image=getComputedStyle(keys,"::before").backgroundImage; + const root=getComputedStyle(document.querySelector(".console-body")); + return {links:links.map(x=>x.href), + count:sheets.length, + image, + display:root.display, + keys:document.querySelectorAll(".mx-hw-key").length, + cssRules:sheets.length ? sheets[0].cssRules.length : 0}; + }""") + assert len(stats["links"]) == stats["count"] == 1, (size,stats) + assert stats["cssRules"] > 100, (size,stats) + assert stats["keys"] >= 3 and "mute-solo-pfl" in stats["image"], (size,stats) + assert "arsonmix-approved-runtime.css?sha=" in stats["links"][0] + assert len(css_requests) == 1, (size,css_requests) + assert not errors, errors + # MUTE / focused WIRE and original controls remain operative. + key=page.locator("#tracks .strip[data-id='1'] .mx-hw-key[data-hw-kind='mute']") + await key.click() + assert await key.get_attribute("aria-pressed") == "true" + assert len(css_requests) == 1, (size,css_requests) + await page.close() + print("PASS Stage D one stylesheet / 17 requests eliminated:", + size,"CSS rules",stats["cssRules"]) + finally: + await browser.close() + print("PASS one approved runtime CSS, original PNG key and zero late CSS link") + +if __name__ == "__main__": + asyncio.run(main()) From 7d7a097261ef0a8a5526e87edf069b1391c0119c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:07:41 +0700 Subject: [PATCH 59/64] test(stage-d): lock one source-ordered CSS bundle and legacy WebView2 fallback safety --- tests/approved_css_stage_c_compiler_test.py | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/approved_css_stage_c_compiler_test.py b/tests/approved_css_stage_c_compiler_test.py index 4b4daa217..5fb9039f2 100644 --- a/tests/approved_css_stage_c_compiler_test.py +++ b/tests/approved_css_stage_c_compiler_test.py @@ -134,5 +134,39 @@ def test_idempotent_and_no_new_link_or_authority(self): self.assertEqual(again["removedDeclarations"],0) + def test_stage_d_single_cssom_preserves_owner_order_and_relative_assets(self): + owners=[("owner-%02d.css"%n, + '.x{background-image:url("artwork.png");color:#%03d}'%n) + for n in range(18)] + bundled=css.compile_runtime_bundle(owners) + self.assertEqual(bundled.count("BEGIN approved owner"),18) + self.assertLess(bundled.index("owner-00.css"),bundled.index("owner-17.css")) + self.assertIn('url("artwork.png")',bundled) + markup="".join('\n' + for name,_ in owners) + one=css.link_runtime_bundle(markup,"0123456789abcdef") + self.assertEqual(one.count('rel="stylesheet"'),1) + self.assertIn('assets/arsonmix-approved-runtime.css?sha=0123456789abcdef',one) + self.assertNotIn('owner-00.css',one) + with self.assertRaisesRegex(ValueError,"18 unique"): + css.link_runtime_bundle('',"0123456789abcdef") + with self.assertRaisesRegex(ValueError,"@import"): + css.compile_runtime_bundle([("a.css",'@import url("other.css");.x{opacity:1}')]) + + def test_stage_d_retains_fallbacks_for_older_webview2_and_missing_vars(self): + original='.control{color:#fff;color:var(--preferred-color)}' + optimized,stats=css.optimize_css([("a.css",original)]) + self.assertEqual(optimized["a.css"],original) + self.assertEqual(stats["preservedFallbackDeclarations"],1) + self.assertEqual(stats["removedDeclarations"],0) + modern=[("a.css",".control{background:#202c34}"), + ("b.css",".control{background:color-mix(in srgb,red,blue)}")] + optimized,stats=css.optimize_css(modern) + self.assertEqual(dict(modern),optimized) + self.assertEqual(stats["preservedFallbackDeclarations"],1) + self.assertEqual(stats["removedDeclarations"],0) + + + if __name__=="__main__": unittest.main() From 98a48543819a151f64747284dd7dc908840eba09 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:07:56 +0700 Subject: [PATCH 60/64] ci(stage-d): enforce one stylesheet request and hardware PNG controls in Chromium --- .github/workflows/ui-smoke.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 3522ceecc..706619cce 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -166,6 +166,8 @@ jobs: run: python tests/approved_native_meter_dirty_stage_b_smoke.py - name: Verify Stage C shipped CSS versus original-source computed and screenshot parity run: python tests/approved_stage_c_css_visual_parity_smoke.py + - name: Stage D one runtime CSSOM and actual stylesheet network count + run: python tests/approved_css_stage_d_single_bundle_smoke.py - name: Stage C rendered CSS parity (original vs compiled, three viewports + hover) run: python tests/approved_css_stage_c_computed_parity_smoke.py - name: WIRE A main edge and safe graph integration in real Chromium DOM From 75f776fe0dab99692223050db6d423dfe096c2c6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:09:59 +0700 Subject: [PATCH 61/64] docs(stage-d): single loaded CSSOM, provenance and physical-performance proof boundaries --- ...NE_APPROVED_RUNTIME_STYLESHEET_20261105.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/P0_STAGE_D_ONE_APPROVED_RUNTIME_STYLESHEET_20261105.md diff --git a/docs/P0_STAGE_D_ONE_APPROVED_RUNTIME_STYLESHEET_20261105.md b/docs/P0_STAGE_D_ONE_APPROVED_RUNTIME_STYLESHEET_20261105.md new file mode 100644 index 000000000..86a397d17 --- /dev/null +++ b/docs/P0_STAGE_D_ONE_APPROVED_RUNTIME_STYLESHEET_20261105.md @@ -0,0 +1,67 @@ +# P0 Stage D — one runtime CSSOM and qualification + +**Issue:** https://github.com/masarray/arsonmix/issues/56 +**One integration PR:** https://github.com/masarray/arsonmix/pull/414 +**One real GUI:** the official /preview/ and its exact JUCE WebView2 counterpart. + +## What actually changed + +The deterministic source assembler still reads 18 authored CSS owners in +the same approved sequence and runs the conservative Stage C declaration +pruner, retaining WebView2 version-dependent fallbacks. + +Stage D concatenates the already compiled CSS owners into ONE generated +content-addressed assets/arsonmix-approved-runtime.css, preserving their +exact selector, priority and at-rule order. Published HTML and JUCE WebView2 +each request ONE CSS resource, versus 18 before: 17 fewer stylesheet +requests. No new authored override, alternate UI skin, CSS style node +or second renderer is created. + +The original 18 stylesheet source owners and compiled per-owner copies +remain as inspectable provenance. Unreferenced CSS copies never become +loaded CSSOM layers. The standalone /preview/ and JUCE use the same +scripts/build_pages.py assembler. + +Unsafe @import, @charset and @namespace in an owner are rejected instead +of silently changing their behavior under bundling. Image/font URLs +still resolve relative to the same assets directory. The approved +MUTE/SOLO/PFL hardware PNG and historical WIRE CSS remain byte-locked. + +## Exact-GUI tests + +- tests/single_preview_publication_contract_test.py: 18 ordered source + owners, per-file compiled hashes, one generated bundle SHA, one runtime + stylesheet link and approved PNG/WIRE assets. +- tests/approved_css_stage_c_compiler_test.py: cascade priority, + scoped selectors, old WebView2 and missing-variable fallbacks, + deterministic ordered bundle, unsafe-at-rule rejection. +- tests/approved_css_stage_d_single_bundle_smoke.py: Chromium three + resolutions, exact one CSS request/CSSOM, PNG artwork and MUTE click. +- Stage C visual parity tests reconstruct the 18 original CSS links in a + TEST FIXTURE only, then check exact pixels/computed style, hover and + geometry against the one-bundle runtime. +- Historical V28 byte-exact source test, Stage A-B profiling, + no-new-CSS-stacking gates, Windows native JUCE/CTest and actual + First Sound/FX/WIRE control tests must all remain green. + +## Honest limitations + +**ONE loaded stylesheet does not mean ZERO duplicate declarations inside +the historic authored CSS.** Stage A+B counted 114 cross-owner and 252 +within-owner repeated selector/property combinations. The compiler +safely removes cascade losers; required fallbacks and locked artwork may +retain old declarations. No-new-stacking CI gates still apply. A source +rewrite needs separate explicit checkpoint migration and visual proof, +never a silent regeneration of historical acceptance checks. + +One fewer group of network requests is a structural improvement, not +proof that Windows GPU paint/input-to-photon p95/p99 improved. Keep issue +#56 open until measured on the affected Windows GPU. Neither headless CI +nor WebView2 compilation proves physical ASIO/WASAPI/VST3 FAT. + +## Operator capture + +Profiler default OFF. On the Windows EXE press Ctrl+Alt+Shift+F9 to +record 15 seconds, then record exact EXE SHA, GPU driver, DPI/refresh, +JS/native timing log and Edge/WebView2 paint trace. See Stage A +profiling operator instructions for the comparison matrix. From 5fc57b6baf98599c72ed4fd67383d48b0e5dcca9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:10:59 +0700 Subject: [PATCH 62/64] test(stage-d): permit secure file-scheme CSSOM rule inspection denial without hiding style load --- tests/approved_css_stage_d_single_bundle_smoke.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/approved_css_stage_d_single_bundle_smoke.py b/tests/approved_css_stage_d_single_bundle_smoke.py index 358c65f0f..c9d24c0d4 100644 --- a/tests/approved_css_stage_d_single_bundle_smoke.py +++ b/tests/approved_css_stage_d_single_bundle_smoke.py @@ -38,10 +38,14 @@ async def main(): image, display:root.display, keys:document.querySelectorAll(".mx-hw-key").length, - cssRules:sheets.length ? sheets[0].cssRules.length : 0}; + // file:// Playwright may block CSSOM rule inspection; + // stylesheet count and computed visuals remain valid. + cssRules:(() => {try{return sheets[0]?.cssRules.length??0} + catch{return null}})()}; }""") assert len(stats["links"]) == stats["count"] == 1, (size,stats) - assert stats["cssRules"] > 100, (size,stats) + if stats["cssRules"] is not None: + assert stats["cssRules"] > 100, (size,stats) assert stats["keys"] >= 3 and "mute-solo-pfl" in stats["image"], (size,stats) assert "arsonmix-approved-runtime.css?sha=" in stats["links"][0] assert len(css_requests) == 1, (size,css_requests) From a5a2ad9ba183ab171ed6e5ad40f6c0f3ad2b5812 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:13:44 +0700 Subject: [PATCH 63/64] fix(perf): sample actual AR MIX Studio and packaged GUI process, not only legacy ARMixConsole --- scripts/collect_gui_perf_windows.ps1 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/collect_gui_perf_windows.ps1 b/scripts/collect_gui_perf_windows.ps1 index 4d6a4619c..3a4ae370c 100644 --- a/scripts/collect_gui_perf_windows.ps1 +++ b/scripts/collect_gui_perf_windows.ps1 @@ -20,12 +20,22 @@ try { } catch { Write-Warning "GPU model/driver unavailable without CIM access; continue with process metrics." } +# The JUCE target is ARMixConsole, but PRODUCT_NAME makes the installed +# process "AR MIX Studio". The portable EXE is packaged under a separate name. +# Use process names from the actual build and, when supplied, the EXE name. +$hostNames = [System.Collections.Generic.HashSet[string]]::new( + [System.StringComparer]::OrdinalIgnoreCase) +foreach ($name in @("AR MIX Studio", "ArSonMix-GUI10CH-P012-Windows-x64", "ARMixConsole")) { + [void]$hostNames.Add($name) +} $sha = $null if ($ExePath) { if (-not (Test-Path -LiteralPath $ExePath -PathType Leaf)) { throw "EXE path was supplied but does not exist." } - $sha = (Get-FileHash -Algorithm SHA256 -LiteralPath $ExePath).Hash + $resolvedExe = (Resolve-Path -LiteralPath $ExePath).Path + $sha = (Get-FileHash -Algorithm SHA256 -LiteralPath $resolvedExe).Hash + [void]$hostNames.Add([System.IO.Path]::GetFileNameWithoutExtension($resolvedExe)) } $environment = [ordered]@{ schema = "arsonmix.windows-gui-process-sampling.v1" @@ -42,12 +52,15 @@ $environment = [ordered]@{ $environment | ConvertTo-Json -Depth 5 | Set-Content -Path (Join-Path $OutputDirectory "environment.json") -Encoding UTF8 $previous = @{} $rows = [System.Collections.Generic.List[object]]::new() +$hostSampleCount = 0 $steps = [math]::Ceiling($Seconds * 1000.0 / $IntervalMs) for ($i = 0; $i -lt $steps; $i++) { $now = Get-Date $processes = @(Get-Process -ErrorAction SilentlyContinue | - Where-Object { $_.ProcessName -match "^(ARMixConsole|msedgewebview2)$" }) + Where-Object { $hostNames.Contains($_.ProcessName) -or + $_.ProcessName -eq "msedgewebview2" }) foreach ($p in $processes) { + if ($hostNames.Contains($p.ProcessName)) { $hostSampleCount++ } $id = [string]$p.Id $cpu = [double]$p.CPU $delta = $null @@ -76,4 +89,9 @@ for ($i = 0; $i -lt $steps; $i++) { $out = Join-Path $OutputDirectory "process-timeline.csv" $rows | Export-Csv -Path $out -NoTypeInformation -Encoding UTF8 Write-Host "ArSonMix P0 process capture: $($rows.Count) samples -> $out" +if ($hostSampleCount -eq 0) { + Write-Warning "NO_NATIVE_GUI_HOST_SAMPLES: launch AR MIX Studio / packaged EXE before profiling; WebView2-only data cannot measure JUCE host CPU." +} else { + Write-Host "Native JUCE host samples: $hostSampleCount (AR MIX Studio or packaged EXE)." +} Write-Host "Pair with GUI_PERF_JS + GUI_PERF_NATIVE logs and WebView2 GPU trace for Issue #56." From ef73e0731fdc34093e65fe44e06b6db33931b128 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:31:23 +0700 Subject: [PATCH 64/64] ci(p0): publish exact-branch experimental Windows FAT ZIP after real native build and provenance verification --- .github/workflows/p1-windows.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 0fc70d68c..d3976eef7 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -139,31 +139,33 @@ jobs: - name: Test realtime control primitives run: ctest --test-dir build -C Release --output-on-failure - name: Package verified JUCE GUI for hardware FAT - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} shell: pwsh run: | & ./scripts/package_native_windows.ps1 -BuildDir build -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Stage ONLY legally approved and host-qualified Factory VST3 bundles - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} shell: pwsh run: | python scripts/factoryfx_release_bundle.py stage --lock config/factoryfx-approved-releases.json --output dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Independently verify release ZIP and embedded GUI/engine before upload - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} shell: pwsh run: | & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + # P0 PR #414 is the ONLY additional FAT candidate: physical mouse/GPU + # proof requires its exact Windows EXE, never a stable release. # Ordinary engine PRs compile/CTest without wasting package/ZIP work. # Release-integration PRs and main/manual runs package and verify, but never silently publish a stable release. # This single M4 FAT branch is explicitly allowed to upload an # UNQUALIFIED experimental ZIP for real physical hardware testing. - uses: actions/upload-artifact@v4 - if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} with: - name: ${{ github.event_name == 'pull_request' && 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} + name: ${{ github.event_name == 'pull_request' && github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' && 'ArSonMix-P0-EXPERIMENTAL-Pointer-Latency-FAT-Windows-x64' || github.event_name == 'pull_request' && 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} path: dist/ if-no-files-found: error retention-days: 14