refactor(config): delete what was never read, restore what was only orphaned

Block D of v1.12.0. The line between the two is the whole job, and I got
it wrong once on the way: six cache fields on Tab looked dead because
nothing writes them, and nothing writes them because AutoTellTabTint and
TabTintCache went out with the chat window in cf4705e. Deleting the
fields would have cemented a loss instead of recording a decision.

So they are back, and the sidebar uses them again: an auto-tell tab is
tinted and glyphed from its partner, twelve colours against seven icons.
Four open tells are no longer four identical envelopes in one colour.

Their own header promised the same partner keeps its colour "across
sessions" while hashing with string.GetHashCode, which .NET salts per
process -- every game start reshuffled every tab. FNV-1a now, with a
lowbias32 finalizer that is not decoration: without it a probe over 144
similar keys reached six of the twelve colours, because the caller takes
the low bits with a modulo and FNV leaves those correlated. Three pinned
values guard it, which is also the only assertion that can catch a
regression to a salted hash.

The same question, asked of the three hide conditions this block had
quietly orphaned: HideDuringCutscenes, HideInBattle, HideWhenNotLoggedIn
all had readers in v1.5.6 and lost them in the same commit. Two of them
are states rather than conditions -- a cutscene the user dismissed stays
dismissed until it ends, and combat must not seize a chat that is
already hidden for another reason -- so they come back as a small state
machine with eight pinned transitions, and three toggles whose labels
were already translated in all 25 languages.

Actually deleted, with a reader search each time:

- Six per-tab hide fields. Their reader was the pop-out window and it
  stopped consulting them in cf4705e. Per-tab was the wrong unit anyway:
  "hide during cutscenes" is a statement about the screen.
- Tab.ChatCodes, whose migration the v16 schema gate had already made
  unreachable.
- InactivityHideTimeout and InactivityHideActiveDuringBattle, MaxLinesToRender
  which had stopped bounding anything, and the 155 lines of
  Configuration.UpdateFrom with no caller at all.

Config version 25, at all three places that carry it. No migration step:
the gate only refuses anything under 16 and Json.NET drops keys it does
not know, so the deleted fields simply stop being written.

One thing a review pass caught that matters more than any of the above:
the clone parity guard had gone hollow. It compares collections by
count, ChatCodes was the only collection the probe seeded, and removing
it left the guard comparing zero against zero. Verified by making
Tab.Clone discard both remaining collections and watching every
assertion stay green. The probe seeds them now, and the same sabotage
fails as it should.
This commit is contained in:
2026-08-18 23:36:54 +02:00
parent 6829a80ff2
commit 8e38e3e805
39 changed files with 424 additions and 207 deletions
+42 -2
View File
@@ -167,6 +167,14 @@ public sealed class Plugin : IAsyncDalamudPlugin
// via Framework.RunOnTick (v1.4.8 B3 retention sweep) can early-bail
// before they touch state that has already been torn down. Volatile
// because the tick reads it from a different thread than the writer.
// The three hide conditions v1.5.6 evaluated and cf4705e left without a
// reader. Advanced once per draw, before any window is drawn.
private Util.ChatHideReason _hideReason = Util.ChatHideReason.None;
// Set by the chat-activation keybind, consumed by the next hide evaluation.
// A cutscene the user dismissed stays dismissed until it ends.
internal bool ChatActivationRequested;
private volatile bool _isDisposing;
// Read by background workers that outlive a teardown -- the export thread
@@ -309,7 +317,13 @@ public sealed class Plugin : IAsyncDalamudPlugin
);
}
Config.Version = 24;
// v25 carries no migration step. The schema gate above only refuses
// anything under 16, and Json.NET drops keys it does not recognise on
// load, so the fields v1.12.0 deleted simply stop being written on the
// next save. The bump is documentation, and it has to be consistent:
// the constant and this stamp are two separate places, and changing
// only one gives a config that re-stamps itself on every start.
Config.Version = 25;
// Unpinned TempTabs are session-only and dropped on every load. Pinned
// TempTabs survive reload — Jin's tester feedback (v1.4.7).
@@ -470,7 +484,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
new SelfTests.SettingsWindowOpenStep(this),
new SelfTests.OnOpenMainUiRoutesMainWindowStep(this),
new SelfTests.TypingIpcStateStep(this),
new SelfTests.ConfigMigrationV24Step(this),
new SelfTests.ConfigMigrationV25Step(this),
new SelfTests.ChannelPopoutBindStep(this),
new SelfTests.HoverStateFootprintStep(),
new SelfTests.HonorificHeaderRenderStep(this),
@@ -1203,6 +1217,32 @@ public sealed class Plugin : IAsyncDalamudPlugin
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
// Stateless, so it needs no machine: there is no gesture that shows
// the chat while nobody is logged in.
if (Config.HideWhenNotLoggedIn && !ClientState.IsLoggedIn)
{
TypingIpc.Update();
return;
}
_hideReason = Util.ChatHideState.Next(
_hideReason,
new Util.ChatHideState.Inputs(
Config.HideInBattle,
InBattle,
Config.HideDuringCutscenes,
CutsceneActive || GposeActive,
ChatActivationRequested
)
);
ChatActivationRequested = false;
if (Util.ChatHideState.Hides(_hideReason))
{
TypingIpc.Update();
return;
}
// RegularFont is nullable only because the live rebuild path
// disposes it before reassigning; both ends of that swap happen on
// this same draw thread, so it cannot be null here.