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 ShowTitleBar = true;
|
||||||
public bool ShowPopOutTitleBar = true;
|
public bool ShowPopOutTitleBar = true;
|
||||||
public bool DatabaseBattleMessages;
|
public bool DatabaseBattleMessages;
|
||||||
public bool LoadPreviousSession;
|
|
||||||
public bool FilterIncludePreviousSessions;
|
public bool FilterIncludePreviousSessions;
|
||||||
public bool SortAutoTranslate;
|
public bool SortAutoTranslate;
|
||||||
public bool CollapseDuplicateMessages;
|
public bool CollapseDuplicateMessages;
|
||||||
@@ -362,7 +361,6 @@ public class Configuration : IPluginConfiguration
|
|||||||
ShowTitleBar = other.ShowTitleBar;
|
ShowTitleBar = other.ShowTitleBar;
|
||||||
ShowPopOutTitleBar = other.ShowPopOutTitleBar;
|
ShowPopOutTitleBar = other.ShowPopOutTitleBar;
|
||||||
DatabaseBattleMessages = other.DatabaseBattleMessages;
|
DatabaseBattleMessages = other.DatabaseBattleMessages;
|
||||||
LoadPreviousSession = other.LoadPreviousSession;
|
|
||||||
FilterIncludePreviousSessions = other.FilterIncludePreviousSessions;
|
FilterIncludePreviousSessions = other.FilterIncludePreviousSessions;
|
||||||
SortAutoTranslate = other.SortAutoTranslate;
|
SortAutoTranslate = other.SortAutoTranslate;
|
||||||
CollapseDuplicateMessages = other.CollapseDuplicateMessages;
|
CollapseDuplicateMessages = other.CollapseDuplicateMessages;
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ internal sealed class WizardStateSmokeStep : ISelfTestStep
|
|||||||
|
|
||||||
// Variant 2: skip Step 3 explicitly. Picks Roleplay on Step 2,
|
// Variant 2: skip Step 3 explicitly. Picks Roleplay on Step 2,
|
||||||
// jumps straight to Step 4 (no Step-3 entry → no seed for
|
// jumps straight to Step 4 (no Step-3 entry → no seed for
|
||||||
// LoadPreviousSession / FilterIncludePreviousSessions), commits,
|
// FilterIncludePreviousSessions), commits, and asserts the history
|
||||||
// and asserts the two coupled history toggles remained on their
|
// toggle remained on its pre-test value. Pins the null-semantics
|
||||||
// pre-test value. Pins the null-semantics from Spec Z.176 so a
|
// from Spec Z.176 so a regression in CommitPending that started
|
||||||
// regression in CommitPending that started writing seeded
|
// writing seeded recommendations unconditionally would surface
|
||||||
// recommendations unconditionally would surface here.
|
// here.
|
||||||
// CommitPending → ApplyRoleplay overwrites six privacy /
|
// CommitPending → ApplyRoleplay overwrites six privacy /
|
||||||
// retention fields, so snapshot them first and let CleanUp
|
// retention fields, so snapshot them first and let CleanUp
|
||||||
// restore them after the assert. Keeps /xlperf idempotent.
|
// restore them after the assert. Keeps /xlperf idempotent.
|
||||||
@@ -79,17 +79,11 @@ internal sealed class WizardStateSmokeStep : ISelfTestStep
|
|||||||
this.snapshotRetentionDefaultDays = Plugin.Config.RetentionDefaultDays;
|
this.snapshotRetentionDefaultDays = Plugin.Config.RetentionDefaultDays;
|
||||||
this.snapshotRetentionPerChannelDays = Plugin.Config.RetentionPerChannelDays;
|
this.snapshotRetentionPerChannelDays = Plugin.Config.RetentionPerChannelDays;
|
||||||
|
|
||||||
var loadPrevBefore = Plugin.Config.LoadPreviousSession;
|
|
||||||
var filterPrevBefore = Plugin.Config.FilterIncludePreviousSessions;
|
var filterPrevBefore = Plugin.Config.FilterIncludePreviousSessions;
|
||||||
wizard.TestOnly_AdvanceTo(2);
|
wizard.TestOnly_AdvanceTo(2);
|
||||||
wizard.TestOnly_SetPendingProfile(FirstRunWizard.PrivacyProfile.Roleplay);
|
wizard.TestOnly_SetPendingProfile(FirstRunWizard.PrivacyProfile.Roleplay);
|
||||||
wizard.TestOnly_AdvanceTo(4);
|
wizard.TestOnly_AdvanceTo(4);
|
||||||
wizard.CommitPending();
|
wizard.CommitPending();
|
||||||
if (Plugin.Config.LoadPreviousSession != loadPrevBefore)
|
|
||||||
{
|
|
||||||
ImGui.Text("Skip-Step-3 path overwrote LoadPreviousSession");
|
|
||||||
return SelfTestStepResult.Fail;
|
|
||||||
}
|
|
||||||
if (Plugin.Config.FilterIncludePreviousSessions != filterPrevBefore)
|
if (Plugin.Config.FilterIncludePreviousSessions != filterPrevBefore)
|
||||||
{
|
{
|
||||||
ImGui.Text("Skip-Step-3 path overwrote FilterIncludePreviousSessions");
|
ImGui.Text("Skip-Step-3 path overwrote FilterIncludePreviousSessions");
|
||||||
|
|||||||
@@ -341,17 +341,16 @@ public sealed class FirstRunWizard : Window
|
|||||||
|
|
||||||
private void DrawStepPowerSettings()
|
private void DrawStepPowerSettings()
|
||||||
{
|
{
|
||||||
// Seed only the two recommendation fields here. Other fields remain
|
// Seed only the recommendation field here. Other fields remain null
|
||||||
// null until the user touches the corresponding control.
|
// until the user touches the corresponding control.
|
||||||
// Spec FR-4: the wizard explicitly recommends LoadPreviousSession =
|
// Spec FR-4: the wizard explicitly recommends
|
||||||
// true and FilterIncludePreviousSessions = true (Config defaults are
|
// FilterIncludePreviousSessions = true (the Config default is false).
|
||||||
// false). The other four fields (AutoTellTabsHistoryPreload,
|
// The other four fields (AutoTellTabsHistoryPreload, UseCompactDensity,
|
||||||
// UseCompactDensity, PrettierTimestamps, Theme) follow the generic
|
// PrettierTimestamps, Theme) follow the generic null-semantics from
|
||||||
// null-semantics from Spec Z.176: a null pending means the user did
|
// Spec Z.176: a null pending means the user did not touch that control,
|
||||||
// not touch that control, so CommitPending must not write back. They
|
// so CommitPending must not write back. They are read live from
|
||||||
// are read live from Plugin.Config below for the ImGui ref-binding
|
// Plugin.Config below for the ImGui ref-binding but never seeded into
|
||||||
// but never seeded into Pending* without a user gesture.
|
// Pending* without a user gesture.
|
||||||
_state.PendingLoadPreviousSession ??= true;
|
|
||||||
_state.PendingFilterIncludePreviousSessions ??= true;
|
_state.PendingFilterIncludePreviousSessions ??= true;
|
||||||
|
|
||||||
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Title);
|
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Title);
|
||||||
@@ -361,20 +360,11 @@ public sealed class FirstRunWizard : Window
|
|||||||
using (ImRaii.PushColor(ImGuiCol.Text, ForgeBronze))
|
using (ImRaii.PushColor(ImGuiCol.Text, ForgeBronze))
|
||||||
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Section_History);
|
ImGui.TextUnformatted(HellionStrings.Wizard_Step3_Section_History);
|
||||||
|
|
||||||
var loadPrev = _state.PendingLoadPreviousSession ?? true;
|
// One checkbox, not two. LoadPreviousSession was asked for here, shown
|
||||||
if (ImGui.Checkbox(HellionStrings.Wizard_Step3_LoadPreviousSession_Label, ref loadPrev))
|
// 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
|
||||||
_state.PendingLoadPreviousSession = loadPrev;
|
// decision and reporting an effect that never happened. Its partner
|
||||||
// Mirror the DataAndPrivacy coupling: turning load-previous on
|
// does the work on its own.
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filterPrev = _state.PendingFilterIncludePreviousSessions ?? true;
|
var filterPrev = _state.PendingFilterIncludePreviousSessions ?? true;
|
||||||
if (
|
if (
|
||||||
ImGui.Checkbox(
|
ImGui.Checkbox(
|
||||||
@@ -384,8 +374,6 @@ public sealed class FirstRunWizard : Window
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
_state.PendingFilterIncludePreviousSessions = filterPrev;
|
_state.PendingFilterIncludePreviousSessions = filterPrev;
|
||||||
if (!filterPrev)
|
|
||||||
_state.PendingLoadPreviousSession = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
@@ -496,8 +484,8 @@ public sealed class FirstRunWizard : Window
|
|||||||
);
|
);
|
||||||
|
|
||||||
var historyLabel =
|
var historyLabel =
|
||||||
(_state.PendingLoadPreviousSession ?? false)
|
(_state.PendingFilterIncludePreviousSessions ?? false)
|
||||||
? HellionStrings.Wizard_Step3_LoadPreviousSession_Label
|
? HellionStrings.Wizard_Step3_FilterIncludePreviousSessions_Label
|
||||||
: HellionStrings.Wizard_Step4_Summary_Unchanged;
|
: HellionStrings.Wizard_Step4_Summary_Unchanged;
|
||||||
ImGui.TextWrapped(
|
ImGui.TextWrapped(
|
||||||
string.Format(HellionStrings.Wizard_Step4_Summary_History, historyLabel)
|
string.Format(HellionStrings.Wizard_Step4_Summary_History, historyLabel)
|
||||||
@@ -573,9 +561,6 @@ public sealed class FirstRunWizard : Window
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_state.PendingLoadPreviousSession.HasValue)
|
|
||||||
Plugin.Config.LoadPreviousSession = _state.PendingLoadPreviousSession.Value;
|
|
||||||
|
|
||||||
if (_state.PendingFilterIncludePreviousSessions.HasValue)
|
if (_state.PendingFilterIncludePreviousSessions.HasValue)
|
||||||
Plugin.Config.FilterIncludePreviousSessions = _state
|
Plugin.Config.FilterIncludePreviousSessions = _state
|
||||||
.PendingFilterIncludePreviousSessions
|
.PendingFilterIncludePreviousSessions
|
||||||
@@ -675,7 +660,6 @@ public sealed class FirstRunWizard : Window
|
|||||||
{
|
{
|
||||||
public int CurrentStep { get; set; } = 1;
|
public int CurrentStep { get; set; } = 1;
|
||||||
public PrivacyProfile? PendingProfile { get; set; }
|
public PrivacyProfile? PendingProfile { get; set; }
|
||||||
public bool? PendingLoadPreviousSession { get; set; }
|
|
||||||
public bool? PendingFilterIncludePreviousSessions { get; set; }
|
public bool? PendingFilterIncludePreviousSessions { get; set; }
|
||||||
public int? PendingAutoTellTabsHistoryPreload { get; set; }
|
public int? PendingAutoTellTabsHistoryPreload { get; set; }
|
||||||
public bool? PendingUseCompactDensity { get; set; }
|
public bool? PendingUseCompactDensity { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user