AutoId review fixes: tag before send, pack waits out combat, sweep retries
- The flight tag is registered BEFORE _requestId again, so a 0xC8 that AC puts on the wire inside the call is still tagged. EngineSend returns a token; a call that returns false or throws hands it to EngineSendFailed, which retires the entry (a no-op once it was matched, or when the slot now holds another id). FlightRecorderTests: a synchronous send is tagged, a failed send leaves no live entry, a retire for another id or a bad token is a no-op. - Inventory sends wait (WaitCombat, kept, counted once) while a target is selected, a cast is in flight (CastGate.GetCastBusyState) or an attack runs (ClientActionGates.TryReadAttacking). Each 0xC8 raises AC's busy count, which plugins gate casts on. The selected target and an open container are not held; All mode is unchanged. combat= in the minute line, combat in /rc autoid status. - The login sweep looks into containers only (ItemsCapacity > 0 in the PWD snapshot, the engine's own pack rule), skips a tick while the pending list is full, and is marked done only when nothing overflowed; otherwise it runs again once there is room. - CollectOwnedIdsFromSnapshot has its doc comment back; HasPwdSnapshot and the new IsContainerInSnapshot have their own. LiveWorld's send is renamed QueueIdentify and block-bodied, so check_offthread_mutators.py scans it and its allow-list entry no longer also covers the create-path Enqueue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c9bbafbfb4
commit
8668f2a3ca
11 changed files with 224 additions and 50 deletions
|
|
@ -30,7 +30,7 @@ internal static partial class Program
|
|||
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, bool warm)
|
||||
private static V Expected(AutoIdMode mode, C cls, long age, bool defer, bool openedAfter, bool fresh, bool cached, bool rateOk, bool warm, bool combat)
|
||||
{
|
||||
if (mode == AutoIdMode.Off) return V.SkipMode;
|
||||
if (mode == AutoIdMode.All) return cls == C.Target && fresh ? V.SkipFresh : V.Send;
|
||||
|
|
@ -39,7 +39,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.Inventory => cached ? V.SkipFresh : young ? V.WaitAge : defer ? V.WaitDefer : combat ? V.WaitCombat : !rateOk ? V.WaitRate : V.Send,
|
||||
C.Unknown => young ? V.WaitAge : !warm && age < AutoIdPolicy.UnknownMaxWaitMs ? V.WaitSnapshot : V.SkipMode,
|
||||
_ => V.SkipMode,
|
||||
};
|
||||
|
|
@ -58,16 +58,17 @@ internal static partial class Program
|
|||
foreach (bool fresh in new[] { false, true })
|
||||
foreach (bool rateOk in new[] { false, true })
|
||||
foreach (bool warm in new[] { false, true })
|
||||
foreach (bool combat in new[] { false, true })
|
||||
{
|
||||
if (fresh && !cached) continue; // fresh implies cached
|
||||
rows++;
|
||||
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);
|
||||
V got = AutoIdPolicy.Decide(mode, cls, age, defer, opened, fresh, cached, rateOk, warm, combat);
|
||||
V want = Expected(mode, cls, age, defer, opened, fresh, cached, rateOk, warm, combat);
|
||||
if (got != want && wrong++ < 10)
|
||||
Check(false, $"{mode} {cls} age={age} defer={defer} opened={opened} cached={cached} fresh={fresh} rateOk={rateOk} warm={warm}: want {want}, got {got}");
|
||||
Check(false, $"{mode} {cls} age={age} defer={defer} opened={opened} cached={cached} fresh={fresh} rateOk={rateOk} warm={warm} combat={combat}: want {want}, got {got}");
|
||||
}
|
||||
Check(wrong == 0, $"{wrong} of {rows} rows wrong");
|
||||
Check(rows == 3 * 5 * 6 * 2 * 2 * 3 * 2 * 2, $"row count {rows}");
|
||||
Check(rows == 3 * 5 * 6 * 2 * 2 * 3 * 2 * 2 * 2, $"row count {rows}");
|
||||
}
|
||||
|
||||
/// <summary>The same rules as named cases, so a mutation is easy to read off a failure.</summary>
|
||||
|
|
@ -104,6 +105,11 @@ internal static partial class Program
|
|||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Container, Old, false, true, false, false, inventoryRateOk: false) == V.Send, "the rate cap is the inventory's only (container)");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Target, 0, true, false, false, false, inventoryRateOk: false) == V.Send, "the rate cap never holds the selected target");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.All, C.Inventory, 0, false, false, false, false, inventoryRateOk: false) == V.Send, "All mode keeps the old behaviour (no cap)");
|
||||
// Combat: only the pack waits; the target and an open container do not.
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Inventory, Old, false, false, false, false, combatBusy: true) == V.WaitCombat, "pack item waits while in combat");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Target, 0, false, false, false, false, combatBusy: true) == V.Send, "combat never holds the selected target");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Container, Old, false, true, false, false, combatBusy: true) == V.Send, "combat never holds an open container");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.All, C.Inventory, Old, false, false, false, false, combatBusy: true) == V.Send, "All mode: no combat hold (old behaviour)");
|
||||
// Limited: unknown place.
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Unknown, 100, false, false, false, false) == V.WaitAge, "unknown place waits while young");
|
||||
Check(AutoIdPolicy.Decide(AutoIdMode.Limited, C.Unknown, Old, false, false, false, false) == V.SkipMode, "still unknown when old: skipped");
|
||||
|
|
|
|||
Loading…
Reference in a new issue