AutoId review fixes: login pack sweep, refused sends kept, flight tag after send
- The login pack was never appraised: at login the PWD snapshot is cold, so ownership reads miss, the item classified Unknown and was skipped at 2 s. Unknown now waits (WaitSnapshot) until the snapshot has entries or 120 s pass, and a one-shot sweep runs at LoginCompleteAtMs + 30 s (and again after a hot reload's MarkAlreadyComplete, which restamps login): the player's owned items plus each owned side pack, uncached ones added as inventory work. The 5/s inventory cap still applies. - The drain moved into AutoIdDrain.cs, a pure unit behind IAutoIdWorld, so it runs against a fake world in EngineRobustnessTests (cold snapshot for N seconds, then every pack item is sent, none before login + 30 s, at most 5 per second). - A refused EnqueueRequestId keeps the entry, is not counted as sent, ends the tick's sending and does not take the inventory rate slot. The priority target is re-armed on refusal. - The flight tag is registered only after _requestId returns true; the pending table is 256 (MaxRequestIdQueue); IdentifyTagging covers 200 registrations and 200 matches. - The 4096 pending cap applies only in Limited mode; _incoming is bounded at 16384 while DrainTick returns early, dropping the oldest and counting them. - 0x0022 InventoryPutObjInContainer is read in SmartBoxHooks.ParseGameEvent so it works with ServerMessageStream off; ServerMessageStream is back to its base text. - check_offthread_mutators.py: the stale DrainPending allow-list entry is replaced by LiveWorld's Enqueue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
44765436cd
commit
c9bbafbfb4
14 changed files with 670 additions and 218 deletions
|
|
@ -27,10 +27,10 @@ internal static partial class Program
|
|||
|
||||
// ---- the decision table ---------------------------------------------------------
|
||||
|
||||
private static readonly long[] Ages = { 0, AutoIdPolicy.MinAgeMs - 1, AutoIdPolicy.MinAgeMs, 60_000 };
|
||||
private static readonly long[] Ages = { 0, AutoIdPolicy.MinAgeMs - 1, AutoIdPolicy.MinAgeMs, 60_000, AutoIdPolicy.UnknownMaxWaitMs - 1, AutoIdPolicy.UnknownMaxWaitMs };
|
||||
|
||||
/// <summary>The rule as the spec states it, written out independently of AutoIdPolicy.Decide.</summary>
|
||||
private static V Expected(AutoIdMode mode, C cls, long age, bool defer, bool openedAfter, bool fresh, bool cached, bool rateOk)
|
||||
private static V Expected(AutoIdMode mode, C cls, long age, bool defer, bool openedAfter, bool fresh, bool cached, bool rateOk, bool warm)
|
||||
{
|
||||
if (mode == AutoIdMode.Off) return V.SkipMode;
|
||||
if (mode == AutoIdMode.All) return cls == C.Target && fresh ? V.SkipFresh : V.Send;
|
||||
|
|
@ -40,7 +40,7 @@ internal static partial class Program
|
|||
C.Target => fresh ? V.SkipFresh : V.Send,
|
||||
C.Container => fresh ? V.SkipFresh : young ? V.WaitAge : defer && !openedAfter ? V.WaitDefer : V.Send,
|
||||
C.Inventory => cached ? V.SkipFresh : young ? V.WaitAge : defer ? V.WaitDefer : !rateOk ? V.WaitRate : V.Send,
|
||||
C.Unknown => young ? V.WaitAge : V.SkipMode,
|
||||
C.Unknown => young ? V.WaitAge : !warm && age < AutoIdPolicy.UnknownMaxWaitMs ? V.WaitSnapshot : V.SkipMode,
|
||||
_ => V.SkipMode,
|
||||
};
|
||||
}
|
||||
|
|
@ -57,16 +57,17 @@ internal static partial class Program
|
|||
foreach (bool cached in new[] { false, true })
|
||||
foreach (bool fresh in new[] { false, true })
|
||||
foreach (bool rateOk in new[] { false, true })
|
||||
foreach (bool warm in new[] { false, true })
|
||||
{
|
||||
if (fresh && !cached) continue; // fresh implies cached
|
||||
rows++;
|
||||
V got = AutoIdPolicy.Decide(mode, cls, age, defer, opened, fresh, cached, rateOk);
|
||||
V want = Expected(mode, cls, age, defer, opened, fresh, cached, rateOk);
|
||||
V got = AutoIdPolicy.Decide(mode, cls, age, defer, opened, fresh, cached, rateOk, warm);
|
||||
V want = Expected(mode, cls, age, defer, opened, fresh, cached, rateOk, warm);
|
||||
if (got != want && wrong++ < 10)
|
||||
Check(false, $"{mode} {cls} age={age} defer={defer} opened={opened} cached={cached} fresh={fresh} rateOk={rateOk}: want {want}, got {got}");
|
||||
Check(false, $"{mode} {cls} age={age} defer={defer} opened={opened} cached={cached} fresh={fresh} rateOk={rateOk} warm={warm}: want {want}, got {got}");
|
||||
}
|
||||
Check(wrong == 0, $"{wrong} of {rows} rows wrong");
|
||||
Check(rows == 3 * 5 * 4 * 2 * 2 * 3 * 2, $"row count {rows}");
|
||||
Check(rows == 3 * 5 * 6 * 2 * 2 * 3 * 2 * 2, $"row count {rows}");
|
||||
}
|
||||
|
||||
/// <summary>The same rules as named cases, so a mutation is easy to read off a failure.</summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue