Fix Wave-2 review findings: FX union on re-park, per-project reconcile memo, shared undo mask, decayed test oracle

This commit is contained in:
2026-08-06 17:50:49 -04:00
parent c4038a9e9c
commit 024c619884
9 changed files with 244 additions and 105 deletions
+15 -15
View File
@@ -5,6 +5,7 @@
#include "shell/view/view_reconcile.h"
#include <map>
#include <vector>
#include "shell/view/view_park.h" // trackFlagParm / writeIfChanged
@@ -23,19 +24,21 @@ namespace reasampler {
namespace {
// What the last apply left driven, and in which project. The owner is COMPARE-ONLY
// What the last apply left driven, per project. Keyed by ReaProject*, COMPARE-ONLY
// and never dereferenced (the same discipline the panel's own project memos take): a
// closed project's pointer must never be followed, only found unequal. A project we
// hold no memo for gets no repair — the tool has no account of driving anything
// there, so it has no opinion.
ReaProject* g_appliedOwner = nullptr;
view::AppliedState g_applied;
// closed project's pointer must never be followed, only found unequal or used as a
// map key. A project absent here gets no repair — the tool has no account of driving
// anything there, so it has no opinion. Never pruned on project close: churn is a
// handful of entries per session, cheap enough that a close hook would cost more than
// it saves. One slot used to serve every project; a tab-switch mid-session silently
// discarded whichever project's memo wasn't "current" — see planReconcilePerProject.
std::map<ReaProject*, view::AppliedState> g_applied;
} // namespace
void noteAppliedState(ReaProject* proj, const ViewModeModel& model) {
g_appliedOwner = proj ? proj : EnumProjects(-1, nullptr, 0);
g_applied = view::appliedState(model);
ReaProject* const project = proj ? proj : EnumProjects(-1, nullptr, 0);
g_applied[project] = view::appliedState(model);
}
void reconcileAppliedFlags(ViewModeModel& model, ReaProject* proj) {
@@ -43,16 +46,13 @@ void reconcileAppliedFlags(ViewModeModel& model, ReaProject* proj) {
if (!ValidatePtr2(nullptr, project, "ReaProject*")) return;
const view::AppliedState reloaded = view::appliedState(model);
const std::vector<TrackFlagOp> ops =
project == g_appliedOwner ? planReconcile(g_applied, reloaded)
: std::vector<TrackFlagOp>{};
const ProjectReconcileResult result = planReconcilePerProject(g_applied, project, reloaded);
// Adopted whether or not anything is written: from here the memo describes the
// project as it now stands, so a second reload cannot replay a repair that has
// already happened over values the user has since changed.
g_appliedOwner = project;
g_applied = reloaded;
if (ops.empty()) return;
g_applied[project] = result.newEntry;
if (result.ops.empty()) return;
TrackHandles handleByGuid;
readFolderEntries(project, handleByGuid);
@@ -62,7 +62,7 @@ void reconcileAppliedFlags(ViewModeModel& model, ReaProject* proj) {
Undo_BeginBlock2(project);
{
UiRefreshHold uiHold;
for (const TrackFlagOp& op : ops) {
for (const TrackFlagOp& op : result.ops) {
MediaTrack* tr = resolve(trackByGuid, op.guid);
if (!tr) continue; // stale/deleted GUID — prune
if (writeIfChanged(tr, trackFlagParm(op.flag), static_cast<double>(op.value)))