diff --git a/installer/ArSonMix.iss b/installer/ArSonMix.iss index ed7999f29..e06837128 100644 --- a/installer/ArSonMix.iss +++ b/installer/ArSonMix.iss @@ -25,8 +25,17 @@ SetupIconFile={#SourceRoot}\arsonmix-app.ico UninstallDisplayIcon={app}\ArSonMix.exe Compression=lzma2 SolidCompression=yes -CloseApplications=no +; Windows Restart Manager asks the running mixer to shut down gracefully before +; replacing its EXE. The JUCE shutdown persists the accepted mixer document. +; Never use CloseApplications=force / taskkill: unsaved state must survive. +CloseApplications=yes +CloseApplicationsFilter=ArSonMix.exe,*.dll,*.vst3 +; An install owns the ONE post-setup launch; Restart Manager must not also +; restore the old process (duplicate/old-version instance race). RestartApplications=no +UsePreviousAppDir=yes +UsePreviousTasks=yes +DirExistsWarning=no [Files] Source: "{#SourceRoot}\verified-gui.exe"; DestDir: "{app}"; DestName: "ArSonMix.exe"; Flags: ignoreversion Source: "{#SourceRoot}\BUILD_PROVENANCE.json"; DestDir: "{app}"; Flags: ignoreversion @@ -34,5 +43,10 @@ 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. +; Once files and shortcuts have been committed, offer a checked launch on +; the ordinary Finish screen. Never start an audio device on silent CI installs +; or background updates. Run with the original (not elevated) user context. +[Run] +Filename: "{app}\ArSonMix.exe"; Description: "Launch ArSonMix"; WorkingDir: "{app}"; Flags: postinstall nowait skipifsilent runasoriginaluser +; No UninstallDelete: AppData Studio, .smix, plug-in preferences and recovery +; documents belong to the user. Do not install portable_mode.txt. diff --git a/scripts/build_verify_windows_installer.ps1 b/scripts/build_verify_windows_installer.ps1 index 6cfab9f11..62316ed42 100644 --- a/scripts/build_verify_windows_installer.ps1 +++ b/scripts/build_verify_windows_installer.ps1 @@ -53,6 +53,23 @@ 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"} + # Exercise the real Inno UPDATE path, not only a clean installation. + # Silent CI must never launch the live audio application. Restart Manager + # closes a running installation gracefully when needed; real open-process + # behavior is separately qualified on hardware. + $upgrade=Start-Process -FilePath $setup -ArgumentList @( + "/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/CURRENTUSER", + "/CLOSEAPPLICATIONS","/NORESTARTAPPLICATIONS","/DIR=$install" + ) -Wait -PassThru + if($upgrade.ExitCode -ne 0){throw "Inno in-place update failed: $($upgrade.ExitCode)"} + if(-not (Test-Path -LiteralPath $installedExe -PathType Leaf) -or + (Get-FileHash -LiteralPath $installedExe -Algorithm SHA256).Hash.ToLowerInvariant() -ne $appHash -or + -not (Test-Path -LiteralPath $sentinel) -or + (Test-Path -LiteralPath (Join-Path $install "portable_mode.txt"))){ + throw "In-place update changed the verified GUI, erased Studio or switched to portable mode" + } + $upgradeManifest=Get-Content -LiteralPath (Join-Path $install "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json + if($upgradeManifest.sourceCommit -ne $sha){throw "In-place update lost exact source attestation"} $uninstall=Join-Path $install "unins000.exe" if(-not (Test-Path -LiteralPath $uninstall -PathType Leaf)){throw "Uninstaller missing"} $stop=Start-Process -FilePath $uninstall -ArgumentList @( @@ -66,7 +83,7 @@ try { installerSha256=(Get-FileHash -LiteralPath $setup -Algorithm SHA256).Hash.ToLowerInvariant() certification="UNSIGNED_HARDWARE_FAT_PENDING";mode="PER_USER_NO_AUTOARM" } | 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: SHA-matched PE, fresh install, in-place update, uninstall, private Studio intact" Write-Host "PHYSICAL_FAT_PENDING" } finally { diff --git a/tests/windows_installer_contract_test.mjs b/tests/windows_installer_contract_test.mjs index cefe9ee4b..00b045892 100644 --- a/tests/windows_installer_contract_test.mjs +++ b/tests/windows_installer_contract_test.mjs @@ -5,18 +5,43 @@ 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); +const main=read('src/Main.cpp'); + +test('Inno RC is per-user, 64-bit, safe update and one interactive launch',()=>{ + for(const item of [ + 'PrivilegesRequired=lowest','DefaultDirName={localappdata}', + 'ArchitecturesAllowed=x64compatible','UNQUALIFIED', + 'verified-gui.exe','BUILD_PROVENANCE.json', + 'CloseApplications=yes','CloseApplicationsFilter=ArSonMix.exe', + 'RestartApplications=no','UsePreviousAppDir=yes', + 'UsePreviousTasks=yes','DirExistsWarning=no', + '[Run]','Filename: "{app}\\ArSonMix.exe"', + 'Flags: postinstall nowait skipifsilent runasoriginaluser' + ]) assert.ok(iss.includes(item),item); + assert.doesNotMatch(iss,/^CloseApplications=force/m); + assert.doesNotMatch(iss,/^\[(UninstallDelete|UninstallRun)\]/m); assert.doesNotMatch(iss,/^Source:.*portable_mode\.txt/m); + assert.equal((iss.match(/^Filename: "\{app\}\\ArSonMix\.exe"; Description: "Launch ArSonMix"/gm)||[]).length,1, + 'ONE finish-screen launcher, never a second Restart Manager relaunch'); }); -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', + +test('JUCE receives graceful app close and stores accepted session',()=>{ + assert.match(main,/void closeButtonPressed\(\) override \{ juce::JUCEApplication::getInstance\(\)->systemRequestedQuit\(\); \}/); + assert.match(main,/~ConsoleWindow\(\) override[\s\S]*?mixerSessionWorker_\.finishForShutdown\(\);[\s\S]*?saveMixerSession\(resumeMain\)/); + assert.match(main,/bool moreThanOneInstanceAllowed\(\) override \{ return false; \}/); +}); + +test('installer uses a SHA-verified FAT PE and tests fresh install + in-place update + uninstall',()=>{ + for(const item of [ + 'manifest.sourceCommit','manifest.exeSha256','manifest.fatStatus', + 'assets/icon/arsonmix-app.ico','FactoryFX', + 'Start-Process -FilePath $setup', + '$upgrade=Start-Process -FilePath $setup', + '"/CLOSEAPPLICATIONS"','"/NORESTARTAPPLICATIONS"', + 'In-place update changed the verified GUI', 'Start-Process -FilePath $uninstall','Test-Path -LiteralPath $sentinel', - 'PHYSICAL_FAT_PENDING','INSTALLER_PROVENANCE.json'])assert.ok(ps.includes(item),item); + '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);