Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3161,6 +3161,20 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
}))safe->emitMixerSessionAck("OPEN","Mixer session IO worker unavailable");
return;
}
// Physical Open may construct vendor DLLs inside the logical FX
// materialization step. Arm the marker BEFORE any preparation,
// not merely before the final native graph restore.
std::unique_ptr<armix::startup::Vst3RestoreCrashGuard> explicitRecovery;
bool hadPreviousCrashEvidence=false;
if(error.isEmpty()) {
explicitRecovery=std::make_unique<armix::startup::Vst3RestoreCrashGuard>(
settingsDirectory());
hadPreviousCrashEvidence=explicitRecovery->interrupted();
if(!explicitRecovery->armExplicitRetry())
error="Cannot protect VST3 Open: settings folder is not writable";
else
safe->startupFxGuard_.reset(); // old timer must not clear new marker
}
if(error.isEmpty())error=safe->materializeLogicalFxForBinding(doc,states);
if(error.isEmpty())error=safe->resolveMixerSessionCatalog(doc,false);
if(error.isEmpty()) {
Expand All @@ -3182,9 +3196,17 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
safe->mixerSessionStatus_=engine.isMonitorEnabled()?"RESTORED_MONITORING":"RESTORED_MUTED";
safe->mixerSessionError_.clear();
safe->lastMixerFile_=file;
safe->startupFxGuard_=std::move(explicitRecovery);
safe->startupFxGuardTick_=juce::Time::getMillisecondCounter();
safe->diagnostics_.record("STARTUP_FX_EXPLICIT_RECOVERY_ACCEPTED",
"Manual FX graph restored; pending 15s stability verification");
safe->emitApprovedNativeSnapshot();
}
}
// A controlled rejection is not an abnormal process crash.
// Never erase an earlier failure marker if safe recovery existed.
if(error.isNotEmpty()&&explicitRecovery&&!hadPreviousCrashEvidence)
(void)explicitRecovery->complete();
safe->emitMixerSessionAck("OPEN",error);
}))emitMixerSessionAck("OPEN","Mixer file operation already in progress");
}
Expand Down
7 changes: 7 additions & 0 deletions src/StartupVst3RecoveryGuard.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class Vst3RestoreCrashGuard final {
return marker_.replaceWithText("RESTORE_IN_PROGRESS\n");
}

// Manual Open is an explicit user's retry after safe recovery. Preserve
// crash evidence if the process dies again; clear only after the newly
// installed FX graph is stable. A writable marker is mandatory.
[[nodiscard]] bool armExplicitRetry() {
return marker_.replaceWithText("EXPLICIT_FX_RESTORE_IN_PROGRESS\n");
}

[[nodiscard]] bool complete() {
// Called after stable startup or graceful shutdown, never while
// processor construction is still underway.
Expand Down
16 changes: 16 additions & 0 deletions tests/live_routing_ui_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,19 @@ test("R3 routing shares approved BTN-180 cap material, has a clear console hiera
assert.match(ui,/id="arPatchGrid"/);
assert.doesNotMatch(ui,/arPatchCell:hover|arAuxMatrixCell:hover|filter:blur\(|backdrop-filter:/);
});

test("P0 manual VST3 Open fences vendor preparation and retains Hotkey session",()=>{
const enter=main.indexOf(" void openMixerFile(");
const exit=main.indexOf(" void chooseMixerFile(",enter);
assert.ok(enter>=0&&exit>enter,"native session Open must have one owner");
const open=main.slice(enter,exit);
const arm=open.indexOf("armExplicitRetry()");
const materialize=open.indexOf("materializeLogicalFxForBinding(");
const instantiate=open.indexOf("engine.restoreNativeMixerSession(");
assert.ok(arm>=0&&materialize>arm&&instantiate>materialize,
"crash guard must arm BEFORE logical FX and vendor graph preparation");
assert.match(open,/hadPreviousCrashEvidence=explicitRecovery->interrupted\(\)/);
assert.match(open,/if\(error\.isNotEmpty\(\)&&explicitRecovery&&!hadPreviousCrashEvidence\)/);
assert.match(open,/startupFxGuard_=std::move\(explicitRecovery\)/);
assert.match(open,/hotkeys_\.activateSession\(id,&importedHotkeys\)/);
});
22 changes: 18 additions & 4 deletions tests/vst3_waves_identity_startup_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,23 @@ int main() {
assert(nextLaunch.interrupted());
assert(!nextLaunch.arm());
assert(session.loadFileAsString()=="PRESERVE_USER_SESSION");
assert(nextLaunch.complete());
assert(!nextLaunch.interrupted());
assert(nextLaunch.arm());
assert(nextLaunch.complete());
// In safe recovery, an explicit retry must keep the marker during
// potentially crashing vendor creation and for the stability window.
assert(nextLaunch.armExplicitRetry());
assert(nextLaunch.interrupted());
assert(session.loadFileAsString()=="PRESERVE_USER_SESSION");
// Another simulated crash during manual Open still blocks auto replay.
armix::startup::Vst3RestoreCrashGuard retryAfterCrash(temp);
assert(retryAfterCrash.interrupted());
assert(!retryAfterCrash.arm());
assert(retryAfterCrash.armExplicitRetry());
assert(retryAfterCrash.interrupted());
// Successful manual Open plus stable timer/graceful shutdown clears it;
// next application launch can safely resume normal automatic restores.
assert(retryAfterCrash.complete());
assert(!retryAfterCrash.interrupted());
assert(retryAfterCrash.arm());
assert(retryAfterCrash.complete());
assert(session.loadFileAsString()=="PRESERVE_USER_SESSION");
assert(temp.deleteRecursively());
}
Loading