fix(net,runtime): FA2 fix-round MUST-FIX -- allegiance clears at reset, 0x027C stops seeding

Two MUST-FIX findings from the FA2 mechanism/blast reviews
(docs/research/2026-08-12-fa2-review-mechanism.md,
docs/research/2026-08-12-fa2-review-blast.md):

MF-1 (mechanism) -- RuntimeAllegianceState survived a generation reset,
contradicting retail (ClientAllegianceSystem::OnEndCharacterSession
@0x00569FA0 tail-calls AllegianceProfile::Clear at the same boundary
Fellowship already clears at), contradicting the precedent it cited
(RuntimeCharacterOptionsState.ResetSession clears-and-relatches, it does
not persist), and pinned by a test asserting the wrong behavior. Fixed:
RuntimeAllegianceState.ResetSession() clears the profile and drops
HasServerSeed; a new RuntimeGenerationResetStage.Allegiance stage runs it
on every generation reset, mirroring RuntimeFellowshipState exactly.
RuntimeGenerationResetTests' FellowshipClearsAtResetButAllegianceSurvivesReconnect
inverted to FellowshipAndAllegianceBothClearAtGenerationReset.

MF-2 (mechanism) / blast MF-2 -- 0x027C AllegianceInfoResponse fed the
Runtime allegiance owner (self-gated). Retail's own handler for 0x027C
(CM_Allegiance::DispatchUI_AllegianceInfoResponseEvent @0x006a7470) unpacks
into a stack-local profile destroyed on return; the consumer
(Handle_Allegiance__AllegianceInfoResponseEvent @0x0056a1d0) only prints
AddTextToScroll lines. Retail's panel is fed exclusively by 0x0020
AllegianceUpdate. The removed seeding also fabricated
RuntimeAllegianceSnapshot.Rank (0x027C carries no rank field) on any
client whose first allegiance message was a self @allegiance info query.
Fixed: dropped ApplyInfoResponseSelf, the onAllegianceInfoResponseSelf
delegate hole, and the self-gate; 0x027C is text-only again, matching
retail and the pre-FA2 shape.

Also covers blast SHOULD-FIX 1 in the same edit to LiveSessionEventRouter.cs:
the fellowship/allegiance delegate holes are now passed conditionally on
the owner being supplied, so GameEventDispatcher.GetUnhandledCount reads
correctly for callers without an owner (bare-ChatLog tests, a future
partial host) instead of silently reading 0 for 9 event types whose parse
result was discarded.

RuntimeAllegianceState.cs and the two owners' Apply* mutators also move
their ObjectDisposedException.ThrowIf checks inside the lock they already
take (mechanism SHOULD-FIX 2) -- the prior check-then-lock shape let an
inbound event on the decode thread race Dispose on the host thread and
repopulate state after _disposed = true, permanently falsifying
CaptureOwnership().IsConverged at teardown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-12 02:17:04 +02:00
parent 63649c8053
commit 4272ad0ea4
9 changed files with 425 additions and 229 deletions

View file

@ -241,27 +241,47 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
// reached identically by both hosts since LiveSessionEventRouter
// itself is shared (LiveSessionEventRouter.Attach, K-slice
// unification).
onFellowshipFullUpdate: update =>
social.Fellowship?.ApplyFullUpdate(update),
onFellowshipUpdateFellow: update =>
social.Fellowship?.ApplyUpdateFellow(update),
onFellowshipQuit: quitterGuid =>
social.Fellowship?.ApplyQuit(quitterGuid, inventory.PlayerGuid()),
onFellowshipDismiss: dismissedGuid =>
social.Fellowship?.ApplyDismiss(dismissedGuid, inventory.PlayerGuid()),
onFellowshipDisband: () => social.Fellowship?.ApplyDisband(),
onAllegianceUpdate: update =>
social.Allegiance?.ApplyUpdate(update),
onAllegianceInfoResponseSelf: response =>
social.Allegiance?.ApplyInfoResponseSelf(response),
onAllegianceUpdateDone: weenieError =>
social.Allegiance?.ApplyUpdateDone(weenieError),
onAllegianceUpdateAborted: weenieError =>
social.Allegiance?.ApplyUpdateAborted(weenieError),
onAllegianceLoginNotification: notice =>
social.Allegiance?.ApplyLoginNotification(
//
// FA2 fix-round SHOULD-FIX 1 (2026-08-12,
// docs/research/2026-08-12-fa2-review-mechanism.md): pass
// each delegate hole CONDITIONALLY on the matching owner
// being supplied, rather than an always-non-null lambda that
// no-ops through `?.`. GameEventWiring only registers a
// handler (and so only counts toward
// GameEventDispatcher.GetUnhandledCount) when its delegate
// hole is non-null — an always-non-null lambda made every
// caller without an owner (bare-ChatLog tests, a future
// partial host) silently read 0 unhandled events for these
// 9 types even though the parse result was discarded.
onFellowshipFullUpdate: social.Fellowship is { } fellowshipFull
? fellowshipFull.ApplyFullUpdate
: null,
onFellowshipUpdateFellow: social.Fellowship is { } fellowshipUpdate
? fellowshipUpdate.ApplyUpdateFellow
: null,
onFellowshipQuit: social.Fellowship is { } fellowshipQuit
? quitterGuid => fellowshipQuit.ApplyQuit(quitterGuid, inventory.PlayerGuid())
: null,
onFellowshipDismiss: social.Fellowship is { } fellowshipDismiss
? dismissedGuid => fellowshipDismiss.ApplyDismiss(dismissedGuid, inventory.PlayerGuid())
: null,
onFellowshipDisband: social.Fellowship is { } fellowshipDisband
? fellowshipDisband.ApplyDisband
: null,
onAllegianceUpdate: social.Allegiance is { } allegianceUpdate
? allegianceUpdate.ApplyUpdate
: null,
onAllegianceUpdateDone: social.Allegiance is { } allegianceUpdateDone
? allegianceUpdateDone.ApplyUpdateDone
: null,
onAllegianceUpdateAborted: social.Allegiance is { } allegianceUpdateAborted
? allegianceUpdateAborted.ApplyUpdateAborted
: null,
onAllegianceLoginNotification: social.Allegiance is { } allegianceLogin
? notice => allegianceLogin.ApplyLoginNotification(
notice.CharacterGuid,
notice.IsLoggedIn)));
notice.IsLoggedIn)
: null));
ConstructionCheckpoint();
// Campaign P Slice P1 (2026-07-30): burden recompute triggers —