Ψ-W1-T2 review remediation: solo restore drops on visible-in-target, not parked; N-mode segments read dead when unroutable

Fixes a hidden-parent solo replay that could silence the mix. Also closes the N-mode segment silent no-op, amends the invariant comment, trims view.cpp under 600 lines, hedges two SDK inferences, drops a dead null-check.
This commit is contained in:
2026-08-01 20:13:10 -04:00
parent 9c234c2e6b
commit f2cdf676f3
17 changed files with 137 additions and 73 deletions
+6 -18
View File
@@ -60,15 +60,6 @@ constexpr int kFreeModeFixedLanes = 2;
// deliberately excluded, nothing is moving there.
constexpr int kTransportMoving = 1 | 4;
// GUIDs the plan parks in the mode being entered — the set a solo restore skips.
std::set<std::string> parkedGuidsOf(const TogglePlan& plan) {
std::set<std::string> parked;
for (const TrackPlan& tp : plan.park) {
if (!tp.flags.empty()) parked.insert(tp.flags.front().guid);
}
return parked;
}
// C_LANESCOLLAPSED=2: render a tool-split track like a normal single-lane
// track showing only the playing lane (SDK: 1=collapsed, 2=hidden-lanes-exist
// but displays as non-fixed-lane).
@@ -394,7 +385,6 @@ bool applyMintPlan(ViewModeModel& model, const LaneMintPlan& plan,
} // namespace
bool transportBlocksModeSwitch(ReaProject* proj) {
if (!GetPlayStateEx) return false; // fail-open: never gate on a missing API pointer
return (GetPlayStateEx(proj) & kTransportMoving) != 0;
}
@@ -439,11 +429,7 @@ bool applyMode(ViewModeModel& model, const std::string& targetModeId, ReaProject
// ride the existing undo block — one mode toggle stays one Ctrl-Z.
if (realSwitch) {
model.soloCache().store(outgoingModeId, outgoingSolo);
std::vector<view::SoloOp> clearOps;
clearOps.reserve(outgoingSolo.size());
for (const auto& entry : outgoingSolo)
clearOps.push_back(view::SoloOp{entry.first, 0});
applySoloOps(handleByGuid, clearOps);
clearTrackSolos(handleByGuid, outgoingSolo);
}
// PARK: snapshot before mutating, store into the model, then apply.
@@ -502,11 +488,13 @@ bool applyMode(ViewModeModel& model, const std::string& targetModeId, ReaProject
model.setActiveMode(targetModeId);
// Replay + consume, before the single relayout below picks the change up.
// Replay + consume, before the single relayout below picks the change up. Dropped
// against `visible` (computed above for parent visibility), not the park plan: a
// folder parent can be hidden without being parked, and a hidden track must not
// receive a replayed solo it carries no visible control to undo.
if (realSwitch) {
if (const std::map<std::string, int>* cached = model.soloCache().query(targetModeId)) {
applySoloOps(handleByGuid,
view::planSoloRestore(*cached, liveGuids, parkedGuidsOf(plan)));
restoreTrackSolos(handleByGuid, *cached, liveGuids, visible);
model.soloCache().clear(targetModeId);
}
}