Skip to content

refactor(mvvm): shipped native Device Setup VM, Apply ACK and readback lifecycle - #765

Merged
masarray merged 18 commits into
mainfrom
refactor/native-device-endpoint-vm-mv1-20261118
Nov 17, 2026
Merged

masarray merged 18 commits into
mainfrom
refactor/native-device-endpoint-vm-mv1-20261118

Conversation

@masarray

@masarray masarray commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Real native /preview/ Device I/O MVVM — endpoint projection + Apply/readback lifecycle

This one implementation PR extends the first MV-1 ViewModel pilot to the actual JUCE/WebView2 assembled /preview/ GUI, not the old web/mixer-io.js. It retains one native hardware/device/session/PCM authority.

What changed

  • web/approved-device-view-model.js is pure browser/Node presentation code. It projects only verified native input pins/output pairs and now owns the Device Setup lifecycle: IDLE, APPLYING, VERIFYING, ACCEPTED, REJECTED, STALE, TIMEOUT, RECOVERY_REQUIRED. Pending requests correlate by requestId. Successful ACK is not installed playback proof: later schema-v6 snapshot must match hardware endpoint, generation/epoch, masks, sample rate and buffer. Device-ready is differentiated from mixer-route-ready, and only an admitted native graph/output can be LIVE.
  • web/approved-native-bridge.js removes the old separate deviceBusy boolean, DOM dataset.pendingRequest, direct ACK-success acceptance and duplicated remap/pending result logic. The single existing arMixAction / audioDeviceApply transport and native NativeDeviceApplyCoordinator still execute the original request, identity validation, driver open, rollback and authorization. No duplicate dispatch.
  • scripts/build_approved_native_gui.py includes the one VM script before the bridge in the native ONLY bundle, preserving public assembled /preview/ and exact asset parity.
  • tests/approved_native_m2_contract.test.cjs covers positive accepted ACK+snapshot, physical identity/pin/rate, stale ACK/epoch/generation, negative ACK, driver refusal, timeout, device loss, restart, rollback, unadmitted device vs installed mixer, offline .smix state and single dispatcher.
  • tests/approved_native_cold_start_smoke.py covers the real assembled Chromium UI across ACK-only pending, later v6 readback, two-pin MAIN assignment and remap/recovery.
  • tests/approved_native_gui_bundle_test.py validates native-only injection and byte parity. tests/live_fader_held_drag.test.cjs was already part of the original MV-1 PR.

Preserved architecture

Read AGENTS.md, merged #763's docs/architecture/ADR_MODULAR_MVVM_FEASIBILITY_20261118.md and multi-device PRD/ARD. Native src/Main.cpp::applyCustomAudioDevice → existing src/NativeDeviceApplyCoordinator.h is the only physical primary device transaction and verified rollback; native schemaVersion=6, decimal ChannelId/EdgeId, generation/revision, .smix, primary direct ASIO and one PCM/VST3 graph remain intact. No C++/DSP, SonKu/ImmerSIB, FX Rack, GUI CSS/PNG or installer edits, no new FIFO/ASRC/driver, no thread locks or coordination barriers. Multi-device capture-only / output-only I/O is not implemented or hardware-qualified by this PR.

Verification (refresh exact HEAD before merge)

Latest audited head: c0a56a508e0279b5dabb07340bbad93f215260a7; base main 3c8dfd2ffeb31568bd34c5085c8972df9c16c8bd.

  • Fast Native Node/Python contracts PASS #44189608504
  • Fast UI PASS #44189608312
  • Fast release contracts PASS #44189608388
  • Required exact-head merge gate PASS #44189602389
  • Full native-assembled Chromium, owner-authorized exact-SHA IN PROGRESS #44189797846, not claimed PASS before confirmed.
  • Native MSVC / CTest NOT RUN because C++ unchanged; physical two-ASIO/installer FAT NOT RUN/PENDING. Not a new installed release.

Operator report

HASIL: Native Device Setup pending/negative/stale/timeout and readback acceptance are now pure testable presentation state, with legacy responsibility removed from bridge.
STATUS: KODE DIUJI; PR DRAFT/OPEN, NOT MERGED, no installer. AMAN DIPAKAI? Source regression fast PASS; BELUM hardware-qualified for an installed build.
TINDAKAN ANDA: TIDAK PERLU MELAKUKAN APA-APA.
BUKTI: exact HEAD and CI links above.
LANGKAH BERIKUTNYA: Wait for exact-SHA Chromium result, fix any real test defects, reconcile actual concurrent Git changes then mark ready for review/merge only after required gates. Later Multi-Device I/O remains distinct physical FAT.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Deploying arsonmix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5d6ec4a
Status: ✅  Deploy successful!
Preview URL: https://4c783b39.arsonmix.pages.dev
Branch Preview URL: https://refactor-native-device-endpo.arsonmix.pages.dev

View logs

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui 64d3a53

Copy link
Copy Markdown
Owner Author

CHECKPOINT MV-1 — 18 November 2026 — user-facing task report

HASIL: Implementasi pertama modular MVVM untuk GUI native /preview/ selesai dalam source PR #765. Pure web/approved-device-view-model.js sekarang memproyeksikan hardware input choices, output ASIO pairs, dan output status hanya dari accepted JUCE readback. Bridge lama berkurang ~57 baris bersih; hardware output command/ACK, session, DSP, FX, fader, GUI CSS/PNG tidak diubah. Native bundle secara deterministik menyisipkan modul baru sebelum bridge; public /preview/ identik.

STATUS: KODE DIUJI, PR masih DRAFT dan BELUM MERGED. Exact PR HEAD 64d3a53bf674519b32002738bf2aa0c88580eee4, base main@3c8dfd2ffeb31568bd34c5085c8972df9c16c8bd. Fast native PASS #44182129818 termasuk 4 VM regression tests dan 3 native GUI bundler tests; fast UI PASS #44182129826; release contracts PASS #44182129813. Full UI/Chromium milestone #44182513657 telah dipicu satu kali via CI dispatcher dan MASIH BERJALAN pada pemeriksaan terakhir (tidak ada failure pada step yang selesai saat itu). Required CI merge status PENDING selama full UI belum selesai.

AMAN DIPAKAI? Belum ada installer dari PR ini; belum termasuk dukungan Multi-Device I/O atau audio driver baru. Windows MSVC, vendor physical ASIO, acoustic FAT: NOT RUN / NOT APPLICABLE untuk perubahan presentasi ini.

TINDAKAN ANDA: TIDAK PERLU MELAKUKAN APA-APA. Jangan mengganti konfigurasi audio interface atau mengunduh installer lama untuk menguji fitur multi-device yang belum tersedia.

LANGKAH THREAD BERIKUTNYA (tanpa ownership lock): 1) Audit status FULL UI run #44182513657, required exact-head CI, HEAD PR #765 dan latest main. 2) Bila lengkap PASS, pertimbangkan ready/merge PR dengan expected-head SHA setelah diff/nonregression review; jika FAIL perbaiki akar penyebab pada PR ini. 3) Lanjutkan native Device Setup Apply/pending/ACK/reject/stale readback lifecycle sebagai MVVM tahap berikutnya, memakai existing NativeDeviceApplyCoordinator, existing schemaVersion=6, dan approved /preview/; jangan mengerjakan web/mixer-io.js retired GUI. 4) Multi-Device I/O capture-only tetap milestone terpisah berdasarkan ADR merged #763. Jangan mengklaim hardware FAT dari GUI test.

Handoff source: docs/architecture/ADR_MODULAR_MVVM_FEASIBILITY_20261118.md + docs/ARD_ARSONMIX_MULTI_DEVICE_IO_V2_20261118.md; no file/domain locks, tests only actual product safety.

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui b9b428a

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui b40281e

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui 1e3ecf4

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui c0a56a5

Copy link
Copy Markdown
Owner Author

Device Setup MVVM continuation — 2026-11-18

HASIL: Continued this same implementation PR (#765), on the real bundled native /preview/ GUI. The existing web/approved-device-view-model.js now owns the presentation-only Apply state machine (IDLE → APPLYING → VERIFYING → ACCEPTED/REJECTED/STALE/TIMEOUT/RECOVERY_REQUIRED); web/approved-native-bridge.js removed the prior parallel deviceBusy, pending DOM request attribute and ACK-only success calculation. A native audioDeviceApply ACK alone does not announce LIVE; a later schema-v6 snapshot must prove actual endpoint, pins, rate/buffer, epoch/generation and sound state. An open verified device may be reported ready with the mixer route not yet verified, without fabricating graph admission. Timeouts request fresh inventory; no blind device reopen.

IMPLEMENTATION PATH: approved-native-bridge.js → existing single arMixAction: audioDeviceApply → src/Main.cpp::applyCustomAudioDevice → existing NativeDeviceApplyCoordinator native readback/rollback → later arMixConsoleSnapshot → pure Device Setup VM. No C++/ASIO/PCM/VST3/session .smix, DSP, SonKu/ImmerSIB, FX Rack, installer, or approved CSS/PNG changed. No second dispatcher, mixer or thread ownership gate; no dual-ASIO claim. Existing schemaVersion=6, ChannelId/EdgeId, primary direct ASIO retained.

STATUS: KODE DIUJI, PR remains DRAFT/OPEN; NOT MERGED, no new installer, no real audio-interface test.
BUKTI exact HEAD: c0a56a508e0279b5dabb07340bbad93f215260a7; main@3c8dfd2ffeb31568bd34c5085c8972df9c16c8bd. Fast native Node/Python PASS #44189608504; Fast UI PASS #44189608312; release fast PASS #44189608388; required merge gate PASS #44189602389. Full Chromium dispatched by /arsonmix-ci ui c0a56a508e0279b5dabb07340bbad93f215260a7 (run awaiting outcome); PENDING, not claimed PASS. MSVC/native CTest NOT RUN (no C++ diff); physical FAT PENDING.

AMAN DIPAKAI? Code-level contracts PASS; BELUM qualified as a new installed build/hardware result.
TINDAKAN ANDA: TIDAK PERLU MELAKUKAN APA-APA.
LANGKAH BERIKUTNYA: Verify exact-SHA full Chromium (and current required checks), reconcile any genuine concurrent HEAD movement and only then mark ready/merge if branch rules allow. Future multi-device requires separate capture/output adapter and physical FAT; one DSP renderer only.

@masarray masarray changed the title refactor(mvvm): extract approved native Device I/O ViewModel + bundle/readback tests refactor(mvvm): shipped native Device Setup VM, Apply ACK and readback lifecycle Nov 17, 2026
@masarray
masarray marked this pull request as ready for review November 17, 2026 22:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T22:36:59.335808Z c0a56a5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Owner Author

Independent source audit — 18 November 2026, exact PR HEAD c0a56a508e0279b5dabb07340bbad93f215260a7

Verdict: MVVM GUI is on the correct product path: the compiled native /preview/ bundle loads web/approved-device-view-model.js, and setupBegin → arMixAction/audioDeviceApply → setupAck → setupReadback is now really connected to web/approved-native-bridge.js. The existing JUCE control-owned NativeDeviceApplyCoordinator and single DSP/PCM renderer are preserved. This is a useful extraction, not a second mixer. Fast UI/native and full exact-head Chromium run #44189797846 PASS. No native/ASIO/installer/physical FAT inference.

Important reproducible lifecycle gap (test before declaring complete): The ViewModel uses two counter domains in its snapshot freshness check: setupReadback() tests BigInt(snapshot.device.epoch) < BigInt(pending.ack.active.deviceGeneration); Main.cpp::currentDeviceSnapshot() sets deviceGeneration from engine_.status().deviceGeneration (deviceStartCount), while ApprovedNativeRuntimeSnapshot::synchronizeApprovedRouteDeviceEpoch() uses LiveDryRoutingLab routing epoch (advances on STOP as well as START). These counters can differ. The ViewModel only rejects snapshot epoch lower than baselineEpoch, not a duplicate same-epoch snapshot.

A deterministic source-level counterexample:

  • Pre-Apply accepted routing epoch = "40", JUCE generation = 3; apply the same ASIO endpoint, 48k/256, identical enabled pins.
  • Matching ACCEPTED_MUTED ACK returns generation = 4.
  • Feed a still-old normalized schema-v6 snapshot with epoch "40", same endpoint/rate/pins after that ACK. setupReadback returns phase:"ACCEPTED" even though snapshot has no evidence of a post-Apply physical generation or new installed route.
    This is an isolated VM replay, not proof that an actual driver fails. Nevertheless it contradicts the stated 'ACK + independent installed readback' guarantee in the presence of delayed/duplicate snapshots. Existing tests predominantly use epoch 12→13 alongside generation 12→13 and do not exercise divergent counters + duplicate old snapshot.

Required engineering next step (ordinary product safety, NOT owner/thread lock): Add a native-contract regression for different epoch vs JUCE generation and delayed/duplicate same-epoch snapshots. Correlate success with actual post-Apply readback provenance from the native coordinator (generation/transaction identity or other measured accepted evidence), not numerical comparison of unrelated counters or merely the order a snapshot arrives. Preserve current console-v8 schema/approved HTML unless a backward-compatible field is genuinely necessary; never accept an ACK alone, auto-arm speakers, or duplicate Apply/PCM owners. Do not paper over it by weakening the test. Recheck latest main after #760 installer/FAT merge (main advanced from 3c8dfd2 to 42841dc9 while this PR was open), run exact-head relevant UI/native/bundle tests, then merge if verified.

Operator impact: PR remains NOT MERGED and has NO newly installed multi-device binary. No owner action required. Multi-Device engine implementation is a separate workstream, free to proceed independently. This comment is an evidence-backed review, NOT a new GitHub admission/ownership gate.

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui 5d6ec4a

@masarray
masarray merged commit c8fd3a8 into main Nov 17, 2026
30 checks passed

Copy link
Copy Markdown
Owner Author

MILESTONE MV-1 — FINAL / MERGED (18 November 2026)

HASIL

  • Device Setup ViewModel pada GUI native /preview/ terhubung nyata: setupBegin, setupAck, setupReadback, setupTimeout, setupClearResult. Tetap memakai satu arMixAction dispatcher, NativeDeviceApplyCoordinator, dan native schema-v6 authoritative snapshot.
  • ACK sukses saja tidak menutup Audio I/O; readback harus cocok. Epoch snapshot yang mendahului device-generation ACK ditolak. Hardware READY dibedakan dari ChannelId PCM LIVE, sehingga G0/M4 tidak tersangkut timeout saat perangkat fisik valid.
  • Perubahan tidak menyentuh C++ JUCE, DSP, SonKu/ImmerSIB, PCM graph, VST3 audio processing, atau session .smix.
  • Rekonsiliasi main dari thread lain melalui merge dua parent tanpa force, 0 file overlap.

BUKTI MAINTAINABILITY

  • web/approved-native-bridge.js: 4.283 → 4.228 baris (-55). Lima tanggung jawab/pola lama dipindahkan/dihapus dari bridge: deviceResult, offeredPinRemap, DOM pendingRequest, pembuatan request Device Apply, dan keputusan sukses berdasarkan ACK.
  • Pure ViewModel baru 225 baris; 5 tes lifecycle Device Setup + 4 tes proyeksi MVVM dapat dieksekusi tanpa ASIO/JUCE.
  • Contoh perubahan aturan stale generation cukup 2 file (ViewModel + tes murni), 0 file native C++ dan 0 perubahan dispatcher. Untuk kasus G0/readback: 3 file (VM + pure test + Chromium smoke). Ini bukti perubahan lokal; bukan klaim seluruh aplikasi sudah MVVM.
  • Regresi ditangani: premature ACK-only acceptance di smoke lama, stale readback tampak valid, dan G0 hardware valid terkunci di VERIFYING akibat syarat ChannelId PCM berlebihan.

STATUS MERGED — PR #765; main merge SHA c8fd3a8480b4dac485ff0636caf41f52603883c3, PR head terkualifikasi 5d6ec4a603d0888b4c2942e40d8158fa08840b24.

AMAN DIPAKAI Aman untuk integrasi source/CI. Belum diklaim lolos physical ASIO/WASAPI FAT atau installer baru. Tidak ada perubahan DSP.

TINDAKAN SAYA Tidak perlu merge/cherry-pick/manual ruleset. Pengujian perangkat fisik Audio I/O + .smix pada build Windows berikutnya tetap perlu.

BUKTI PR/SHA/CI

BERIKUTNYA Evaluasi MV-2 berdasarkan satu perubahan fitur Device Setup nyata, metrik jumlah file touch dan tes isolasi; integrasi Multi-Device tetap milik thread I/O, tanpa dispatcher/per-device graph kedua.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant