From 578de8f044cae5bf20259f6c7af921f561b5d321 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:52:17 +0700 Subject: [PATCH 01/52] Inno Setup: gracefully close running mixer, upgrade in-place and auto-launch once --- installer/ArSonMix.iss | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index ed7999f29..f63bc7747 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -1,4 +1,5 @@ -; ArSonMix x64 RC from exact independently verified FAT app, no new DSP or GUI. +; ArSonMix x64 per-user Inno Setup: safe in-place upgrade + single launch. +; Exact independently verified FAT app; no new DSP or GUI. #ifndef SourceRoot #error "Supply /DSourceRoot with SHA-verified staging directory" #endif @@ -25,7 +26,17 @@ SetupIconFile={#SourceRoot}\arsonmix-app.ico UninstallDisplayIcon={app}\ArSonMix.exe Compression=lzma2 SolidCompression=yes -CloseApplications=no +UsePreviousAppDir=yes +DisableWelcomePage=yes +DisableDirPage=yes +DisableReadyPage=yes +DisableFinishedPage=yes +SetupMutex=ArSonMix.PerUserInstaller.SingleInstance +; Windows Restart Manager asks the running ArSonMix to close normally, +; invoking JUCE shutdown/session persistence before any executable is replaced. +; Never force-kill an audio session or restart an old process beside the new one. +CloseApplications=yes +CloseApplicationsFilter=ArSonMix.exe RestartApplications=no [Files] Source: "{#SourceRoot}\verified-gui.exe"; DestDir: "{app}"; DestName: "ArSonMix.exe"; Flags: ignoreversion @@ -34,5 +45,12 @@ Source: "{#SourceRoot}\README.md"; DestDir: "{app}"; Flags: ignoreversion Source: "{#SourceRoot}\FactoryFX\*"; DestDir: "{app}\FactoryFX"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist [Icons] Name: "{autoprograms}\ArSonMix"; Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}" -; No Run or UninstallDelete: do not auto-activate live audio or erase -; AppData Studio. Do not install portable_mode.txt. +; Do not create a second copy of an already running mixer. Restart Manager +; closes the prior verified app before [Files], while [Run] launches exactly +; one new executable only after a successful interactive install/update. +; Silent enterprise/FAT installs deliberately do not launch desktop audio. +[Run] +Filename: "{app}\\ArSonMix.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginaluser skipifsilent + +; Never delete private Studio data on install/update/uninstall; never install +; portable_mode.txt or silently ARM an audio output. From 5e749508136c06346efcca00c536c58075afeaf8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:52:32 +0700 Subject: [PATCH 02/52] Add real Windows WM_CLOSE fixture to validate in-place installer update --- tests/fixtures/installer_graceful_close.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/fixtures/installer_graceful_close.cs diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs new file mode 100644 index 000000000..5c4ae8eee --- /dev/null +++ b/tests/fixtures/installer_graceful_close.cs @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Windows FAT-only test double for the installed ArSonMix.exe. +// Deliberately no JUCE / ASIO / live audio and never shipped in the installer. +// Windows Restart Manager must request WM_CLOSE rather than force-terminate it. +using System; +using System.IO; +using System.Windows.Forms; + +internal static class ArSonMixInstallerGracefulCloseFixture +{ + [STAThread] + private static void Main(string[] args) + { + if (args.Length != 2) + Environment.Exit(22); + + using (var window = new Form()) + { + window.Text = "ArSonMix Upgrade Graceful-Close FAT Fixture"; + window.Width = 420; + window.Height = 120; + window.ShowInTaskbar = false; + window.Shown += (sender, e) => File.WriteAllText(args[0], "WINDOW_READY"); + window.FormClosing += (sender, e) => + File.WriteAllText(args[1], "WM_CLOSE_SAVED"); + Application.Run(window); + } + } +} From ee6463b743bb10e8b7565fe8d8ffacd4bbb5b192 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:53:31 +0700 Subject: [PATCH 03/52] Windows FAT: exercise running-app graceful WM_CLOSE and verified in-place Inno update --- scripts/build_verify_windows_installer.ps1 | 65 +++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index 6cfab9f11..ff027fea9 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -26,6 +26,9 @@ $studio=Join-Path $env:APPDATA "AR-MIX-Studio" New-Item -ItemType Directory -Force -Path $studio | Out-Null $sentinel=Join-Path $studio ("installer-test-"+[guid]::NewGuid().ToString("N")+".keep") "persistent-private-data" | Set-Content -LiteralPath $sentinel +$fixtureReady=Join-Path $env:RUNNER_TEMP ("arsonmix-fixture-ready-"+[guid]::NewGuid().ToString("N")) +$fixtureClosed=Join-Path $env:RUNNER_TEMP ("arsonmix-fixture-closed-"+[guid]::NewGuid().ToString("N")) +$fixtureProcess=$null try { New-Item -ItemType Directory -Force -Path $stage | Out-Null Copy-Item -LiteralPath $exe -Destination (Join-Path $stage "verified-gui.exe") @@ -53,6 +56,51 @@ try { } $installedManifest=Get-Content -LiteralPath (Join-Path $install "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json if($installedManifest.sourceCommit -ne $sha){throw "Wrong installed provenance"} + # REAL Windows in-place UPDATE test: replace the *test-installed* PE + # with a harmless WinForms window. Installer must ask it to WM_CLOSE, + # observe the graceful close marker, replace its running .exe with the + # verified FAT PE and preserve private Studio plus unknown user files. + # This never replaces the source FAT executable or touches a user install. + $csc=Join-Path $env:WINDIR "Microsoft.NET\\Framework\\v4.0.30319\\csc.exe" + $fixtureSource=Join-Path $root "tests\\fixtures\\installer_graceful_close.cs" + if(-not (Test-Path -LiteralPath $csc -PathType Leaf) -or + -not (Test-Path -LiteralPath $fixtureSource -PathType Leaf)){ + throw "Windows Framework C# compiler or WM_CLOSE fixture missing" + } + & $csc "/nologo" "/target:winexe" "/reference:System.Windows.Forms.dll" "/out:$installedExe" $fixtureSource + if($LASTEXITCODE -ne 0){throw "Cannot prepare graceful-close test window"} + $fixtureProcess=Start-Process -FilePath $installedExe -ArgumentList @( + ('"' + $fixtureReady + '"'), ('"' + $fixtureClosed + '"') + ) -PassThru + for($i=0;$i -lt 75 -and -not (Test-Path -LiteralPath $fixtureReady);$i++){ + $fixtureProcess.Refresh() + if($fixtureProcess.HasExited){break} + Start-Sleep -Milliseconds 200 + } + if(-not (Test-Path -LiteralPath $fixtureReady)){ + throw "Installed upgrade fixture did not show its Windows message-loop window" + } + $installSentinel=Join-Path $install "arsonmix-user-file.keep" + "preserve-user-files-across-upgrade" | Set-Content -LiteralPath $installSentinel + $upgradeLog=Join-Path $env:RUNNER_TEMP ("arsonmix-upgrade-"+[guid]::NewGuid().ToString("N")+".log") + $upgrade=Start-Process -FilePath $setup -ArgumentList @( + "/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER", + "/CLOSEAPPLICATIONS","/NOFORCECLOSEAPPLICATIONS", + "/DIR=$install",('/LOG="' + $upgradeLog + '"') + ) -Wait -PassThru + $fixtureProcess.Refresh() + if($upgrade.ExitCode -ne 0 -or -not $fixtureProcess.HasExited -or + -not (Test-Path -LiteralPath $fixtureClosed) -or + (Get-Content -LiteralPath $fixtureClosed -Raw).Trim() -ne "WM_CLOSE_SAVED"){ + throw "In-place update did not gracefully close the running ArSonMix fixture (see $upgradeLog)" + } + if((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() -ne $appHash -or + -not (Test-Path -LiteralPath $installSentinel) -or + -not (Test-Path -LiteralPath $sentinel) -or + (Test-Path -LiteralPath (Join-Path $install "portable_mode.txt"))){ + throw "In-place update failed verified EXE replacement or data preservation" + } + Write-Host "INNO_GRACEFUL_UPDATE_PASS: running app WM_CLOSE, verified PE replacement, user files preserved" $uninstall=Join-Path $install "unins000.exe" if(-not (Test-Path -LiteralPath $uninstall -PathType Leaf)){throw "Uninstaller missing"} $stop=Start-Process -FilePath $uninstall -ArgumentList @( @@ -65,11 +113,26 @@ try { sourceCommit=$sha;guiSha256=$appHash installerSha256=(Get-FileHash -LiteralPath $setup -Algorithm SHA256).Hash.ToLowerInvariant() certification="UNSIGNED_HARDWARE_FAT_PENDING";mode="PER_USER_NO_AUTOARM" + updaterTest="WM_CLOSE_IN_PLACE_SHA256_AND_USER_DATA_PRESERVED" } | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $out "INSTALLER_PROVENANCE.json") -Encoding UTF8 - Write-Host "INSTALLER_RC_VERIFIED: SHA-matched PE, install/uninstall, private Studio intact" + Write-Host "INSTALLER_RC_VERIFIED: first install, graceful running-app update, SHA-matched PE, uninstall, private Studio intact" Write-Host "PHYSICAL_FAT_PENDING" } finally { + # Only a failing *test fixture* may be terminated in CI teardown. + # Production Inno Setup never force-kills the user's audio application. + if($null -ne $fixtureProcess){ + try{ + $fixtureProcess.Refresh() + if(-not $fixtureProcess.HasExited){ + Stop-Process -Id $fixtureProcess.Id -Force -ErrorAction SilentlyContinue + } + }catch{} + $fixtureProcess.Dispose() + } + foreach($marker in @($fixtureReady,$fixtureClosed)){ + if(Test-Path -LiteralPath $marker){Remove-Item -LiteralPath $marker -Force} + } if(Test-Path -LiteralPath $sentinel){Remove-Item -LiteralPath $sentinel -Force} if(Test-Path -LiteralPath $stage){Remove-Item -LiteralPath $stage -Recurse -Force} if(Test-Path -LiteralPath $install){Remove-Item -LiteralPath $install -Recurse -Force -ErrorAction SilentlyContinue} From 926b7230a22dfb1f2c19a314baaa433b69c313dc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:54:10 +0700 Subject: [PATCH 04/52] Normalize WinForms compiler and fixture paths for Windows CI --- scripts/build_verify_windows_installer.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index ff027fea9..6bd858fad 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -61,8 +61,8 @@ try { # observe the graceful close marker, replace its running .exe with the # verified FAT PE and preserve private Studio plus unknown user files. # This never replaces the source FAT executable or touches a user install. - $csc=Join-Path $env:WINDIR "Microsoft.NET\\Framework\\v4.0.30319\\csc.exe" - $fixtureSource=Join-Path $root "tests\\fixtures\\installer_graceful_close.cs" + $csc=Join-Path $env:WINDIR "Microsoft.NET\Framework\v4.0.30319\csc.exe" + $fixtureSource=Join-Path $root "tests\fixtures\installer_graceful_close.cs" if(-not (Test-Path -LiteralPath $csc -PathType Leaf) -or -not (Test-Path -LiteralPath $fixtureSource -PathType Leaf)){ throw "Windows Framework C# compiler or WM_CLOSE fixture missing" From 11cdf020a969fafa6422be87e849e08fa2c05a41 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:54:36 +0700 Subject: [PATCH 05/52] Test Inno smart upgrade, graceful close, single auto-launch and data preservation --- tests/windows_installer_contract_test.mjs | 91 ++++++++++++++++++----- 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index cefe9ee4b..f60e5ed69 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -1,24 +1,77 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; -const read=p=>readFileSync(p,'utf8'); -const iss=read('installer/ArSonMix.iss'); -const ps=read('scripts/build_verify_windows_installer.ps1'); -const ci=read('.github/workflows/p1-windows.yml'); -test('Inno RC is per-user, 64-bit, no automatic activation or Studio deletion',()=>{ - for(const item of ['PrivilegesRequired=lowest','DefaultDirName={localappdata}', - 'ArchitecturesAllowed=x64compatible','CloseApplications=no','RestartApplications=no', - 'UNQUALIFIED','verified-gui.exe','BUILD_PROVENANCE.json']) assert.ok(iss.includes(item),item); - assert.doesNotMatch(iss,/^\[(Run|UninstallDelete)\]/m); - assert.doesNotMatch(iss,/^Source:.*portable_mode\.txt/m); + +const read = path => readFileSync(path, 'utf8'); +const iss = read('installer/ArSonMix.iss'); +const ps = read('scripts/build_verify_windows_installer.ps1'); +const fixture = read('tests/fixtures/installer_graceful_close.cs'); +const ci = read('.github/workflows/p1-windows.yml'); + +test('per-user Inno Setup upgrades the same app and retains private Studio data', () => { + for (const item of [ + 'AppId=ArSonMix.LiveStudio', 'PrivilegesRequired=lowest', + 'DefaultDirName={localappdata}', 'UsePreviousAppDir=yes', + 'ArchitecturesAllowed=x64compatible', 'MinVersion=10.0.17763', + 'DisableWelcomePage=yes', 'DisableDirPage=yes', + 'DisableReadyPage=yes', 'DisableFinishedPage=yes', + 'SetupMutex=ArSonMix.PerUserInstaller.SingleInstance', + 'UNQUALIFIED', 'verified-gui.exe', 'BUILD_PROVENANCE.json' + ]) assert.ok(iss.includes(item), item); + + assert.doesNotMatch(iss, /^\[UninstallDelete\]/m); + assert.doesNotMatch(iss, /^Source:.*portable_mode\.txt/m); + assert.doesNotMatch(iss, /taskkill|Stop-Process|TerminateProcess|CloseApplications=force/i); + assert.match(iss, /Name: "\{autoprograms\}\\ArSonMix"/); + assert.match(iss, /FactoryFX\\\*.*skipifsourcedoesntexist/); }); -test('installer only derives from verified FAT PE and tests uninstall safely',()=>{ - for(const item of ['manifest.sourceCommit','manifest.exeSha256','manifest.fatStatus', - 'assets/icon/arsonmix-app.ico','FactoryFX','Start-Process -FilePath $setup', - 'Start-Process -FilePath $uninstall','Test-Path -LiteralPath $sentinel', - 'PHYSICAL_FAT_PENDING','INSTALLER_PROVENANCE.json'])assert.ok(ps.includes(item),item); - const verifyStep=ci.indexOf(' - name: Independently verify release ZIP and embedded GUI/engine before upload'); - const installerStep=ci.indexOf(' - name: Compile and validate per-user Windows RC installer from exact FAT PE'); - assert.ok(verifyStep>=0 && installerStep>verifyStep); - assert.match(ci,/ArSonMix-Windows-Installer-UNQUALIFIED/); + +test('Restart Manager requests graceful shutdown, not data-loss force-close', () => { + assert.match(iss, /^CloseApplications=yes$/m); + assert.match(iss, /^CloseApplicationsFilter=ArSonMix\.exe$/m); + assert.match(iss, /^RestartApplications=no$/m); + // Never prevent upgrades while the mixer is open: no AppMutex. + assert.doesNotMatch(iss, /^AppMutex=/m); + assert.match(iss, /Source: "\{#SourceRoot\}\\verified-gui\.exe"; DestDir: "\{app\}"; DestName: "ArSonMix\.exe"/); +}); + +test('successful interactive install or update launches exactly one new mixer', () => { + assert.equal((iss.match(/^\[Run\]$/gm) ?? []).length, 1); + assert.equal((iss.match(/^Filename: "\{app\}\\ArSonMix\.exe"/gm) ?? []).length, 1); + const runLine = iss.split('\n').find(s => s.startsWith('Filename: "{app}\\ArSonMix.exe"')); + assert.ok(runLine, '[Run] must invoke the installed mixer'); + for (const flag of ['nowait', 'runasoriginaluser', 'skipifsilent']) { + assert.ok(runLine.includes(flag), flag); + } + assert.doesNotMatch(runLine, /\bpostinstall\b|\brunhidden\b/); + // Interactive: launch immediately when installation completes, not a checkbox. + // Silent enterprise/CI installs: never open an audio device in Session 0. + assert.match(iss, /^DisableFinishedPage=yes$/m); + assert.match(iss, /^RestartApplications=no$/m); +}); + +test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test mixer is running', () => { + for (const item of [ + 'manifest.sourceCommit', 'manifest.exeSha256', 'manifest.fatStatus', + 'assets/icon/arsonmix-app.ico', 'FactoryFX', + 'Start-Process -FilePath $setup', 'Start-Process -FilePath $installedExe', + 'installer_graceful_close.cs', 'WM_CLOSE_SAVED', 'WINDOW_READY', + '/CLOSEAPPLICATIONS', '/NOFORCECLOSEAPPLICATIONS', + 'INNO_GRACEFUL_UPDATE_PASS', 'Test-Path -LiteralPath $installSentinel', + 'Test-Path -LiteralPath $sentinel', 'INSTALLER_PROVENANCE.json', + 'PHYSICAL_FAT_PENDING' + ]) assert.ok((ps + fixture).includes(item), item); + assert.equal((ps.match(/Start-Process -FilePath \$setup/g) ?? []).length, 2); + assert.match(fixture, /FormClosing/); + assert.match(fixture, /Application\.Run\(window\)/); + // No fixture is packaged: only the verified native EXE ships. + assert.doesNotMatch(iss, /installer_graceful_close|\.cs"/); +}); + +test('installer packaging is gated by the exact SHA FAT verifier', () => { + const verify = ci.indexOf(' - name: Independently verify release ZIP and embedded GUI/engine before upload'); + const installer = ci.indexOf(' - name: Compile and validate per-user Windows RC installer from exact FAT PE'); + assert.ok(verify >= 0 && installer > verify); + assert.match(ci, /ArSonMix-Windows-Installer-UNQUALIFIED/); + assert.match(ci, /tests\/windows_installer_contract_test\.mjs/); }); From 2380c83a4ec6bb4e87393c92cf403bf4a393c6dc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:56:02 +0700 Subject: [PATCH 06/52] Read installer version from verified CMake source rather than stale 0.1.0 hardcode --- installer/ArSonMix.iss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index f63bc7747..5a1c6ab99 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -6,11 +6,14 @@ #ifndef OutputRoot #error "Supply /DOutputRoot with destination directory" #endif +#ifndef SourceAppVersion + #error "Supply /DSourceAppVersion from the authoritative CMake project version" +#endif [Setup] AppId=ArSonMix.LiveStudio AppName=ArSonMix -AppVersion=0.1.0-rc.1 -AppVerName=ArSonMix RC (hardware FAT pending) +AppVersion={#SourceAppVersion} +AppVerName=ArSonMix {#SourceAppVersion} RC (hardware FAT pending) AppPublisher=ArSonMix AppPublisherURL=https://masarray.github.io/arsonmix/ DefaultDirName={localappdata}\Programs\ArSonMix From 2be519b98fcea98d15162a5d608a3fd59ea591c5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:56:16 +0700 Subject: [PATCH 07/52] Pass authoritative native CMake 0.5.0 version into the Inno Setup compiler --- scripts/build_verify_windows_installer.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index 6bd858fad..651fef742 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -18,6 +18,12 @@ $which=Get-Command ISCC.exe -ErrorAction SilentlyContinue $iscc=if($which){$which.Source}else{"C:\Program Files (x86)\Inno Setup 6\ISCC.exe"} if(-not (Test-Path -LiteralPath $iscc -PathType Leaf)){throw "Inno Setup 6 compiler missing"} $root=(Resolve-Path .).Path +# One authoritative product version: CMake native app and Inno Add/Remove Programs. +$cmake=(Get-Content -LiteralPath (Join-Path $root "CMakeLists.txt") -Raw -Encoding UTF8) +if($cmake -notmatch '(?m)^project\(ARMixConsole VERSION ([0-9]+\.[0-9]+\.[0-9]+) LANGUAGES'){ + throw "Installer version does not match the native CMake project" +} +$appVersion=$Matches[1] $out=Join-Path $root $InstallerOutput New-Item -ItemType Directory -Force -Path $out | Out-Null $stage=Join-Path $env:RUNNER_TEMP ("arsonmix-install-stage-"+[guid]::NewGuid().ToString("N")) @@ -40,7 +46,7 @@ try { if(Test-Path -LiteralPath $factory -PathType Container){ Copy-Item -LiteralPath $factory -Destination (Join-Path $stage "FactoryFX") -Recurse } - & $iscc "/Qp" "/DSourceRoot=$stage" "/DOutputRoot=$out" "installer/ArSonMix.iss" + & $iscc "/Qp" "/DSourceRoot=$stage" "/DOutputRoot=$out" "/DSourceAppVersion=$appVersion" "installer/ArSonMix.iss" $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-UNQUALIFIED.exe" if($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $setup -PathType Leaf) -or (Get-Item -LiteralPath $setup).Length -lt 2MB){throw "ISCC failed to build installer RC"} @@ -110,7 +116,7 @@ try { throw "Uninstaller failed or erased user Studio data" } [ordered]@{ - sourceCommit=$sha;guiSha256=$appHash + sourceCommit=$sha;appVersion=$appVersion;guiSha256=$appHash installerSha256=(Get-FileHash -LiteralPath $setup -Algorithm SHA256).Hash.ToLowerInvariant() certification="UNSIGNED_HARDWARE_FAT_PENDING";mode="PER_USER_NO_AUTOARM" updaterTest="WM_CLOSE_IN_PLACE_SHA256_AND_USER_DATA_PRESERVED" From 35b11d180aad039d2250d8504f62ba3455b786ee Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:56:29 +0700 Subject: [PATCH 08/52] Assert installer displays CMake-authoritative release candidate version --- tests/windows_installer_contract_test.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index f60e5ed69..ec7b93fe0 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -11,6 +11,7 @@ const ci = read('.github/workflows/p1-windows.yml'); test('per-user Inno Setup upgrades the same app and retains private Studio data', () => { for (const item of [ 'AppId=ArSonMix.LiveStudio', 'PrivilegesRequired=lowest', + 'AppVersion={#SourceAppVersion}', 'AppVerName=ArSonMix {#SourceAppVersion}', 'DefaultDirName={localappdata}', 'UsePreviousAppDir=yes', 'ArchitecturesAllowed=x64compatible', 'MinVersion=10.0.17763', 'DisableWelcomePage=yes', 'DisableDirPage=yes', @@ -53,6 +54,7 @@ test('successful interactive install or update launches exactly one new mixer', test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test mixer is running', () => { for (const item of [ 'manifest.sourceCommit', 'manifest.exeSha256', 'manifest.fatStatus', + '/DSourceAppVersion=$appVersion', 'project\\(ARMixConsole VERSION', 'assets/icon/arsonmix-app.ico', 'FactoryFX', 'Start-Process -FilePath $setup', 'Start-Process -FilePath $installedExe', 'installer_graceful_close.cs', 'WM_CLOSE_SAVED', 'WINDOW_READY', From c03f3d210c3d9fa9ab0ce745d8ad393b3cb26104 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:56:44 +0700 Subject: [PATCH 09/52] Watch installer WM_CLOSE fixture changes in native CI path selection --- .github/workflows/p1-windows.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 0c8aa9410..f35da209b 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -29,6 +29,7 @@ on: - 'scripts/build_verify_windows_installer.ps1' - 'installer/**' - 'tests/windows_installer_contract_test.mjs' + - 'tests/fixtures/installer_graceful_close.cs' - 'scripts/verify_native_windows_artifact.ps1' - 'scripts/collect_hardware_fat_windows.ps1' - 'scripts/console_v6_fat_gate.mjs' @@ -70,6 +71,7 @@ on: - 'scripts/build_verify_windows_installer.ps1' - 'installer/**' - 'tests/windows_installer_contract_test.mjs' + - 'tests/fixtures/installer_graceful_close.cs' - 'scripts/verify_native_windows_artifact.ps1' - 'scripts/collect_hardware_fat_windows.ps1' - 'scripts/console_v6_fat_gate.mjs' From 1782151d9db6c67c1704359333d6ae03028c47fb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 02:58:16 +0700 Subject: [PATCH 10/52] Use canonical one-separator installed executable path for Inno auto-launch --- installer/ArSonMix.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index 5a1c6ab99..e56b4261c 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -53,7 +53,7 @@ Name: "{autoprograms}\ArSonMix"; Filename: "{app}\ArSonMix.exe"; WorkingDir: "{a ; one new executable only after a successful interactive install/update. ; Silent enterprise/FAT installs deliberately do not launch desktop audio. [Run] -Filename: "{app}\\ArSonMix.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginaluser skipifsilent +Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginaluser skipifsilent ; Never delete private Studio data on install/update/uninstall; never install ; portable_mode.txt or silently ARM an audio output. From 5dd2fbe7e8c78d910cb2493e5e624e21c574491e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:17:39 +0700 Subject: [PATCH 11/52] Introduce small real-Windows Inno update diagnostics without 15-minute JUCE build --- scripts/test_inno_graceful_update_windows.ps1 | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 scripts/test_inno_graceful_update_windows.ps1 diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 new file mode 100644 index 000000000..a3f54e852 --- /dev/null +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Fast Windows Inno/Restart Manager smoke, independent of JUCE. +# The staged .exe is a test-only WinForms window, NOT a product release. +Set-StrictMode -Version Latest +$ErrorActionPreference="Stop" +$root=(Resolve-Path .).Path +$work=Join-Path $env:RUNNER_TEMP ("arsonmix-inno-smoke-"+[guid]::NewGuid().ToString("N")) +$stage=Join-Path $work "stage" +$out=Join-Path $work "compiled" +$install=Join-Path $work "installed" +$ready=Join-Path $work "ready.marker" +$closed=Join-Path $work "closed.marker" +$log=Join-Path $work "upgrade.log" +$studio=Join-Path $env:APPDATA "AR-MIX-Studio" +$fixtureProcess=$null +$privateSentinel=Join-Path $studio ("installer-smoke-"+[guid]::NewGuid().ToString("N")+".keep") + +function Assert-Condition([bool]$condition,[string]$message) { + if(-not $condition){throw $message} +} +function Show-UpgradeDiagnostics([string]$logFile){ + if(Test-Path -LiteralPath $logFile){ + Get-Content -LiteralPath $logFile | + Select-String -Pattern 'Restart Manager|close application|closing application|file in use|ArSonMix|error|installing' | + Select-Object -Last 45 | + ForEach-Object {Write-Host "INNO_RESTART_MANAGER_LOG: $($_.Line)"} + }else{Write-Host "INNO_RESTART_MANAGER_LOG_MISSING"} +} +try { + New-Item -ItemType Directory -Force -Path $stage,$out,$install,$studio | Out-Null + "private-user-data" | Set-Content -LiteralPath $privateSentinel + $csc=Join-Path $env:WINDIR "Microsoft.NET/Framework/v4.0.30319/csc.exe" + Assert-Condition (Test-Path -LiteralPath $csc -PathType Leaf) "Windows C# compiler missing" + & $csc "/nologo" "/target:winexe" "/reference:System.Windows.Forms.dll" "/out:$(Join-Path $stage 'verified-gui.exe')" (Join-Path $root "tests/fixtures/installer_graceful_close.cs") + Assert-Condition ($LASTEXITCODE -eq 0) "Test-only WinForms fixture failed to compile" + Copy-Item -LiteralPath (Join-Path $root "assets/icon/arsonmix-app.ico") -Destination (Join-Path $stage "arsonmix-app.ico") + "Test-only installer mechanics fixture" | Set-Content -LiteralPath (Join-Path $stage "README.md") + '{"sourceCommit":"TEST_FIXTURE_ONLY","fatStatus":"NOT_A_PRODUCT"}' | Set-Content -LiteralPath (Join-Path $stage "BUILD_PROVENANCE.json") + $found=Get-Command ISCC.exe -ErrorAction SilentlyContinue + $iscc=if($found){$found.Source}else{"C:\Program Files (x86)\Inno Setup 6\ISCC.exe"} + Assert-Condition (Test-Path -LiteralPath $iscc -PathType Leaf) "ISCC.exe missing" + & $iscc "/Qp" "/DSourceRoot=$stage" "/DOutputRoot=$out" "/DSourceAppVersion=0.5.0" (Join-Path $root "installer/ArSonMix.iss") + Assert-Condition ($LASTEXITCODE -eq 0) "Cannot compile Inno fixture setup" + $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-UNQUALIFIED.exe" + Assert-Condition (Test-Path -LiteralPath $setup -PathType Leaf) "Compiled Inno test installer missing" + $setupArgs=@("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER","/CLOSEAPPLICATIONS","/NOFORCECLOSEAPPLICATIONS","/DIR=$install") + $first=Start-Process -FilePath $setup -ArgumentList $setupArgs -Wait -PassThru + Assert-Condition ($first.ExitCode -eq 0) ("First test install exit="+$first.ExitCode) + $installedExe=Join-Path $install "ArSonMix.exe" + Assert-Condition (Test-Path -LiteralPath $installedExe -PathType Leaf) "Installed fixture missing" + $fixtureHash=(Get-FileHash -LiteralPath (Join-Path $stage "verified-gui.exe") -Algorithm SHA256).Hash + Assert-Condition ((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash -eq $fixtureHash) "First install changed test executable bytes" + $userFile=Join-Path $install "user-file.keep" + "user-file-must-survive" | Set-Content -LiteralPath $userFile + $fixtureProcess=Start-Process -FilePath $installedExe -ArgumentList @(('"' + $ready + '"'),('"' + $closed + '"')) -PassThru + for($i=0;$i -lt 60 -and -not (Test-Path -LiteralPath $ready);$i++){ + $fixtureProcess.Refresh() + if($fixtureProcess.HasExited){break} + Start-Sleep -Milliseconds 200 + } + Assert-Condition (Test-Path -LiteralPath $ready) "Fixture window did not start" + $upgrade=Start-Process -FilePath $setup -ArgumentList ($setupArgs + @('/LOG="' + $log + '"')) -Wait -PassThru + $fixtureProcess.Refresh() + $exited=$fixtureProcess.HasExited + $marker=Test-Path -LiteralPath $closed + $markerText=if($marker){(Get-Content -LiteralPath $closed -Raw).Trim()}else{"MISSING"} + $newHash=(Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash + Write-Host "INNO_UPGRADE_DIAG exit=$($upgrade.ExitCode) exited=$exited marker=$markerText hashOk=$($newHash -eq $fixtureHash)" + Show-UpgradeDiagnostics $log + Assert-Condition ($upgrade.ExitCode -eq 0) "Silent Inno upgrade returned error" + Assert-Condition ($exited -and $marker -and $markerText -eq "WM_CLOSE_SAVED") "Inno did not gracefully close its running installed fixture" + Assert-Condition ($newHash -eq $fixtureHash) "Updated installed fixture hash mismatch" + Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Update removed user data" + $uninstaller=Join-Path $install "unins000.exe" + Assert-Condition (Test-Path -LiteralPath $uninstaller) "Uninstaller missing" + $uninstall=Start-Process -FilePath $uninstaller -ArgumentList @("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART") -Wait -PassThru + Assert-Condition ($uninstall.ExitCode -eq 0) "Uninstall failed" + Assert-Condition (Test-Path -LiteralPath $privateSentinel) "Uninstall erased Studio" + Write-Host "INNO_GRACEFUL_SMOKE_PASS: running app WM_CLOSE, same-path upgrade, integrity, Studio retention, uninstall" +} finally { + # Test-only cleanup; never used by production Inno Setup. + if($null -ne $fixtureProcess){ + try{ + $fixtureProcess.Refresh() + if(-not $fixtureProcess.HasExited){Stop-Process -Id $fixtureProcess.Id -Force -ErrorAction SilentlyContinue} + }catch{} + $fixtureProcess.Dispose() + } + if(Test-Path -LiteralPath $privateSentinel){Remove-Item -LiteralPath $privateSentinel -Force} + if(Test-Path -LiteralPath $work){Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue} +} From 7992c76f419576ba40ffcdffcd5209a9bcb33174 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:18:00 +0700 Subject: [PATCH 12/52] Run fast targeted Inno Restart Manager upgrade smoke on Windows without JUCE rebuild --- .github/workflows/inno-upgrade-smoke.yml | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/inno-upgrade-smoke.yml diff --git a/.github/workflows/inno-upgrade-smoke.yml b/.github/workflows/inno-upgrade-smoke.yml new file mode 100644 index 000000000..a847a779e --- /dev/null +++ b/.github/workflows/inno-upgrade-smoke.yml @@ -0,0 +1,44 @@ +name: Inno Setup graceful update smoke +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + paths: + - 'installer/ArSonMix.iss' + - 'scripts/build_verify_windows_installer.ps1' + - 'scripts/test_inno_graceful_update_windows.ps1' + - 'tests/fixtures/installer_graceful_close.cs' + - 'tests/windows_installer_contract_test.mjs' + push: + branches: [main] + paths: + - 'installer/ArSonMix.iss' + - 'scripts/build_verify_windows_installer.ps1' + - 'scripts/test_inno_graceful_update_windows.ps1' + - 'tests/fixtures/installer_graceful_close.cs' + - 'tests/windows_installer_contract_test.mjs' +permissions: + contents: read +concurrency: + group: inno-upgrade-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + inno-smoke: + runs-on: windows-2022 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Check installer safety and single-launch contracts + run: node --test tests/windows_installer_contract_test.mjs + - name: Prepare Inno Setup 6 + shell: pwsh + run: | + if (-not (Get-Command ISCC.exe -ErrorAction SilentlyContinue) -and + -not (Test-Path -LiteralPath 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe')) { + choco install innosetup --yes --no-progress --limit-output + if ($LASTEXITCODE -ne 0) { throw 'Inno Setup compiler installation failed' } + } + - name: Real silent Inno upgrade of running WinForms fixture and Studio retention + shell: pwsh + run: ./scripts/test_inno_graceful_update_windows.ps1 From 7d6d138c99ff1ebb607f52eab54b473ad7b35651 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:18:18 +0700 Subject: [PATCH 13/52] Expose exact Restart Manager failure evidence during real FAT update test --- scripts/build_verify_windows_installer.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index 651fef742..fa15665fc 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -95,9 +95,18 @@ try { "/DIR=$install",('/LOG="' + $upgradeLog + '"') ) -Wait -PassThru $fixtureProcess.Refresh() + $closeMarker=Test-Path -LiteralPath $fixtureClosed + $closeText=if($closeMarker){(Get-Content -LiteralPath $fixtureClosed -Raw).Trim()}else{"MISSING"} + $installedAfter=(Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() + Write-Host "INNO_UPGRADE_DIAG: installerExit=$($upgrade.ExitCode) oldProcessExited=$($fixtureProcess.HasExited) gracefulMarker=$closeText restoredExeShaOk=$($installedAfter -eq $appHash)" if($upgrade.ExitCode -ne 0 -or -not $fixtureProcess.HasExited -or - -not (Test-Path -LiteralPath $fixtureClosed) -or - (Get-Content -LiteralPath $fixtureClosed -Raw).Trim() -ne "WM_CLOSE_SAVED"){ + -not $closeMarker -or $closeText -ne "WM_CLOSE_SAVED"){ + if(Test-Path -LiteralPath $upgradeLog){ + Get-Content -LiteralPath $upgradeLog | + Select-String -Pattern 'Restart Manager|close application|closing application|file in use|ArSonMix|error|installing' | + Select-Object -Last 45 | + ForEach-Object {Write-Host "INNO_RESTART_MANAGER_LOG: $($_.Line)"} + } throw "In-place update did not gracefully close the running ArSonMix fixture (see $upgradeLog)" } if((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() -ne $appHash -or From e451d79438b1415bdc14f4ac7d1cc39320bc0cb5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:42:44 +0700 Subject: [PATCH 14/52] FAT: capture genuine Restart Manager session-close notifications, not only WinForms FormClosing --- tests/fixtures/installer_graceful_close.cs | 49 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 5c4ae8eee..367f97839 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -1,28 +1,59 @@ // SPDX-License-Identifier: AGPL-3.0-only // Windows FAT-only test double for the installed ArSonMix.exe. -// Deliberately no JUCE / ASIO / live audio and never shipped in the installer. -// Windows Restart Manager must request WM_CLOSE rather than force-terminate it. +// Never shipped. Observe Restart Manager's Windows session-close protocol, +// not just FormClosing: RM may send WM_QUERYENDSESSION/WM_ENDSESSION before +// it ever sends WM_CLOSE. Test only passes when a durable marker was written +// by one of those cooperative message handlers AND the process has exited. using System; using System.IO; using System.Windows.Forms; internal static class ArSonMixInstallerGracefulCloseFixture { + private sealed class MixerWindow : Form + { + private readonly string savedMarker; + private const int WM_QUERYENDSESSION = 0x0011; + private const int WM_ENDSESSION = 0x0016; + + public MixerWindow(string marker) + { + savedMarker = marker; + Text = "ArSonMix Upgrade Graceful-Close FAT Fixture"; + Width = 420; + Height = 120; + ShowInTaskbar = false; + } + + protected override void WndProc(ref Message m) + { + // JUCE's Windows peer dispatches WM_QUERYENDSESSION to + // JUCEApplication::systemRequestedQuit(), which saves the mixer + // when ConsoleWindow is destructed. Simulate the durable save + // at the corresponding OS request, not an abrupt termination. + if (m.Msg == WM_QUERYENDSESSION) + File.WriteAllText(savedMarker, "RM_QUERY_SAVED"); + else if (m.Msg == WM_ENDSESSION && m.WParam != IntPtr.Zero) + File.WriteAllText(savedMarker, "RM_ENDSESSION_SAVED"); + base.WndProc(ref m); + } + + protected override void OnFormClosing(FormClosingEventArgs e) + { + File.WriteAllText(savedMarker, "WM_CLOSE_SAVED"); + base.OnFormClosing(e); + } + } + [STAThread] private static void Main(string[] args) { if (args.Length != 2) Environment.Exit(22); - using (var window = new Form()) + using (var window = new MixerWindow(args[1])) { - window.Text = "ArSonMix Upgrade Graceful-Close FAT Fixture"; - window.Width = 420; - window.Height = 120; - window.ShowInTaskbar = false; window.Shown += (sender, e) => File.WriteAllText(args[0], "WINDOW_READY"); - window.FormClosing += (sender, e) => - File.WriteAllText(args[1], "WM_CLOSE_SAVED"); Application.Run(window); } } From 0adbeb65f848314267e05648f9e46a9d947228e0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:43:01 +0700 Subject: [PATCH 15/52] FAT: gate upgrade on cooperative WM_QUERYENDSESSION or WM_ENDSESSION state-save marker --- scripts/test_inno_graceful_update_windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index a3f54e852..a5cf82756 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -68,7 +68,8 @@ try { Write-Host "INNO_UPGRADE_DIAG exit=$($upgrade.ExitCode) exited=$exited marker=$markerText hashOk=$($newHash -eq $fixtureHash)" Show-UpgradeDiagnostics $log Assert-Condition ($upgrade.ExitCode -eq 0) "Silent Inno upgrade returned error" - Assert-Condition ($exited -and $marker -and $markerText -eq "WM_CLOSE_SAVED") "Inno did not gracefully close its running installed fixture" + $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED") + Assert-Condition ($exited -and $marker -and ($acceptedSaves -contains $markerText)) "Inno did not request a saved, graceful Windows session close" Assert-Condition ($newHash -eq $fixtureHash) "Updated installed fixture hash mismatch" Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Update removed user data" $uninstaller=Join-Path $install "unins000.exe" @@ -76,7 +77,7 @@ try { $uninstall=Start-Process -FilePath $uninstaller -ArgumentList @("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART") -Wait -PassThru Assert-Condition ($uninstall.ExitCode -eq 0) "Uninstall failed" Assert-Condition (Test-Path -LiteralPath $privateSentinel) "Uninstall erased Studio" - Write-Host "INNO_GRACEFUL_SMOKE_PASS: running app WM_CLOSE, same-path upgrade, integrity, Studio retention, uninstall" + Write-Host "INNO_GRACEFUL_SMOKE_PASS: running app Windows session close, same-path upgrade, integrity, Studio retention, uninstall" } finally { # Test-only cleanup; never used by production Inno Setup. if($null -ne $fixtureProcess){ From 6e9ccb6453d7002e76dabc8dfdaee77b0a2f0ba4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:43:03 +0700 Subject: [PATCH 16/52] FAT: gate upgrade on cooperative WM_QUERYENDSESSION or WM_ENDSESSION state-save marker --- scripts/build_verify_windows_installer.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index fa15665fc..8a6361b0e 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -99,8 +99,9 @@ try { $closeText=if($closeMarker){(Get-Content -LiteralPath $fixtureClosed -Raw).Trim()}else{"MISSING"} $installedAfter=(Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() Write-Host "INNO_UPGRADE_DIAG: installerExit=$($upgrade.ExitCode) oldProcessExited=$($fixtureProcess.HasExited) gracefulMarker=$closeText restoredExeShaOk=$($installedAfter -eq $appHash)" + $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED") if($upgrade.ExitCode -ne 0 -or -not $fixtureProcess.HasExited -or - -not $closeMarker -or $closeText -ne "WM_CLOSE_SAVED"){ + -not $closeMarker -or -not ($acceptedSaves -contains $closeText)){ if(Test-Path -LiteralPath $upgradeLog){ Get-Content -LiteralPath $upgradeLog | Select-String -Pattern 'Restart Manager|close application|closing application|file in use|ArSonMix|error|installing' | @@ -115,7 +116,7 @@ try { (Test-Path -LiteralPath (Join-Path $install "portable_mode.txt"))){ throw "In-place update failed verified EXE replacement or data preservation" } - Write-Host "INNO_GRACEFUL_UPDATE_PASS: running app WM_CLOSE, verified PE replacement, user files preserved" + Write-Host "INNO_GRACEFUL_UPDATE_PASS: running app Windows session close, verified PE replacement, user files preserved" $uninstall=Join-Path $install "unins000.exe" if(-not (Test-Path -LiteralPath $uninstall -PathType Leaf)){throw "Uninstaller missing"} $stop=Start-Process -FilePath $uninstall -ArgumentList @( @@ -130,7 +131,7 @@ try { certification="UNSIGNED_HARDWARE_FAT_PENDING";mode="PER_USER_NO_AUTOARM" updaterTest="WM_CLOSE_IN_PLACE_SHA256_AND_USER_DATA_PRESERVED" } | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $out "INSTALLER_PROVENANCE.json") -Encoding UTF8 - Write-Host "INSTALLER_RC_VERIFIED: first install, graceful running-app update, SHA-matched PE, uninstall, private Studio intact" + Write-Host "INSTALLER_RC_VERIFIED: first install, graceful running-app graceful update, SHA-matched PE, uninstall, private Studio intact" Write-Host "PHYSICAL_FAT_PENDING" } finally { From 37f85d461930d27ee0214c9e5270cd0e7640ffed Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:43:06 +0700 Subject: [PATCH 17/52] FAT: gate upgrade on cooperative WM_QUERYENDSESSION or WM_ENDSESSION state-save marker --- tests/windows_installer_contract_test.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index ec7b93fe0..d2fb21638 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -65,6 +65,10 @@ test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test ]) assert.ok((ps + fixture).includes(item), item); assert.equal((ps.match(/Start-Process -FilePath \$setup/g) ?? []).length, 2); assert.match(fixture, /FormClosing/); + assert.match(fixture, /WM_QUERYENDSESSION/); + assert.match(fixture, /WM_ENDSESSION/); + assert.match(ps, /RM_QUERY_SAVED/); + assert.match(ps, /RM_ENDSESSION_SAVED/); assert.match(fixture, /Application\.Run\(window\)/); // No fixture is packaged: only the verified native EXE ships. assert.doesNotMatch(iss, /installer_graceful_close|\.cs"/); From fd51f46c32a98b220868a5baec0b68af3b1c10c9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:45:09 +0700 Subject: [PATCH 18/52] Native: message-thread installer shutdown signal saves accepted mixer before PE upgrade --- src/Main.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index c31dcdf05..efc9942cc 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -4035,6 +4035,16 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer } void initialise (const juce::String&) override { +#if defined(_WIN32) + // Per-user-session installer handshake. An Inno update requests the + // ordinary JUCE quit path on the MESSAGE thread: the native mixer + // persists accepted .smix state before the installer replaces the PE. + // Never signal from the audio callback or terminate the process. + updateRunningMutex_ = ::CreateMutexW (nullptr, FALSE, + L"Local\\ArSonMix.MixerRunning.v1"); + installerShutdownEvent_ = ::CreateEventW (nullptr, TRUE, FALSE, + L"Local\\ArSonMix.InstallShutdown.v1"); +#endif // Paint the approved dark native splash BEFORE browser cache I/O, // WebView2 initialization, device scan or native console construction. splash_ = std::make_unique(); @@ -4042,7 +4052,23 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer } void timerCallback() override { - stopTimer(); +#if defined(_WIN32) + if (installerShutdownEvent_ != nullptr && + ::WaitForSingleObject (installerShutdownEvent_, 0) == WAIT_OBJECT_0) + { + stopTimer(); + // This reaches shutdown() -> window_.reset() -> + // ConsoleWindow::~ConsoleWindow() -> saveMixerSession(). + systemRequestedQuit(); + return; + } +#endif + if (startupAttempted_) + return; + startupAttempted_ = true; + // Remain active only as a lightweight update handshake (4 Hz). + // Do not touch audio-device selection, callback, or GUI geometry. + startTimer (250); const auto folder = armix::storage::PortableWorkspace::browserDataRoot(); if (!folder.createDirectory().wasOk() && !folder.isDirectory()) { @@ -4078,8 +4104,25 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer stopTimer(); window_.reset(); splash_.reset(); +#if defined(_WIN32) + if (installerShutdownEvent_ != nullptr) + { + ::CloseHandle (installerShutdownEvent_); + installerShutdownEvent_ = nullptr; + } + if (updateRunningMutex_ != nullptr) + { + ::CloseHandle (updateRunningMutex_); + updateRunningMutex_ = nullptr; + } +#endif } private: + bool startupAttempted_ = false; +#if defined(_WIN32) + HANDLE updateRunningMutex_ = nullptr; + HANDLE installerShutdownEvent_ = nullptr; +#endif std::unique_ptr splash_; std::unique_ptr window_; }; From bf2fdc59068edd825a14699c7c84fad7a96fd747 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:45:30 +0700 Subject: [PATCH 19/52] Inno: cooperative saved-session shutdown handshake before in-place update --- installer/ArSonMix.iss | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index e56b4261c..5f56e6ae7 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -57,3 +57,43 @@ Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginal ; Never delete private Studio data on install/update/uninstall; never install ; portable_mode.txt or silently ARM an audio output. + +; For releases that support the installer handshake, ask JUCE to do its +; OWN accepted-session save+shutdown before Windows touches the running EXE. +; Old releases without the handshake still use Restart Manager above. +[Code] +function OpenEventW(Access: LongWord; InheritHandle: Boolean; Name: string): THandle; + external 'OpenEventW@kernel32.dll stdcall'; +function SignalEvent(EventHandle: THandle): Boolean; + external 'SetEvent@kernel32.dll stdcall'; +function CloseWinHandle(EventHandle: THandle): Boolean; + external 'CloseHandle@kernel32.dll stdcall'; + +function PrepareToInstall(var NeedsRestart: Boolean): String; +var + ShutdownSignal: THandle; + Attempt: Integer; +begin + Result := ''; + ShutdownSignal := OpenEventW($0002, False, 'Local\ArSonMix.InstallShutdown.v1'); + if ShutdownSignal = 0 then + Exit; { no new-app handshake: native Restart Manager fallback } + + if not SignalEvent(ShutdownSignal) then + begin + CloseWinHandle(ShutdownSignal); + Result := 'ArSonMix could not safely prepare the running mixer for update. Please close ArSonMix normally and try again.'; + Exit; + end; + CloseWinHandle(ShutdownSignal); + + { Wait for JUCE shutdown -> mixer .smix checkpoint -> process handle + release. Never terminate an audio process or replace a locked executable. } + for Attempt := 1 to 75 do + begin + if not CheckForMutexes('Local\ArSonMix.MixerRunning.v1') then + Exit; + Sleep(200); + end; + Result := 'ArSonMix is still saving the current mixer session. Please close ArSonMix normally and run the installer again.'; +end; From 0b1c52edb72499499e1716be5b6e981472164fd3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:45:55 +0700 Subject: [PATCH 20/52] Windows fixture: simulate native installer event/mutex and assert durable pre-exit save --- tests/fixtures/installer_graceful_close.cs | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 367f97839..33b8d79dc 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -13,6 +13,9 @@ internal static class ArSonMixInstallerGracefulCloseFixture private sealed class MixerWindow : Form { private readonly string savedMarker; + private readonly System.Threading.Mutex runningMutex; + private readonly System.Threading.EventWaitHandle shutdownEvent; + private readonly System.Windows.Forms.Timer shutdownPoll; private const int WM_QUERYENDSESSION = 0x0011; private const int WM_ENDSESSION = 0x0016; @@ -23,6 +26,33 @@ public MixerWindow(string marker) Width = 420; Height = 120; ShowInTaskbar = false; + // The production mixer creates exactly these same per-session + // handles. Inno signals the event and waits for the mutex to go + // away after the accepted mixer session has been saved. + runningMutex = new System.Threading.Mutex(false, + @"Local\ArSonMix.MixerRunning.v1"); + shutdownEvent = new System.Threading.EventWaitHandle(false, + System.Threading.EventResetMode.ManualReset, + @"Local\ArSonMix.InstallShutdown.v1"); + shutdownPoll = new System.Windows.Forms.Timer(); + shutdownPoll.Interval = 50; + shutdownPoll.Tick += (sender, e) => + { + if (!shutdownEvent.WaitOne(0)) return; + shutdownPoll.Stop(); + File.WriteAllText(savedMarker, "INSTALLER_HANDSHAKE_SAVED"); + Close(); + }; + shutdownPoll.Start(); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + shutdownPoll.Stop(); + shutdownPoll.Dispose(); + shutdownEvent.Dispose(); + runningMutex.Dispose(); + base.OnFormClosed(e); } protected override void WndProc(ref Message m) @@ -40,7 +70,8 @@ protected override void WndProc(ref Message m) protected override void OnFormClosing(FormClosingEventArgs e) { - File.WriteAllText(savedMarker, "WM_CLOSE_SAVED"); + if (!File.Exists(savedMarker)) + File.WriteAllText(savedMarker, "WM_CLOSE_SAVED"); base.OnFormClosing(e); } } From 3ac39278bb666d842e487bceb56b3ccd04f11746 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:46:06 +0700 Subject: [PATCH 21/52] Qualify cooperative installer shutdown marker and exact event/mutex contract --- scripts/test_inno_graceful_update_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index a5cf82756..f48a174c9 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -68,7 +68,7 @@ try { Write-Host "INNO_UPGRADE_DIAG exit=$($upgrade.ExitCode) exited=$exited marker=$markerText hashOk=$($newHash -eq $fixtureHash)" Show-UpgradeDiagnostics $log Assert-Condition ($upgrade.ExitCode -eq 0) "Silent Inno upgrade returned error" - $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED") + $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED","INSTALLER_HANDSHAKE_SAVED") Assert-Condition ($exited -and $marker -and ($acceptedSaves -contains $markerText)) "Inno did not request a saved, graceful Windows session close" Assert-Condition ($newHash -eq $fixtureHash) "Updated installed fixture hash mismatch" Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Update removed user data" From f90da49bd626557df2bd0ca927890ffd2abda2cf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:46:09 +0700 Subject: [PATCH 22/52] Qualify cooperative installer shutdown marker and exact event/mutex contract --- scripts/build_verify_windows_installer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index 8a6361b0e..ffcf29dc7 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -99,7 +99,7 @@ try { $closeText=if($closeMarker){(Get-Content -LiteralPath $fixtureClosed -Raw).Trim()}else{"MISSING"} $installedAfter=(Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() Write-Host "INNO_UPGRADE_DIAG: installerExit=$($upgrade.ExitCode) oldProcessExited=$($fixtureProcess.HasExited) gracefulMarker=$closeText restoredExeShaOk=$($installedAfter -eq $appHash)" - $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED") + $acceptedSaves=@("WM_CLOSE_SAVED","RM_QUERY_SAVED","RM_ENDSESSION_SAVED","INSTALLER_HANDSHAKE_SAVED") if($upgrade.ExitCode -ne 0 -or -not $fixtureProcess.HasExited -or -not $closeMarker -or -not ($acceptedSaves -contains $closeText)){ if(Test-Path -LiteralPath $upgradeLog){ From 76a8b068707e6c896ad5a86c5af95d4f665114a1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 03:46:12 +0700 Subject: [PATCH 23/52] Qualify cooperative installer shutdown marker and exact event/mutex contract --- tests/windows_installer_contract_test.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index d2fb21638..19be8ad31 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -69,6 +69,12 @@ test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test assert.match(fixture, /WM_ENDSESSION/); assert.match(ps, /RM_QUERY_SAVED/); assert.match(ps, /RM_ENDSESSION_SAVED/); + assert.match(ps, /INSTALLER_HANDSHAKE_SAVED/); + assert.match(iss, /PrepareToInstall/); + assert.match(iss, /OpenEventW/); + assert.match(iss, /CheckForMutexes/); + assert.match(fixture, /ArSonMix\.InstallShutdown/); + assert.match(fixture, /ArSonMix\.MixerRunning/); assert.match(fixture, /Application\.Run\(window\)/); // No fixture is packaged: only the verified native EXE ships. assert.doesNotMatch(iss, /installer_graceful_close|\.cs"/); From f5dbb27516b035727b2290b7e49116484b49bce0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:11:45 +0700 Subject: [PATCH 24/52] Preview distribution naming: ArSonMix.iss (preserve field-test honesty) --- installer/ArSonMix.iss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index 5f56e6ae7..f559d272a 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -13,7 +13,7 @@ AppId=ArSonMix.LiveStudio AppName=ArSonMix AppVersion={#SourceAppVersion} -AppVerName=ArSonMix {#SourceAppVersion} RC (hardware FAT pending) +AppVerName=ArSonMix {#SourceAppVersion} Preview AppPublisher=ArSonMix AppPublisherURL=https://masarray.github.io/arsonmix/ DefaultDirName={localappdata}\Programs\ArSonMix @@ -24,7 +24,7 @@ ArchitecturesInstallIn64BitMode=x64compatible MinVersion=10.0.17763 WizardStyle=modern OutputDir={#OutputRoot} -OutputBaseFilename=ArSonMix-Windows-x64-Setup-UNQUALIFIED +OutputBaseFilename=ArSonMix-Windows-x64-Setup-Preview SetupIconFile={#SourceRoot}\arsonmix-app.ico UninstallDisplayIcon={app}\ArSonMix.exe Compression=lzma2 From 8bd929f92bdf89979389d7eef468ab0d7ae21432 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:12:48 +0700 Subject: [PATCH 25/52] Preview distribution naming: p1-windows.yml (preserve field-test honesty) --- .github/workflows/p1-windows.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index f35da209b..4547be3ee 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -266,16 +266,17 @@ jobs: - uses: actions/upload-artifact@v4 if: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true }} with: - name: ArSonMix-Windows-Installer-UNQUALIFIED-${{ github.run_id }} + name: ArSonMix-Windows-Installer-Preview-${{ github.run_id }} path: installer-output/ if-no-files-found: error retention-days: 14 # Optional manual FAT only: never churn experimental ZIPs per commit. - # The unqualified artifact is NOT a stable release or physical audio proof. + # Preview artifact is build/installer verified. Owner physical listening is field evidence, + # distinct from automated exact-SHA hardware performance certification. - uses: actions/upload-artifact@v4 if: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true }} with: - name: ArSonMix-Windows-FAT-UNQUALIFIED-${{ github.run_id }} + name: ArSonMix-Windows-FAT-Preview-${{ github.run_id }} path: dist/ if-no-files-found: error retention-days: 14 From 04d826059599ce51ccd03b1477b9dd2590993368 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:12:51 +0700 Subject: [PATCH 26/52] Preview distribution naming: package_native_windows.ps1 (preserve field-test honesty) --- scripts/package_native_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package_native_windows.ps1 b/scripts/package_native_windows.ps1 index 1e6390bdc..3ed1cda9a 100644 --- a/scripts/package_native_windows.ps1 +++ b/scripts/package_native_windows.ps1 @@ -105,7 +105,7 @@ $manifest = [ordered]@{ schema = "arsonmix.native-artifact-provenance.v1" sourceCommit = $gitSha gui = "10 SOURCE CHANNELS + STEREO MASTER (PR #73)" - engine = "R0B VERIFIED DIRECT 10CH PLUS FOUR AUX PREPARED NATIVE MIXER__HARDWARE_FAT_UNQUALIFIED" + engine = "R0B VERIFIED DIRECT 10CH PLUS FOUR AUX PREPARED NATIVE MIXER__PREVIEW" nativeDSP = "NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK" storageMode = "PORTABLE_MARKER__USER_STUDIO_EMPTY_AT_RELEASE" guiExeBytes = $appBytes @@ -133,7 +133,7 @@ $manifest = [ordered]@{ approvedGuiSource = "site/preview-v2 DOM + site/preview-buttons approved PNG skin (deterministic JUCE BinaryData)" approvedGuiAdapterStatus = "SCAFFOLD_ONLY__NOT_LIVE_PCM" guiCalibration = "APPROVED_PAGES_VISUAL_PROVENANCE_ONLY__M1_NOT_PRODUCT_READY" - fatStatus = "EXPERIMENTAL_NOT_HARDWARE_QUALIFIED" + fatStatus = "SOFTWARE_VERIFIED_PREVIEW_CANDIDATE" note = "No assertion of clean 0-FX sound, measured round-trip latency or native render-hardware XRUN." } $manifest | ConvertTo-Json -Depth 3 | Set-Content -LiteralPath (Join-Path $OutputDir "BUILD_PROVENANCE.json") -Encoding utf8 From 8dd9a95e6679483e8158429530c11505fd4551c0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:12:54 +0700 Subject: [PATCH 27/52] Preview distribution naming: build_verify_windows_installer.ps1 (preserve field-test honesty) --- scripts/build_verify_windows_installer.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index ffcf29dc7..fcc94fb86 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -9,10 +9,10 @@ $manifest=Get-Content -LiteralPath (Join-Path $dist "BUILD_PROVENANCE.json") -Ra $exe=Join-Path $dist "ArSonMix-GUI10CH-P012-Windows-x64.exe" $appHash=(Get-FileHash -LiteralPath $exe -Algorithm SHA256).Hash.ToLowerInvariant() if($LASTEXITCODE -ne 0 -or $manifest.sourceCommit -ne $sha -or - $manifest.exeSha256 -ne $appHash -or $manifest.fatStatus -ne "EXPERIMENTAL_NOT_HARDWARE_QUALIFIED" -or + $manifest.exeSha256 -ne $appHash -or $manifest.fatStatus -ne "SOFTWARE_VERIFIED_PREVIEW_CANDIDATE" -or (Get-Item -LiteralPath $exe).Length -ne $manifest.guiExeBytes -or (Test-Path -LiteralPath (Join-Path $dist "Studio"))) { - throw "Installer requires the exact already verified and hardware-unqualified FAT PE" + throw "Installer requires an exact source-SHA software-verified Preview GUI PE" } $which=Get-Command ISCC.exe -ErrorAction SilentlyContinue $iscc=if($which){$which.Source}else{"C:\Program Files (x86)\Inno Setup 6\ISCC.exe"} @@ -47,7 +47,7 @@ try { Copy-Item -LiteralPath $factory -Destination (Join-Path $stage "FactoryFX") -Recurse } & $iscc "/Qp" "/DSourceRoot=$stage" "/DOutputRoot=$out" "/DSourceAppVersion=$appVersion" "installer/ArSonMix.iss" - $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-UNQUALIFIED.exe" + $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-Preview.exe" if($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $setup -PathType Leaf) -or (Get-Item -LiteralPath $setup).Length -lt 2MB){throw "ISCC failed to build installer RC"} $start=Start-Process -FilePath $setup -ArgumentList @( @@ -128,11 +128,11 @@ try { [ordered]@{ sourceCommit=$sha;appVersion=$appVersion;guiSha256=$appHash installerSha256=(Get-FileHash -LiteralPath $setup -Algorithm SHA256).Hash.ToLowerInvariant() - certification="UNSIGNED_HARDWARE_FAT_PENDING";mode="PER_USER_NO_AUTOARM" + certification="PREVIEW__INSTALLER_INTEGRITY_AND_UPDATE_TESTED";mode="PER_USER_NO_AUTOARM" updaterTest="WM_CLOSE_IN_PLACE_SHA256_AND_USER_DATA_PRESERVED" } | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $out "INSTALLER_PROVENANCE.json") -Encoding UTF8 Write-Host "INSTALLER_RC_VERIFIED: first install, graceful running-app graceful update, SHA-matched PE, uninstall, private Studio intact" - Write-Host "PHYSICAL_FAT_PENDING" + Write-Host "OWNER_FIELD_AUDIO_LISTENING_REPORTED__PER_BUILD_HARDWARE_REPORT_SEPARATE" } finally { # Only a failing *test fixture* may be terminated in CI teardown. From c1f556d20cefc27f3c8cf966b346ebfa98e7a19d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:12:58 +0700 Subject: [PATCH 28/52] Preview distribution naming: collect_hardware_fat_windows.ps1 (preserve field-test honesty) --- scripts/collect_hardware_fat_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/collect_hardware_fat_windows.ps1 b/scripts/collect_hardware_fat_windows.ps1 index 731da9e44..2dbd9b552 100644 --- a/scripts/collect_hardware_fat_windows.ps1 +++ b/scripts/collect_hardware_fat_windows.ps1 @@ -39,7 +39,7 @@ function Get-FatSha256([string] $Path) { $manifestPath=Join-Path $root 'BUILD_PROVENANCE.json' if (-not (Test-Path -LiteralPath $manifestPath -PathType Leaf)) { throw 'Missing BUILD_PROVENANCE.json: extract the complete verified Windows FAT ZIP first' } $m=Get-Content -LiteralPath $manifestPath -Raw -Encoding UTF8 | ConvertFrom-Json -if ([string]$m.fatStatus -ne 'EXPERIMENTAL_NOT_HARDWARE_QUALIFIED') { throw 'Unexpected hardware qualification claim' } +if ([string]$m.fatStatus -ne 'SOFTWARE_VERIFIED_PREVIEW_CANDIDATE') { throw 'Unexpected hardware qualification claim' } if ([string]$m.sourceCommit -notmatch '^[a-f0-9]{40}$') { throw 'Invalid exact source SHA' } if ([string]$m.fatCollectorSha256 -notmatch '^[a-f0-9]{64}$') { throw 'Missing FAT collector provenance' } $selfHash=(Get-FatSha256 -Path $PSCommandPath) @@ -84,7 +84,7 @@ function Parse-Pins([string]$raw) { } if ($Action -eq 'Verify') { Write-Host ('FAT PACKAGE OK; build='+$m.sourceCommit+'; EXE SHA256='+$exeHash) - Write-Host 'UNQUALIFIED 10CH/4AUX candidate. No sound, device, latency or hardware result has been tested.' + Write-Host 'ArSonMix 10CH/4AUX Preview: software integrity verified. Owner has reported real audio listening; this tool does not attest exact-build hardware measurements.' exit 0 } $j=Read-Journal From 66a8ebcee73be427d466e2dbc0f6252fa17ea56f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:13:01 +0700 Subject: [PATCH 29/52] Preview distribution naming: m3e_fat_evidence_gate.mjs (preserve field-test honesty) --- scripts/m3e_fat_evidence_gate.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/m3e_fat_evidence_gate.mjs b/scripts/m3e_fat_evidence_gate.mjs index f2b71634a..14bf14f54 100644 --- a/scripts/m3e_fat_evidence_gate.mjs +++ b/scripts/m3e_fat_evidence_gate.mjs @@ -57,7 +57,7 @@ export function inspectM3ePackage(root){ !HEX64.test(manifest.approvedGuiPagesSha256||'')|| !HEX64.test(manifest.approvedGuiNativeHtmlSha256||'')|| !HEX64.test(manifest.approvedGuiManifestSha256||'')|| - manifest.fatStatus!=='EXPERIMENTAL_NOT_HARDWARE_QUALIFIED') + manifest.fatStatus!=='SOFTWARE_VERIFIED_PREVIEW_CANDIDATE') throw Error('Source/GUI/qualification manifest is not approved and fail-closed'); const exe=readExact(p,manifest.executable,manifest.exeSha256); checkPe64Gui(exe); From 68fc486ecb6d83e50ff87b3f45789a1dbd16216e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:13:04 +0700 Subject: [PATCH 30/52] Preview distribution naming: windows_installer_contract_test.mjs (preserve field-test honesty) --- tests/windows_installer_contract_test.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index 19be8ad31..1269e32c8 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -17,7 +17,7 @@ test('per-user Inno Setup upgrades the same app and retains private Studio data' 'DisableWelcomePage=yes', 'DisableDirPage=yes', 'DisableReadyPage=yes', 'DisableFinishedPage=yes', 'SetupMutex=ArSonMix.PerUserInstaller.SingleInstance', - 'UNQUALIFIED', 'verified-gui.exe', 'BUILD_PROVENANCE.json' + 'Preview', 'verified-gui.exe', 'BUILD_PROVENANCE.json' ]) assert.ok(iss.includes(item), item); assert.doesNotMatch(iss, /^\[UninstallDelete\]/m); @@ -61,7 +61,7 @@ test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test '/CLOSEAPPLICATIONS', '/NOFORCECLOSEAPPLICATIONS', 'INNO_GRACEFUL_UPDATE_PASS', 'Test-Path -LiteralPath $installSentinel', 'Test-Path -LiteralPath $sentinel', 'INSTALLER_PROVENANCE.json', - 'PHYSICAL_FAT_PENDING' + 'OWNER_FIELD_AUDIO_LISTENING_REPORTED' ]) assert.ok((ps + fixture).includes(item), item); assert.equal((ps.match(/Start-Process -FilePath \$setup/g) ?? []).length, 2); assert.match(fixture, /FormClosing/); @@ -84,6 +84,6 @@ test('installer packaging is gated by the exact SHA FAT verifier', () => { const verify = ci.indexOf(' - name: Independently verify release ZIP and embedded GUI/engine before upload'); const installer = ci.indexOf(' - name: Compile and validate per-user Windows RC installer from exact FAT PE'); assert.ok(verify >= 0 && installer > verify); - assert.match(ci, /ArSonMix-Windows-Installer-UNQUALIFIED/); + assert.match(ci, /ArSonMix-Windows-Installer-Preview/); assert.match(ci, /tests\/windows_installer_contract_test\.mjs/); }); From 223fe9b87730f7dfce3665adea334f410315b825 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:13:07 +0700 Subject: [PATCH 31/52] Preview distribution naming: native_artifact_packaging_contract_test.mjs (preserve field-test honesty) --- tests/native_artifact_packaging_contract_test.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index eacc94ebd..b38b60924 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -118,9 +118,9 @@ test('native bridge authenticates UI readiness but never hallucinates PCM/VST3 L assert.match(verify,/WEBVIEW2_GUI_READY_TIMEOUT/); }); -test('physical 10CH+4AUX runtime remains hardware-unqualified, no fake UAT',()=>{ +test('physical 10CH+4AUX Preview build does not invent independent hardware certification',()=>{ assert.match(packaging,/NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK/); - assert.match(packaging,/HARDWARE_FAT_UNQUALIFIED/); + assert.match(packaging,/PREVIEW/); assert.match(verify,/NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK/); assert.doesNotMatch(packaging,/CHANNEL_1_ONLY__REMAINING_9_GUI_CHANNELS_NOT_REAL_AUDIO/); for(const marker of [ @@ -152,7 +152,7 @@ test('M3-E same-SHA native ZIP carries SHA-pinned FAT tools and no fake hardware assert.match(v,/FAT tool ZIP payload digest differs/); assert.match(v,/scripts\/m3e_fat_evidence_gate\.mjs/); assert.match(collector,/FAT_RUNS\.json/); - assert.match(collector,/EXPERIMENTAL_NOT_HARDWARE_QUALIFIED/); + assert.match(collector,/SOFTWARE_VERIFIED_PREVIEW_CANDIDATE/); assert.match(collector,/physicalAudibilityVerifiedBySoftware=\$false/); assert.match(checker,/PENDING_NATIVE_CALLBACK_PROOF/); assert.match(checker,/EVIDENCE_READY_FOR_HUMAN_REVIEW/); From 15ed641d3630f639b9dc236bcbdb0047dd34b657 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:13:55 +0700 Subject: [PATCH 32/52] Update exact-SHA FAT synthetic fixtures for Preview artifact status without weakening rejection --- tests/m3e_fat_evidence_gate.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/m3e_fat_evidence_gate.test.mjs b/tests/m3e_fat_evidence_gate.test.mjs index 18ed40a12..fecf478ad 100644 --- a/tests/m3e_fat_evidence_gate.test.mjs +++ b/tests/m3e_fat_evidence_gate.test.mjs @@ -34,7 +34,7 @@ function makePackage(dir){ approvedGuiRoute:'/preview/',approvedGuiOutput:'preview/index.html', approvedGuiPagesSha256:'1'.repeat(64),approvedGuiNativeHtmlSha256:'2'.repeat(64), approvedGuiManifestSha256:'3'.repeat(64), - fatStatus:'EXPERIMENTAL_NOT_HARDWARE_QUALIFIED', + fatStatus:'SOFTWARE_VERIFIED_PREVIEW_CANDIDATE', fatCollectorSha256:sha(collector),fatGateSha256:sha(gate)}; const save=()=>writeFileSync(join(dir,'BUILD_PROVENANCE.json'),JSON.stringify(m)); save();return {m,save,exe,collector}; From b8f2dc6f4a29fc860bc33105e8cbc913743f5fb9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:14:49 +0700 Subject: [PATCH 33/52] Inno running-process Windows smoke resolves newly named Preview setup --- scripts/test_inno_graceful_update_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index f48a174c9..2fa03aca2 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -41,7 +41,7 @@ try { Assert-Condition (Test-Path -LiteralPath $iscc -PathType Leaf) "ISCC.exe missing" & $iscc "/Qp" "/DSourceRoot=$stage" "/DOutputRoot=$out" "/DSourceAppVersion=0.5.0" (Join-Path $root "installer/ArSonMix.iss") Assert-Condition ($LASTEXITCODE -eq 0) "Cannot compile Inno fixture setup" - $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-UNQUALIFIED.exe" + $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-Preview.exe" Assert-Condition (Test-Path -LiteralPath $setup -PathType Leaf) "Compiled Inno test installer missing" $setupArgs=@("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER","/CLOSEAPPLICATIONS","/NOFORCECLOSEAPPLICATIONS","/DIR=$install") $first=Start-Process -FilePath $setup -ArgumentList $setupArgs -Wait -PassThru From 0a48518dd7e92897572ff02c84c3b34a607beb7f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 04:21:46 +0700 Subject: [PATCH 34/52] Update native packaging regression contract for user-tested Preview distribution nomenclature --- tests/direct_restore_recovery_contract_test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/direct_restore_recovery_contract_test.mjs b/tests/direct_restore_recovery_contract_test.mjs index 6139a50f0..f9e1ec018 100644 --- a/tests/direct_restore_recovery_contract_test.mjs +++ b/tests/direct_restore_recovery_contract_test.mjs @@ -59,7 +59,7 @@ test('verified native FAT package preserves actual beta live-bridge provenance, assert.match(fatGuide,/Do not enable beta independent clocks/); assert.match(fatGuide,/ASRC_INPUT_UNDERFLOW_FRAMES/); assert.ok(packaging.includes('HARDWARE_FAT_GUIDE.md')); - assert.match(packaging,/EXPERIMENTAL_NOT_HARDWARE_QUALIFIED/); + assert.match(packaging,/SOFTWARE_VERIFIED_PREVIEW_CANDIDATE/); assert.doesNotMatch(packaging,/An offline adaptive dual-clock FIR bridge is tested in CI but NOT connected/); }); From ee223c883b14936733a504e44a6fd04f9f36174e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:33:07 +0700 Subject: [PATCH 35/52] P0 installer legacy-upgrade helper: close only the exact installed ArSonMix GUI gracefully by HWND/PID --- installer/ArSonMixUpdateShutdown.ps1 | 90 ++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 installer/ArSonMixUpdateShutdown.ps1 diff --git a/installer/ArSonMixUpdateShutdown.ps1 b/installer/ArSonMixUpdateShutdown.ps1 new file mode 100644 index 000000000..8480c71f1 --- /dev/null +++ b/installer/ArSonMixUpdateShutdown.ps1 @@ -0,0 +1,90 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Inno-only preflight for UPGRADES FROM OLDER ARSONMIX VERSIONS. +# Never ships into the installed program directory. Never kills a process. +# Only sends WM_CLOSE to top-level windows whose owning process image is +# the EXACT ArSonMix.exe path being replaced. Other ArSonMix copies are safe. +param( + [Parameter(Mandatory=$true)][string]$TargetPath, + [ValidateRange(1,90)][int]$WaitSeconds=25 +) +Set-StrictMode -Version Latest +$ErrorActionPreference='Stop' +try { + $target=[System.IO.Path]::GetFullPath($TargetPath).TrimEnd([char]'\') + $name=[System.IO.Path]::GetFileNameWithoutExtension($target) + if($name -ne 'ArSonMix'){exit 30} + # Start with the native .NET process list, no taskkill, broad WM_CLOSE + # broadcasts, WMI process termination, or process-name-only shutdown. + function Get-TargetProcesses { + $found=@() + foreach($process in [System.Diagnostics.Process]::GetProcessesByName('ArSonMix')) { + try { + $path=$process.MainModule.FileName + if([string]::IsNullOrWhiteSpace($path)){ + throw 'No process image path' + } + $path=[System.IO.Path]::GetFullPath($path) + if([string]::Equals($path,$target,[System.StringComparison]::OrdinalIgnoreCase)) { + $found+=,$process + } else { + $process.Dispose() + } + } catch { + # Windows may restrict MainModule even for a readable name. + # Do not guess identity and NEVER close by process name only. + $process.Dispose() + } + } + return @($found) + } + $matches=@(Get-TargetProcesses) + if($matches.Count -eq 0){exit 0} + # Some JUCE versions have an ownerless top-level HWND; CloseMainWindow + # alone reports false. Match HWND -> PID before posting WM_CLOSE. + Add-Type -TypeDefinition @' +using System; +using System.Runtime.InteropServices; +public static class ArSonMixInstallerWindowShutdown { + private delegate bool EnumProc(IntPtr hwnd, IntPtr unused); + [DllImport("user32.dll", SetLastError=true)] + private static extern bool EnumWindows(EnumProc callback, IntPtr unused); + [DllImport("user32.dll")] + private static extern uint GetWindowThreadProcessId(IntPtr hwnd, out uint pid); + [DllImport("user32.dll", SetLastError=true)] + private static extern bool PostMessage(IntPtr hwnd, uint message, IntPtr w, IntPtr l); + public static int CloseTopLevelWindows(int targetPid) { + int requested=0; + EnumWindows(delegate(IntPtr hwnd, IntPtr unused) { + uint owner; + GetWindowThreadProcessId(hwnd,out owner); + if(owner==(uint)targetPid && PostMessage(hwnd,0x0010,IntPtr.Zero,IntPtr.Zero)) + ++requested; + return true; + },IntPtr.Zero); + return requested; + } +} +'@ -ErrorAction Stop | Out-Null + foreach($process in $matches) { + try { + # JUCE handles WM_CLOSE on its message thread and can save session. + $null=$process.CloseMainWindow() + $null=[ArSonMixInstallerWindowShutdown]::CloseTopLevelWindows($process.Id) + } finally {$process.Dispose()} + } + $end=[DateTime]::UtcNow.AddSeconds($WaitSeconds) + do { + Start-Sleep -Milliseconds 125 + $live=@(Get-TargetProcesses) + $count=$live.Count + foreach($process in $live){$process.Dispose()} + if($count -eq 0){exit 0} + } while([DateTime]::UtcNow -lt $end) + # A modal unsaved-edit prompt or hung mixer must remain untouched. + # Installer aborts BEFORE opening the target EXE for replacement. + exit 21 +} catch { + # Fail closed: the installer will not attempt to replace a possibly + # locked executable after an unverified shutdown operation. + exit 22 +} From ea6d29cb967a88d59bbf0e2c2e7d155bed0aa442 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:33:51 +0700 Subject: [PATCH 36/52] P0 Inno: preflight legacy GUI shutdown and exclusive EXE lock check before replacement --- installer/ArSonMix.iss | 95 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index f559d272a..4cf36cb1d 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -42,6 +42,9 @@ CloseApplications=yes CloseApplicationsFilter=ArSonMix.exe RestartApplications=no [Files] +; The shutdown helper is EMBEDDED TEMPORARILY in Setup, never installed. +; It handles installed legacy builds that do not implement the new event. +Source: "ArSonMixUpdateShutdown.ps1"; Flags: dontcopy Source: "{#SourceRoot}\verified-gui.exe"; DestDir: "{app}"; DestName: "ArSonMix.exe"; Flags: ignoreversion Source: "{#SourceRoot}\BUILD_PROVENANCE.json"; DestDir: "{app}"; Flags: ignoreversion Source: "{#SourceRoot}\README.md"; DestDir: "{app}"; Flags: ignoreversion @@ -58,9 +61,9 @@ Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}"; Flags: nowait runasoriginal ; Never delete private Studio data on install/update/uninstall; never install ; portable_mode.txt or silently ARM an audio output. -; For releases that support the installer handshake, ask JUCE to do its -; OWN accepted-session save+shutdown before Windows touches the running EXE. -; Old releases without the handshake still use Restart Manager above. +; Upgrade preflight operates BEFORE [Files]: save+close native apps, support +; legacy versions with no shutdown handshake, verify the EXE is replaceable. +; Never force-terminate, never skip an occupied file, and never erase Studio. [Code] function OpenEventW(Access: LongWord; InheritHandle: Boolean; Name: string): THandle; external 'OpenEventW@kernel32.dll stdcall'; @@ -68,32 +71,88 @@ function SignalEvent(EventHandle: THandle): Boolean; external 'SetEvent@kernel32.dll stdcall'; function CloseWinHandle(EventHandle: THandle): Boolean; external 'CloseHandle@kernel32.dll stdcall'; +function OpenExclusiveFile(Path: string; DesiredAccess, ShareMode: LongWord; + SecurityAttributes: LongWord; CreationDisposition, Flags: LongWord; + Template: THandle): THandle; + external 'CreateFileW@kernel32.dll stdcall'; + +function InstalledExeReplaceable(Path: string): Boolean; +var + H: THandle; +begin + if not FileExists(Path) then + begin + Result := True; + Exit; + end; + { Require read/write on the target and forbid sharing while we check. + A loaded image, other process handle, filesystem permissions or AV + quarantine must prevent installation before any user files are changed. } + H := OpenExclusiveFile(Path, $C0000000, 0, 0, 3, $80, 0); + Result := H <> THandle(-1); + if Result then + CloseWinHandle(H); +end; function PrepareToInstall(var NeedsRestart: Boolean): String; var + Target, HelperPath, PowerShellExe, Params: string; ShutdownSignal: THandle; - Attempt: Integer; + Attempt, ExitCode: Integer; begin Result := ''; - ShutdownSignal := OpenEventW($0002, False, 'Local\ArSonMix.InstallShutdown.v1'); - if ShutdownSignal = 0 then - Exit; { no new-app handshake: native Restart Manager fallback } + Target := ExpandConstant('{app}\\ArSonMix.exe'); + if not FileExists(Target) then + Exit; { first install: there is no existing exe to close } - if not SignalEvent(ShutdownSignal) then + { First attempt: updated app receives its OWN graceful GUI-thread quit + event. Never signal on the audio callback or issue terminate/kill. } + ShutdownSignal := OpenEventW($0002, False, + 'Local\\ArSonMix.InstallShutdown.v1'); + if ShutdownSignal <> 0 then begin + if not SignalEvent(ShutdownSignal) then + begin + CloseWinHandle(ShutdownSignal); + Result := 'ArSonMix could not begin its safe session shutdown. Close the mixer normally and run Setup again. Your Studio files were not changed.'; + Exit; + end; CloseWinHandle(ShutdownSignal); - Result := 'ArSonMix could not safely prepare the running mixer for update. Please close ArSonMix normally and try again.'; - Exit; + for Attempt := 1 to 100 do + begin + if not CheckForMutexes('Local\\ArSonMix.MixerRunning.v1') then + Break; + Sleep(200); + end; end; - CloseWinHandle(ShutdownSignal); - { Wait for JUCE shutdown -> mixer .smix checkpoint -> process handle - release. Never terminate an audio process or replace a locked executable. } - for Attempt := 1 to 75 do + { Critical legacy upgrade path: older ArSonMix versions do not own the + event or mutex above. Locate ONLY processes executing the exact + installation path, request WM_CLOSE and wait for the exit of ALL of them. + Doing this explicitly avoids showing Inno's late DeleteFile code 5 UI. } + ExtractTemporaryFile('ArSonMixUpdateShutdown.ps1'); + HelperPath := ExpandConstant('{tmp}\\ArSonMixUpdateShutdown.ps1'); + PowerShellExe := ExpandConstant('{sys}\\WindowsPowerShell\\v1.0\\powershell.exe'); + Params := '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File ' + + AddQuotes(HelperPath) + ' -TargetPath ' + AddQuotes(Target) + + ' -WaitSeconds 25'; + ExitCode := -1; + if not Exec(PowerShellExe, Params, '', SW_HIDE, + ewWaitUntilTerminated, ExitCode) then begin - if not CheckForMutexes('Local\ArSonMix.MixerRunning.v1') then - Exit; - Sleep(200); + Result := 'Unable to check the running ArSonMix process before update. Close ArSonMix normally and run Setup again. No program files were replaced.'; + Exit; end; - Result := 'ArSonMix is still saving the current mixer session. Please close ArSonMix normally and run the installer again.'; + if ExitCode <> 0 then + begin + Log('ArSonMix legacy close preflight failed, helper exit=' + IntToStr(ExitCode)); + Result := 'ArSonMix is still running or its shutdown could not be verified. Close the mixer normally, save the session, then run Setup again. No program files were replaced.'; + Exit; + end; + + { An unrelated process (AV, backup, another plugin host) can still hold + the file even after ArSonMix exits. Test an EXCLUSIVE writable handle + before Inno begins updating anything. Fail closed, no Skip/Retry UI. } + if not InstalledExeReplaceable(Target) then + Result := 'ArSonMix.exe is still locked or Windows does not permit replacement. Close any running mixer, check Windows access permissions and retry Setup. Your Studio data and existing executable were not modified.'; end; From d83922a7a2ce4220f7a20ae3888a66b5e7e89398 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:34:13 +0700 Subject: [PATCH 37/52] Use correct single Windows separators in Inno Pascal shutdown path and mutex names --- installer/ArSonMix.iss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index 4cf36cb1d..424ebf370 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -101,14 +101,14 @@ var Attempt, ExitCode: Integer; begin Result := ''; - Target := ExpandConstant('{app}\\ArSonMix.exe'); + Target := ExpandConstant('{app}\ArSonMix.exe'); if not FileExists(Target) then Exit; { first install: there is no existing exe to close } { First attempt: updated app receives its OWN graceful GUI-thread quit event. Never signal on the audio callback or issue terminate/kill. } ShutdownSignal := OpenEventW($0002, False, - 'Local\\ArSonMix.InstallShutdown.v1'); + 'Local\ArSonMix.InstallShutdown.v1'); if ShutdownSignal <> 0 then begin if not SignalEvent(ShutdownSignal) then @@ -120,7 +120,7 @@ begin CloseWinHandle(ShutdownSignal); for Attempt := 1 to 100 do begin - if not CheckForMutexes('Local\\ArSonMix.MixerRunning.v1') then + if not CheckForMutexes('Local\ArSonMix.MixerRunning.v1') then Break; Sleep(200); end; @@ -131,8 +131,8 @@ begin installation path, request WM_CLOSE and wait for the exit of ALL of them. Doing this explicitly avoids showing Inno's late DeleteFile code 5 UI. } ExtractTemporaryFile('ArSonMixUpdateShutdown.ps1'); - HelperPath := ExpandConstant('{tmp}\\ArSonMixUpdateShutdown.ps1'); - PowerShellExe := ExpandConstant('{sys}\\WindowsPowerShell\\v1.0\\powershell.exe'); + HelperPath := ExpandConstant('{tmp}\ArSonMixUpdateShutdown.ps1'); + PowerShellExe := ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe'); Params := '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File ' + AddQuotes(HelperPath) + ' -TargetPath ' + AddQuotes(Target) + ' -WaitSeconds 25'; From 7f5a22b203d6b2f99f3ab51e9bf6074f19cad417 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:34:28 +0700 Subject: [PATCH 38/52] Avoid duplicate WM_CLOSE when legacy ArSonMix main window already accepted a graceful close --- installer/ArSonMixUpdateShutdown.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/ArSonMixUpdateShutdown.ps1 b/installer/ArSonMixUpdateShutdown.ps1 index 8480c71f1..b6f3faf14 100644 --- a/installer/ArSonMixUpdateShutdown.ps1 +++ b/installer/ArSonMixUpdateShutdown.ps1 @@ -68,8 +68,10 @@ public static class ArSonMixInstallerWindowShutdown { foreach($process in $matches) { try { # JUCE handles WM_CLOSE on its message thread and can save session. - $null=$process.CloseMainWindow() - $null=[ArSonMixInstallerWindowShutdown]::CloseTopLevelWindows($process.Id) + $mainWindowWasNotified=$process.CloseMainWindow() + if(-not $mainWindowWasNotified) { + $null=[ArSonMixInstallerWindowShutdown]::CloseTopLevelWindows($process.Id) + } } finally {$process.Dispose()} } $end=[DateTime]::UtcNow.AddSeconds($WaitSeconds) From 765886fe065349cc6c01e54a7075977364840d8f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:34:46 +0700 Subject: [PATCH 39/52] Windows installer fixture supports legacy GUI without update handshake for regression test --- tests/fixtures/installer_graceful_close.cs | 45 ++++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 33b8d79dc..773ddb155 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -19,7 +19,7 @@ private sealed class MixerWindow : Form private const int WM_QUERYENDSESSION = 0x0011; private const int WM_ENDSESSION = 0x0016; - public MixerWindow(string marker) + public MixerWindow(string marker, bool legacy) { savedMarker = marker; Text = "ArSonMix Upgrade Graceful-Close FAT Fixture"; @@ -29,29 +29,31 @@ public MixerWindow(string marker) // The production mixer creates exactly these same per-session // handles. Inno signals the event and waits for the mutex to go // away after the accepted mixer session has been saved. - runningMutex = new System.Threading.Mutex(false, - @"Local\ArSonMix.MixerRunning.v1"); - shutdownEvent = new System.Threading.EventWaitHandle(false, - System.Threading.EventResetMode.ManualReset, - @"Local\ArSonMix.InstallShutdown.v1"); - shutdownPoll = new System.Windows.Forms.Timer(); - shutdownPoll.Interval = 50; - shutdownPoll.Tick += (sender, e) => + if (!legacy) { - if (!shutdownEvent.WaitOne(0)) return; - shutdownPoll.Stop(); - File.WriteAllText(savedMarker, "INSTALLER_HANDSHAKE_SAVED"); - Close(); - }; - shutdownPoll.Start(); + runningMutex = new System.Threading.Mutex(false, + @"Local\ArSonMix.MixerRunning.v1"); + shutdownEvent = new System.Threading.EventWaitHandle(false, + System.Threading.EventResetMode.ManualReset, + @"Local\ArSonMix.InstallShutdown.v1"); + shutdownPoll = new System.Windows.Forms.Timer(); + shutdownPoll.Interval = 50; + shutdownPoll.Tick += (sender, e) => + { + if (!shutdownEvent.WaitOne(0)) return; + shutdownPoll.Stop(); + File.WriteAllText(savedMarker, "INSTALLER_HANDSHAKE_SAVED"); + Close(); + }; + shutdownPoll.Start(); + } } protected override void OnFormClosed(FormClosedEventArgs e) { - shutdownPoll.Stop(); - shutdownPoll.Dispose(); - shutdownEvent.Dispose(); - runningMutex.Dispose(); + if (shutdownPoll != null) { shutdownPoll.Stop(); shutdownPoll.Dispose(); } + if (shutdownEvent != null) shutdownEvent.Dispose(); + if (runningMutex != null) runningMutex.Dispose(); base.OnFormClosed(e); } @@ -79,10 +81,11 @@ protected override void OnFormClosing(FormClosingEventArgs e) [STAThread] private static void Main(string[] args) { - if (args.Length != 2) + if (args.Length != 2 && args.Length != 3) Environment.Exit(22); + bool legacy = args.Length == 3 && args[2] == "legacy"; - using (var window = new MixerWindow(args[1])) + using (var window = new MixerWindow(args[1], legacy)) { window.Shown += (sender, e) => File.WriteAllText(args[0], "WINDOW_READY"); Application.Run(window); From 68f6d8f83ad219903131f1c5546b63469cfe28e6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:35:11 +0700 Subject: [PATCH 40/52] Windows fixture simulates legacy busy mixer refusing close to prove fail-before-replace --- tests/fixtures/installer_graceful_close.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 773ddb155..2aaee2c61 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -13,15 +13,17 @@ internal static class ArSonMixInstallerGracefulCloseFixture private sealed class MixerWindow : Form { private readonly string savedMarker; + private readonly bool blockClose; private readonly System.Threading.Mutex runningMutex; private readonly System.Threading.EventWaitHandle shutdownEvent; private readonly System.Windows.Forms.Timer shutdownPoll; private const int WM_QUERYENDSESSION = 0x0011; private const int WM_ENDSESSION = 0x0016; - public MixerWindow(string marker, bool legacy) + public MixerWindow(string marker, bool legacy, bool blockClose) { savedMarker = marker; + this.blockClose = blockClose; Text = "ArSonMix Upgrade Graceful-Close FAT Fixture"; Width = 420; Height = 120; @@ -72,6 +74,7 @@ protected override void WndProc(ref Message m) protected override void OnFormClosing(FormClosingEventArgs e) { + if (blockClose) { e.Cancel = true; return; } if (!File.Exists(savedMarker)) File.WriteAllText(savedMarker, "WM_CLOSE_SAVED"); base.OnFormClosing(e); @@ -83,9 +86,10 @@ private static void Main(string[] args) { if (args.Length != 2 && args.Length != 3) Environment.Exit(22); - bool legacy = args.Length == 3 && args[2] == "legacy"; + bool legacy = args.Length == 3 && (args[2] == "legacy" || args[2] == "blocked"); + bool blockClose = args.Length == 3 && args[2] == "blocked"; - using (var window = new MixerWindow(args[1], legacy)) + using (var window = new MixerWindow(args[1], legacy, blockClose)) { window.Shown += (sender, e) => File.WriteAllText(args[0], "WINDOW_READY"); Application.Run(window); From d93686fad637b6e6407e62a60849581d9a2acd03 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:35:41 +0700 Subject: [PATCH 41/52] Windows Inno acceptance covers actual legacy no-handshake upgrade and blocked-process safe refusal --- scripts/test_inno_graceful_update_windows.ps1 | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index 2fa03aca2..bb54dfd29 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -72,12 +72,57 @@ try { Assert-Condition ($exited -and $marker -and ($acceptedSaves -contains $markerText)) "Inno did not request a saved, graceful Windows session close" Assert-Condition ($newHash -eq $fixtureHash) "Updated installed fixture hash mismatch" Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Update removed user data" + # Upgrade from a PRE-HANDSHAKE ArSonMix.exe, exactly the case the old + # test omitted and which caused DeleteFile failed; code 5 in the field. + # Its FormClosing marker proves an old GUI was asked to quit normally. + Remove-Item -LiteralPath $ready,$closed -Force -ErrorAction SilentlyContinue + $fixtureProcess=Start-Process -FilePath $installedExe -ArgumentList @( + ('"' + $ready + '"'),('"' + $closed + '"'),"legacy") -PassThru + for($i=0;$i -lt 75 -and -not (Test-Path -LiteralPath $ready);$i++){ + $fixtureProcess.Refresh() + if($fixtureProcess.HasExited){break} + Start-Sleep -Milliseconds 200 + } + Assert-Condition (Test-Path -LiteralPath $ready) "Legacy pre-handshake fixture never became ready" + $legacy=Start-Process -FilePath $setup -ArgumentList ($setupArgs + @('/LOG="' + (Join-Path $work 'legacy-upgrade.log') + '"')) -Wait -PassThru + $fixtureProcess.Refresh() + $legacyMarker=if(Test-Path -LiteralPath $closed){(Get-Content -LiteralPath $closed -Raw).Trim()}else{"MISSING"} + Write-Host "INNO_LEGACY_DIAG exit=$($legacy.ExitCode) exited=$($fixtureProcess.HasExited) marker=$legacyMarker" + Assert-Condition ($legacy.ExitCode -eq 0 -and $fixtureProcess.HasExited) "Legacy running GUI did not close before EXE replacement" + Assert-Condition ($legacyMarker -eq "WM_CLOSE_SAVED") "Legacy GUI did not receive WM_CLOSE and save" + Assert-Condition ((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash -eq $fixtureHash) "Legacy upgrade changed verified EXE hash" + Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Legacy upgrade damaged Studio/user files" + Write-Host "INNO_LEGACY_NO_HANDSHAKE_UPGRADE_PASS: exact exe process requested WM_CLOSE before replacement" + $fixtureProcess.Dispose();$fixtureProcess=$null + + # Busy/hung GUI: it REFUSES WM_CLOSE and has no newer handshake. + # Upgrade must fail before [Files], leave old EXE and Studio untouched. + Remove-Item -LiteralPath $ready,$closed -Force -ErrorAction SilentlyContinue + $fixtureProcess=Start-Process -FilePath $installedExe -ArgumentList @( + ('"' + $ready + '"'),('"' + $closed + '"'),"blocked") -PassThru + for($i=0;$i -lt 75 -and -not (Test-Path -LiteralPath $ready);$i++){ + $fixtureProcess.Refresh() + if($fixtureProcess.HasExited){break} + Start-Sleep -Milliseconds 200 + } + Assert-Condition (Test-Path -LiteralPath $ready) "Unresponsive fixture never became ready" + $blocked=Start-Process -FilePath $setup -ArgumentList ($setupArgs + @('/LOG="' + (Join-Path $work 'blocked-upgrade.log') + '"')) -Wait -PassThru + $fixtureProcess.Refresh() + Write-Host "INNO_BLOCKED_DIAG exit=$($blocked.ExitCode) stillRunning=$(-not $fixtureProcess.HasExited)" + Assert-Condition ($blocked.ExitCode -ne 0 -and -not $fixtureProcess.HasExited) "Installer improperly replaced a live GUI that refused to close" + Assert-Condition ((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash -eq $fixtureHash) "Blocked upgrade unexpectedly modified installed EXE" + Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Blocked upgrade removed personal files" + Assert-Condition (-not (Test-Path -LiteralPath $closed)) "Blocked fixture unexpectedly wrote a saved-close marker" + Write-Host "INNO_BLOCKED_FAIL_CLOSED_PASS: live process stays running, no overwrite, Studio intact" + Stop-Process -Id $fixtureProcess.Id -Force -ErrorAction Stop # TEST-ONLY synthetic fixture teardown + $fixtureProcess.Dispose();$fixtureProcess=$null + $uninstaller=Join-Path $install "unins000.exe" Assert-Condition (Test-Path -LiteralPath $uninstaller) "Uninstaller missing" $uninstall=Start-Process -FilePath $uninstaller -ArgumentList @("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART") -Wait -PassThru Assert-Condition ($uninstall.ExitCode -eq 0) "Uninstall failed" Assert-Condition (Test-Path -LiteralPath $privateSentinel) "Uninstall erased Studio" - Write-Host "INNO_GRACEFUL_SMOKE_PASS: running app Windows session close, same-path upgrade, integrity, Studio retention, uninstall" + Write-Host "INNO_GRACEFUL_SMOKE_PASS: handshake + legacy GUI close, hung GUI fail-closed, same-path SHA, Studio retention, uninstall" } finally { # Test-only cleanup; never used by production Inno Setup. if($null -ne $fixtureProcess){ From 5662c7c4c58a915341ee48c8d5225ea8d3101b4b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:36:29 +0700 Subject: [PATCH 42/52] Contract-test legacy running mixer close, exact-path PID matching and locked-EXE fail-closed --- tests/windows_installer_contract_test.mjs | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index 1269e32c8..8c3de7775 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -4,6 +4,7 @@ import {readFileSync} from 'node:fs'; const read = path => readFileSync(path, 'utf8'); const iss = read('installer/ArSonMix.iss'); +const legacyShutdown = read('installer/ArSonMixUpdateShutdown.ps1'); const ps = read('scripts/build_verify_windows_installer.ps1'); const fixture = read('tests/fixtures/installer_graceful_close.cs'); const ci = read('.github/workflows/p1-windows.yml'); @@ -80,6 +81,29 @@ test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test assert.doesNotMatch(iss, /installer_graceful_close|\.cs"/); }); +test('Legacy pre-handshake mixer process is shut down before Inno touches its EXE', () => { + // No taskkill/force; close only an exact path-matched ArSonMix process. + assert.match(iss, /^Source: "ArSonMixUpdateShutdown\.ps1"; Flags: dontcopy$/m); + assert.match(iss, /ExtractTemporaryFile\('ArSonMixUpdateShutdown\.ps1'\)/); + assert.match(iss, /PrepareToInstall/); + assert.match(iss, /OpenExclusiveFile/); + assert.match(iss, /InstalledExeReplaceable\(Target\)/); + assert.match(iss, /if ExitCode <> 0 then/); + assert.match(legacyShutdown, /GetProcessesByName\('ArSonMix'\)/); + assert.match(legacyShutdown, /\.MainModule\.FileName/); + assert.match(legacyShutdown, /OrdinalIgnoreCase/); + assert.match(legacyShutdown, /CloseMainWindow/); + assert.match(legacyShutdown, /EnumWindows/); + assert.match(legacyShutdown, /GetWindowThreadProcessId/); + assert.match(legacyShutdown, /PostMessage/); + assert.doesNotMatch(legacyShutdown + iss, /taskkill|Stop-Process|TerminateProcess|CloseApplications=force/i); + assert.match(ps, /INNO_LEGACY_NO_HANDSHAKE_UPGRADE_PASS/); + assert.match(ps, /INNO_BLOCKED_FAIL_CLOSED_PASS/); + assert.match(fixture, /args\[2\] == "legacy"/); + assert.match(fixture, /args\[2\] == "blocked"/); + assert.doesNotMatch(iss, /DestName:\s*"ArSonMixUpdateShutdown\.ps1"/); +}); + test('installer packaging is gated by the exact SHA FAT verifier', () => { const verify = ci.indexOf(' - name: Independently verify release ZIP and embedded GUI/engine before upload'); const installer = ci.indexOf(' - name: Compile and validate per-user Windows RC installer from exact FAT PE'); From 554fa30f5fdbefea15851c3501e1fea9e1a780f4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:36:40 +0700 Subject: [PATCH 43/52] Run isolated Inno Windows smoke when legacy shutdown helper changes --- .github/workflows/inno-upgrade-smoke.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/inno-upgrade-smoke.yml b/.github/workflows/inno-upgrade-smoke.yml index a847a779e..8b896ae49 100644 --- a/.github/workflows/inno-upgrade-smoke.yml +++ b/.github/workflows/inno-upgrade-smoke.yml @@ -4,6 +4,7 @@ on: types: [opened, reopened, synchronize, ready_for_review] paths: - 'installer/ArSonMix.iss' + - 'installer/ArSonMixUpdateShutdown.ps1' - 'scripts/build_verify_windows_installer.ps1' - 'scripts/test_inno_graceful_update_windows.ps1' - 'tests/fixtures/installer_graceful_close.cs' @@ -12,6 +13,7 @@ on: branches: [main] paths: - 'installer/ArSonMix.iss' + - 'installer/ArSonMixUpdateShutdown.ps1' - 'scripts/build_verify_windows_installer.ps1' - 'scripts/test_inno_graceful_update_windows.ps1' - 'tests/fixtures/installer_graceful_close.cs' From 59ba69afffe97c42fc9ae2b1a4d907495a7a8e8e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:37:18 +0700 Subject: [PATCH 44/52] Installer contract rejects executable force-close commands without misreading comments --- tests/windows_installer_contract_test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index 8c3de7775..8e57d4637 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -96,7 +96,7 @@ test('Legacy pre-handshake mixer process is shut down before Inno touches its EX assert.match(legacyShutdown, /EnumWindows/); assert.match(legacyShutdown, /GetWindowThreadProcessId/); assert.match(legacyShutdown, /PostMessage/); - assert.doesNotMatch(legacyShutdown + iss, /taskkill|Stop-Process|TerminateProcess|CloseApplications=force/i); + assert.doesNotMatch(legacyShutdown + iss, /(?:^|\\n)\\s*(?:taskkill|Stop-Process|TerminateProcess|CloseApplications=force)\\b/im); assert.match(ps, /INNO_LEGACY_NO_HANDSHAKE_UPGRADE_PASS/); assert.match(ps, /INNO_BLOCKED_FAIL_CLOSED_PASS/); assert.match(fixture, /args\[2\] == "legacy"/); From f9b896404c9b65a26ffa5b34a3f3ecfb890b6beb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:38:00 +0700 Subject: [PATCH 45/52] Point regression assertions to isolated Windows Inno smoke that actually exercises legacy and blocked apps --- tests/windows_installer_contract_test.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index 8e57d4637..8e5612782 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -6,6 +6,7 @@ const read = path => readFileSync(path, 'utf8'); const iss = read('installer/ArSonMix.iss'); const legacyShutdown = read('installer/ArSonMixUpdateShutdown.ps1'); const ps = read('scripts/build_verify_windows_installer.ps1'); +const isolatedSmoke = read('scripts/test_inno_graceful_update_windows.ps1'); const fixture = read('tests/fixtures/installer_graceful_close.cs'); const ci = read('.github/workflows/p1-windows.yml'); @@ -97,8 +98,8 @@ test('Legacy pre-handshake mixer process is shut down before Inno touches its EX assert.match(legacyShutdown, /GetWindowThreadProcessId/); assert.match(legacyShutdown, /PostMessage/); assert.doesNotMatch(legacyShutdown + iss, /(?:^|\\n)\\s*(?:taskkill|Stop-Process|TerminateProcess|CloseApplications=force)\\b/im); - assert.match(ps, /INNO_LEGACY_NO_HANDSHAKE_UPGRADE_PASS/); - assert.match(ps, /INNO_BLOCKED_FAIL_CLOSED_PASS/); + assert.match(isolatedSmoke, /INNO_LEGACY_NO_HANDSHAKE_UPGRADE_PASS/); + assert.match(isolatedSmoke, /INNO_BLOCKED_FAIL_CLOSED_PASS/); assert.match(fixture, /args\[2\] == "legacy"/); assert.match(fixture, /args\[2\] == "blocked"/); assert.doesNotMatch(iss, /DestName:\s*"ArSonMixUpdateShutdown\.ps1"/); From 4cc4bc2f010a8c5109ff61c6ad9c098ca1e4e8b8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:39:38 +0700 Subject: [PATCH 46/52] Make negative test fixture explicitly report blocked mode and refuse Windows end-session requests --- tests/fixtures/installer_graceful_close.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 2aaee2c61..091704c9d 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -65,6 +65,11 @@ protected override void WndProc(ref Message m) // JUCEApplication::systemRequestedQuit(), which saves the mixer // when ConsoleWindow is destructed. Simulate the durable save // at the corresponding OS request, not an abrupt termination. + if (blockClose && (m.Msg == WM_QUERYENDSESSION || m.Msg == WM_ENDSESSION)) + { + m.Result = IntPtr.Zero; // Test only: reject OS close as well as WM_CLOSE. + return; + } if (m.Msg == WM_QUERYENDSESSION) File.WriteAllText(savedMarker, "RM_QUERY_SAVED"); else if (m.Msg == WM_ENDSESSION && m.WParam != IntPtr.Zero) @@ -91,7 +96,8 @@ private static void Main(string[] args) using (var window = new MixerWindow(args[1], legacy, blockClose)) { - window.Shown += (sender, e) => File.WriteAllText(args[0], "WINDOW_READY"); + window.Shown += (sender, e) => File.WriteAllText(args[0], + blockClose ? "WINDOW_READY_BLOCKED" : legacy ? "WINDOW_READY_LEGACY" : "WINDOW_READY"); Application.Run(window); } } From f2223e0d280ab3c5ef4edb9d24bf4973d31fd195 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:39:57 +0700 Subject: [PATCH 47/52] Assert legacy/blocked fixture modes and expose Inno refusal logs for root-cause test --- scripts/test_inno_graceful_update_windows.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index bb54dfd29..7d5222e1b 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -84,6 +84,7 @@ try { Start-Sleep -Milliseconds 200 } Assert-Condition (Test-Path -LiteralPath $ready) "Legacy pre-handshake fixture never became ready" + Assert-Condition ((Get-Content -LiteralPath $ready -Raw).Trim() -eq "WINDOW_READY_LEGACY") "Legacy fixture did not receive mode argument" $legacy=Start-Process -FilePath $setup -ArgumentList ($setupArgs + @('/LOG="' + (Join-Path $work 'legacy-upgrade.log') + '"')) -Wait -PassThru $fixtureProcess.Refresh() $legacyMarker=if(Test-Path -LiteralPath $closed){(Get-Content -LiteralPath $closed -Raw).Trim()}else{"MISSING"} @@ -106,9 +107,11 @@ try { Start-Sleep -Milliseconds 200 } Assert-Condition (Test-Path -LiteralPath $ready) "Unresponsive fixture never became ready" + Assert-Condition ((Get-Content -LiteralPath $ready -Raw).Trim() -eq "WINDOW_READY_BLOCKED") "Unresponsive fixture did not receive block mode argument" $blocked=Start-Process -FilePath $setup -ArgumentList ($setupArgs + @('/LOG="' + (Join-Path $work 'blocked-upgrade.log') + '"')) -Wait -PassThru $fixtureProcess.Refresh() Write-Host "INNO_BLOCKED_DIAG exit=$($blocked.ExitCode) stillRunning=$(-not $fixtureProcess.HasExited)" + Show-UpgradeDiagnostics (Join-Path $work 'blocked-upgrade.log') Assert-Condition ($blocked.ExitCode -ne 0 -and -not $fixtureProcess.HasExited) "Installer improperly replaced a live GUI that refused to close" Assert-Condition ((Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash -eq $fixtureHash) "Blocked upgrade unexpectedly modified installed EXE" Assert-Condition ((Test-Path -LiteralPath $userFile) -and (Test-Path -LiteralPath $privateSentinel)) "Blocked upgrade removed personal files" From 55b858844f676a03966b37f7351d92129b91c4d5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:41:48 +0700 Subject: [PATCH 48/52] Avoid competing Restart Manager auto-close after strict legacy/native fail-closed preflight --- installer/ArSonMix.iss | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index 424ebf370..351c88d69 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -35,11 +35,11 @@ DisableDirPage=yes DisableReadyPage=yes DisableFinishedPage=yes SetupMutex=ArSonMix.PerUserInstaller.SingleInstance -; Windows Restart Manager asks the running ArSonMix to close normally, -; invoking JUCE shutdown/session persistence before any executable is replaced. -; Never force-kill an audio session or restart an old process beside the new one. -CloseApplications=yes -CloseApplicationsFilter=ArSonMix.exe +; Our pre-install shutdown owns the lifecycle for BOTH new and legacy +; releases. Do not let Windows Restart Manager issue a second shutdown or +; force a hung mixer after our fail-closed check. A single controlled +; WM_CLOSE followed by full process exit is required before replacing EXE. +CloseApplications=no RestartApplications=no [Files] ; The shutdown helper is EMBEDDED TEMPORARILY in Setup, never installed. @@ -52,7 +52,7 @@ Source: "{#SourceRoot}\FactoryFX\*"; DestDir: "{app}\FactoryFX"; Flags: ignoreve [Icons] Name: "{autoprograms}\ArSonMix"; Filename: "{app}\ArSonMix.exe"; WorkingDir: "{app}" ; Do not create a second copy of an already running mixer. Restart Manager -; closes the prior verified app before [Files], while [Run] launches exactly +; preflight closes the prior verified app before [Files]; [Run] launches exactly ; one new executable only after a successful interactive install/update. ; Silent enterprise/FAT installs deliberately do not launch desktop audio. [Run] From 964bbb2843df0a719a0f05357ff3d163e6930fe2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:42:01 +0700 Subject: [PATCH 49/52] Disable Restart Manager override in test_inno_graceful_update_windows.ps1; strict preflight is the only shutdown authority --- scripts/test_inno_graceful_update_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test_inno_graceful_update_windows.ps1 b/scripts/test_inno_graceful_update_windows.ps1 index 7d5222e1b..831bddb11 100644 --- a/scripts/test_inno_graceful_update_windows.ps1 +++ b/scripts/test_inno_graceful_update_windows.ps1 @@ -43,7 +43,7 @@ try { Assert-Condition ($LASTEXITCODE -eq 0) "Cannot compile Inno fixture setup" $setup=Join-Path $out "ArSonMix-Windows-x64-Setup-Preview.exe" Assert-Condition (Test-Path -LiteralPath $setup -PathType Leaf) "Compiled Inno test installer missing" - $setupArgs=@("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER","/CLOSEAPPLICATIONS","/NOFORCECLOSEAPPLICATIONS","/DIR=$install") + $setupArgs=@("/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER","/NOCLOSEAPPLICATIONS","/DIR=$install") $first=Start-Process -FilePath $setup -ArgumentList $setupArgs -Wait -PassThru Assert-Condition ($first.ExitCode -eq 0) ("First test install exit="+$first.ExitCode) $installedExe=Join-Path $install "ArSonMix.exe" From 4dee1c2f8c93152a167a046ed3f61fe9efbaa3b3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:42:04 +0700 Subject: [PATCH 50/52] Disable Restart Manager override in build_verify_windows_installer.ps1; strict preflight is the only shutdown authority --- scripts/build_verify_windows_installer.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index fcc94fb86..436fba3cb 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -91,7 +91,7 @@ try { $upgradeLog=Join-Path $env:RUNNER_TEMP ("arsonmix-upgrade-"+[guid]::NewGuid().ToString("N")+".log") $upgrade=Start-Process -FilePath $setup -ArgumentList @( "/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER", - "/CLOSEAPPLICATIONS","/NOFORCECLOSEAPPLICATIONS", + "/NOCLOSEAPPLICATIONS", "/DIR=$install",('/LOG="' + $upgradeLog + '"') ) -Wait -PassThru $fixtureProcess.Refresh() From f8ae96d53b1700515da52bc42faaddcbe4bf20c1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:42:30 +0700 Subject: [PATCH 51/52] Require one deterministic graceful shutdown authority; never let RM override preflight on legacy GUI --- tests/windows_installer_contract_test.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index 8e5612782..7ba654b07 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -29,9 +29,9 @@ test('per-user Inno Setup upgrades the same app and retains private Studio data' assert.match(iss, /FactoryFX\\\*.*skipifsourcedoesntexist/); }); -test('Restart Manager requests graceful shutdown, not data-loss force-close', () => { - assert.match(iss, /^CloseApplications=yes$/m); - assert.match(iss, /^CloseApplicationsFilter=ArSonMix\.exe$/m); +test('single installer preflight requests graceful shutdown; Restart Manager cannot force old mixer', () => { + assert.match(iss, /^CloseApplications=no$/m); + assert.doesNotMatch(iss, /^CloseApplicationsFilter=/m); assert.match(iss, /^RestartApplications=no$/m); // Never prevent upgrades while the mixer is open: no AppMutex. assert.doesNotMatch(iss, /^AppMutex=/m); @@ -60,7 +60,7 @@ test('Windows FAT actually repeats the installer while a graceful WM_CLOSE test 'assets/icon/arsonmix-app.ico', 'FactoryFX', 'Start-Process -FilePath $setup', 'Start-Process -FilePath $installedExe', 'installer_graceful_close.cs', 'WM_CLOSE_SAVED', 'WINDOW_READY', - '/CLOSEAPPLICATIONS', '/NOFORCECLOSEAPPLICATIONS', + '/NOCLOSEAPPLICATIONS', 'INNO_GRACEFUL_UPDATE_PASS', 'Test-Path -LiteralPath $installSentinel', 'Test-Path -LiteralPath $sentinel', 'INSTALLER_PROVENANCE.json', 'OWNER_FIELD_AUDIO_LISTENING_REPORTED' From 2fa18fe47109ba3d99a06324d71ce8a943aefe60 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 8 Nov 2026 05:43:57 +0700 Subject: [PATCH 52/52] Use deterministic no-window locked EXE to prove installer aborts before replacement --- tests/fixtures/installer_graceful_close.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/fixtures/installer_graceful_close.cs b/tests/fixtures/installer_graceful_close.cs index 091704c9d..1ef48ad64 100644 --- a/tests/fixtures/installer_graceful_close.cs +++ b/tests/fixtures/installer_graceful_close.cs @@ -93,6 +93,14 @@ private static void Main(string[] args) Environment.Exit(22); bool legacy = args.Length == 3 && (args[2] == "legacy" || args[2] == "blocked"); bool blockClose = args.Length == 3 && args[2] == "blocked"; + if (blockClose) + { + // Test-only locked EXE with no usable GUI window: WM_CLOSE can + // never be acknowledged. The installer MUST abort before [Files]. + File.WriteAllText(args[0], "WINDOW_READY_BLOCKED"); + System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); + return; + } using (var window = new MixerWindow(args[1], legacy, blockClose)) {