Ψ-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
+18 -4
View File
@@ -231,20 +231,32 @@ static void testResizeSweepNoOverlap() {
// --- Mode-segment enablement (the playback gate's visible half) ---------------
static void testModeSegmentsAreLiveWithTheTransportStopped() {
CHECK(modeSegmentEnabled(/*isActiveSegment=*/false, /*transportRunning=*/false));
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/false));
CHECK(modeSegmentEnabled(/*isActiveSegment=*/false, /*transportRunning=*/false, /*routable=*/true));
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/false, /*routable=*/true));
}
static void testInactiveSegmentGoesDeadWhileTheTransportRuns() {
// The one that would fire a real switch — refused while playing/recording, so it
// must read dead rather than invite a click that silently does nothing.
CHECK(!modeSegmentEnabled(/*isActiveSegment=*/false, /*transportRunning=*/true));
CHECK(!modeSegmentEnabled(/*isActiveSegment=*/false, /*transportRunning=*/true, /*routable=*/true));
}
static void testActiveSegmentStaysLiveWhileTheTransportRuns() {
// Clicking the mode you are already in is a reapply, which is never gated;
// dimming it would read as "this mode is unavailable".
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/true));
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/true, /*routable=*/false));
}
static void testInactiveSegmentGoesDeadWhenUnroutable() {
// A third registered mode with no seeded command id (the model is N-mode, the UI
// ships two ids) must read dead, not live-but-silently-inert on click.
CHECK(!modeSegmentEnabled(/*isActiveSegment=*/false, /*transportRunning=*/false, /*routable=*/false));
}
static void testActiveSegmentStaysLiveEvenWhenUnroutable() {
// The active segment always fires a reapply through its own already-resolved id in
// practice, but the predicate's active bypass does not consult routable either way.
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/false, /*routable=*/false));
}
int main() {
@@ -263,6 +275,8 @@ int main() {
testModeSegmentsAreLiveWithTheTransportStopped();
testInactiveSegmentGoesDeadWhileTheTransportRuns();
testActiveSegmentStaysLiveWhileTheTransportRuns();
testInactiveSegmentGoesDeadWhenUnroutable();
testActiveSegmentStaysLiveEvenWhenUnroutable();
if (g_fail == 0) std::printf("footer_bar: all tests passed\n");
else std::printf("footer_bar: %d CHECK(s) FAILED\n", g_fail);
+21 -9
View File
@@ -2,8 +2,8 @@
//
// Covers: the soloed-subset filter (zeros and empty GUIDs dropped, raw values kept),
// the cache's store/query/clear lifecycle including the empty-set-removes rule, GUID
// pruning on reconcile, and the restore plan's two drop rules (dead GUID, parked
// track).
// pruning on reconcile, and the restore plan's two drop rules (dead GUID, not visible
// in the incoming mode — covering both a parked leaf and a derived-invisible parent).
#include "../src/core/view/solo_cache.h"
@@ -120,9 +120,9 @@ static void testReconcileWithEveryGuidLiveRemovesNothing() {
// --- planSoloRestore ---------------------------------------------------------
static void testRestorePlanReplaysEveryLiveUnparkedEntryVerbatim() {
static void testRestorePlanReplaysEveryLiveVisibleEntryVerbatim() {
const std::vector<SoloOp> ops =
planSoloRestore({{"{A}", 1}, {"{B}", 2}}, {"{A}", "{B}"}, {});
planSoloRestore({{"{A}", 1}, {"{B}", 2}}, {"{A}", "{B}"}, {"{A}", "{B}"});
CHECK(ops.size() == 2);
CHECK(ops[0] == (SoloOp{"{A}", 1}));
@@ -131,23 +131,34 @@ static void testRestorePlanReplaysEveryLiveUnparkedEntryVerbatim() {
static void testRestorePlanSkipsAGuidThatNoLongerExists() {
const std::vector<SoloOp> ops =
planSoloRestore({{"{GONE}", 1}, {"{HERE}", 1}}, {"{HERE}"}, {});
planSoloRestore({{"{GONE}", 1}, {"{HERE}", 1}}, {"{HERE}"}, {"{HERE}"});
CHECK(ops.size() == 1);
CHECK(ops[0].guid == "{HERE}");
}
static void testRestorePlanSkipsATrackParkedInTheIncomingMode() {
static void testRestorePlanSkipsAParkedLeafNotVisibleInTheIncomingMode() {
// Soloing a parked track would silence the mix while contributing nothing
// audible, and the track is hidden, so the user could not undo it.
const std::vector<SoloOp> ops =
planSoloRestore({{"{PARKED}", 1}, {"{VISIBLE}", 2}}, {"{PARKED}", "{VISIBLE}"},
{"{PARKED}"});
{"{VISIBLE}"});
CHECK(ops.size() == 1);
CHECK(ops[0] == (SoloOp{"{VISIBLE}", 2}));
}
static void testRestorePlanSkipsAFolderParentHiddenInTheIncomingMode() {
// The parent is never parked (parents are never parked — see planToggle), but a
// derived-invisible parent is hidden all the same: replaying its cached solo
// would silence the mix onto a track the user cannot see or unsolo. `visibleGuids`
// (not the park plan) is the drop set precisely so this case is caught too.
const std::vector<SoloOp> ops =
planSoloRestore({{"{HIDDEN_PARENT}", 1}}, {"{HIDDEN_PARENT}"}, {});
CHECK(ops.empty());
}
static void testRestorePlanOfAnEmptyCacheWritesNothing() {
CHECK(planSoloRestore({}, {"{A}"}, {}).empty());
}
@@ -166,9 +177,10 @@ int main() {
testReconcileDropsDeadGuidsAcrossEveryMode();
testReconcileWithEveryGuidLiveRemovesNothing();
testRestorePlanReplaysEveryLiveUnparkedEntryVerbatim();
testRestorePlanReplaysEveryLiveVisibleEntryVerbatim();
testRestorePlanSkipsAGuidThatNoLongerExists();
testRestorePlanSkipsATrackParkedInTheIncomingMode();
testRestorePlanSkipsAParkedLeafNotVisibleInTheIncomingMode();
testRestorePlanSkipsAFolderParentHiddenInTheIncomingMode();
testRestorePlanOfAnEmptyCacheWritesNothing();
if (g_fail == 0) std::printf("solo_cache: all tests passed\n");