refactor(wizard): drop LoadPreviousSession, which never did anything
The wizard asked for it, coupled it to a neighbour, listed it in the summary as applied, and wrote it to the config. No code in the plugin has ever read it. A wizard that collects a decision and reports an effect that does not happen is worse than one that never asked. Its partner, FilterIncludePreviousSessions, has a real reader and stays. The coupling was two-way -- switching this on forced the partner on, switching the partner off forced this one off -- so removing it leaves a single checkbox that means what it says, and the summary line now reports the setting that actually took effect. The self-test asserted that skipping step 3 does not overwrite either field. That assertion is rewritten rather than repaired: it was pinning the null-semantics of the wizard's pending state, which still matters, just with one field instead of two.
This commit is contained in:
@@ -227,7 +227,6 @@ public class Configuration : IPluginConfiguration
|
||||
public bool ShowTitleBar = true;
|
||||
public bool ShowPopOutTitleBar = true;
|
||||
public bool DatabaseBattleMessages;
|
||||
public bool LoadPreviousSession;
|
||||
public bool FilterIncludePreviousSessions;
|
||||
public bool SortAutoTranslate;
|
||||
public bool CollapseDuplicateMessages;
|
||||
@@ -362,7 +361,6 @@ public class Configuration : IPluginConfiguration
|
||||
ShowTitleBar = other.ShowTitleBar;
|
||||
ShowPopOutTitleBar = other.ShowPopOutTitleBar;
|
||||
DatabaseBattleMessages = other.DatabaseBattleMessages;
|
||||
LoadPreviousSession = other.LoadPreviousSession;
|
||||
FilterIncludePreviousSessions = other.FilterIncludePreviousSessions;
|
||||
SortAutoTranslate = other.SortAutoTranslate;
|
||||
CollapseDuplicateMessages = other.CollapseDuplicateMessages;
|
||||
|
||||
@@ -62,11 +62,11 @@ internal sealed class WizardStateSmokeStep : ISelfTestStep
|
||||
|
||||
// Variant 2: skip Step 3 explicitly. Picks Roleplay on Step 2,
|
||||
// jumps straight to Step 4 (no Step-3 entry → no seed for
|
||||
// LoadPreviousSession / FilterIncludePreviousSessions), commits,
|
||||
// and asserts the two coupled history toggles remained on their
|
||||
// pre-test value. Pins the null-semantics from Spec Z.176 so a
|
||||
// regression in CommitPending that started writing seeded
|
||||
// recommendations unconditionally would surface here.
|
||||
// FilterIncludePreviousSessions), commits, and asserts the history
|
||||
// toggle remained on its pre-test value. Pins the null-semantics
|
||||
// from Spec Z.176 so a regression in CommitPending that started
|
||||
// writing seeded recommendations unconditionally would surface
|
||||
// here.
|
||||
// CommitPending → ApplyRoleplay overwrites six privacy /
|
||||
// retention fields, so snapshot them first and let CleanUp
|
||||
// restore them after the assert. Keeps /xlperf idempotent.
|
||||
@@ -79,17 +79,11 @@ internal sealed class WizardStateSmokeStep : ISelfTestStep
|
||||
this.snapshotRetentionDefaultDays = Plugin.Config.RetentionDefaultDays;
|
||||
this.snapshotRetentionPerChannelDays = Plugin.Config.RetentionPerChannelDays;
|
||||
|
||||
var loadPrevBefore = Plugin.Config.LoadPreviousSession;
|
||||
var filterPrevBefore = Plugin.Config.FilterIncludePreviousSessions;
|
||||
wizard.TestOnly_AdvanceTo(2);
|
||||
wizard.TestOnly_SetPendingProfile(FirstRunWizard.PrivacyProfile.Roleplay);
|
||||
wizard.TestOnly_AdvanceTo(4);
|
||||
wizard.CommitPending();
|
||||
if (Plugin.Config.LoadPreviousSession != loadPrevBefore)
|
||||
{
|
||||
ImGui.Text("Skip-Step-3 path overwrote LoadPreviousSession");
|
||||
return SelfTestStepResult.Fail;
|
||||
}
|
||||
if (Plugin.Config.FilterIncludePreviousSessions != filterPrevBefore)
|
||||
{
|
||||
ImGui.Text("Skip-Step-3 path overwrote FilterIncludePreviousSessions");
|
||||
|
||||
@@ -341,17 +341,16 @@ public sealed class FirstRunWizard : Window
|
||||
|
||||
private void DrawStepPowerSettings()
|
||||
{
|
||||
// Seed only the two recommendation fields here. Other fields remain
|
||||
// null until the user touches the corresponding control.
|
||||
// Spec FR-4: the wizard explicitly recommends LoadPreviousSession =
|
||||
// true and FilterIncludePreviousSessions = true (Config defaults are
|
||||
// false). The other four fields (AutoTellTabsHistoryPreload,
|
||||
// UseCompactDensity, PrettierTimestamps, Theme) follow the generic
|
||||
// null-semantics from Spec Z.176: a null pending means the user did
|
||||
// not touch that control, so CommitPending must not write back. They
|
||||
// are read live from Plugin.Config below for the ImGui ref-binding
|
||||
// but never seeded into Pending* without a user gesture.
|
||||
_state.PendingLoadPreviousSession ??= true;
|
||||
// Seed only the recommendation field here. Other fields remain null
|
||||
// until the user touches the corresponding control.
|
||||
// Spec FR-4: the wizard explicitly recommends
|
||||
// FilterIncludePreviousSessions = true (the Config default is false).
|
||||
// The other four fields (AutoTellTabsHistoryPreload, UseCompactDensity,
|
||||
// PrettierTimestamps, Theme) follow the generic null-semantics from
|
||||
// Spec Z.176: a null pending means the user did not touch that control,
|
||||
// so CommitPending must not write back. They are read live from
|
||||
// Plugin.Config below for the ImGui ref-binding but never seeded into
|
||||
// Pending* without a user gesture.
|
||||
_state.PendingFilterIncludePreviousSessions ??= true;
|
||||
|
||||
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Title);
|
||||
@@ -361,20 +360,11 @@ public sealed class FirstRunWizard : Window
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ForgeBronze))
|
||||
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Section_History);
|
||||
|
||||
var loadPrev = _state.PendingLoadPreviousSession ?? true;
|
||||
if (ImGui.Checkbox(HellionStrings.Wizard_Step3_LoadPreviousSession_Label, ref loadPrev))
|
||||
{
|
||||
_state.PendingLoadPreviousSession = loadPrev;
|
||||
// Mirror the DataAndPrivacy coupling: turning load-previous on
|
||||
// also turns filter-include on (otherwise old messages bypass
|
||||
// the filter chain), and turning filter-include off forces
|
||||
// load-previous off. The settings tab that used to hold the same
|
||||
// pairing was removed in May; the coupling lives here alone until
|
||||
// the two checkboxes are reachable again.
|
||||
if (loadPrev)
|
||||
_state.PendingFilterIncludePreviousSessions = true;
|
||||
}
|
||||
|
||||
// One checkbox, not two. LoadPreviousSession was asked for here, shown
|
||||
// as applied in the summary and written to the config, and no code in
|
||||
// the plugin has ever read it -- so the wizard was collecting a
|
||||
// decision and reporting an effect that never happened. Its partner
|
||||
// does the work on its own.
|
||||
var filterPrev = _state.PendingFilterIncludePreviousSessions ?? true;
|
||||
if (
|
||||
ImGui.Checkbox(
|
||||
@@ -384,8 +374,6 @@ public sealed class FirstRunWizard : Window
|
||||
)
|
||||
{
|
||||
_state.PendingFilterIncludePreviousSessions = filterPrev;
|
||||
if (!filterPrev)
|
||||
_state.PendingLoadPreviousSession = false;
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
@@ -496,8 +484,8 @@ public sealed class FirstRunWizard : Window
|
||||
);
|
||||
|
||||
var historyLabel =
|
||||
(_state.PendingLoadPreviousSession ?? false)
|
||||
? HellionStrings.Wizard_Step3_LoadPreviousSession_Label
|
||||
(_state.PendingFilterIncludePreviousSessions ?? false)
|
||||
? HellionStrings.Wizard_Step3_FilterIncludePreviousSessions_Label
|
||||
: HellionStrings.Wizard_Step4_Summary_Unchanged;
|
||||
ImGui.TextWrapped(
|
||||
string.Format(HellionStrings.Wizard_Step4_Summary_History, historyLabel)
|
||||
@@ -573,9 +561,6 @@ public sealed class FirstRunWizard : Window
|
||||
break;
|
||||
}
|
||||
|
||||
if (_state.PendingLoadPreviousSession.HasValue)
|
||||
Plugin.Config.LoadPreviousSession = _state.PendingLoadPreviousSession.Value;
|
||||
|
||||
if (_state.PendingFilterIncludePreviousSessions.HasValue)
|
||||
Plugin.Config.FilterIncludePreviousSessions = _state
|
||||
.PendingFilterIncludePreviousSessions
|
||||
@@ -675,7 +660,6 @@ public sealed class FirstRunWizard : Window
|
||||
{
|
||||
public int CurrentStep { get; set; } = 1;
|
||||
public PrivacyProfile? PendingProfile { get; set; }
|
||||
public bool? PendingLoadPreviousSession { get; set; }
|
||||
public bool? PendingFilterIncludePreviousSessions { get; set; }
|
||||
public int? PendingAutoTellTabsHistoryPreload { get; set; }
|
||||
public bool? PendingUseCompactDensity { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user