test(ablegacy): make FakeAbLegacyTagFactory.Tags thread-safe — probe loop raced the test thread (#573)

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-07 23:05:34 -04:00
parent 04b6563286
commit 8c685bcbba
@@ -115,8 +115,13 @@ internal class FakeAbLegacyTag : IAbLegacyTagRuntime
/// <summary>Test factory for creating fake AbLegacy tags.</summary>
internal sealed class FakeAbLegacyTagFactory : IAbLegacyTagFactory
{
/// <summary>Gets the collection of created tags, keyed by tag name.</summary>
public Dictionary<string, FakeAbLegacyTag> Tags { get; } = new(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// Gets the collection of created tags, keyed by tag name. Concurrent on purpose (#573): the driver's
/// connectivity probe is on by default and creates its <c>S:0</c> runtime from a thread-pool thread
/// while a test thread creates the tag under test, so a plain <see cref="Dictionary{TKey,TValue}"/>
/// here lost inserts (the "given key was not present" flake, ~1 run in 15).
/// </summary>
public System.Collections.Concurrent.ConcurrentDictionary<string, FakeAbLegacyTag> Tags { get; } = new(StringComparer.OrdinalIgnoreCase);
/// <summary>Gets or sets an optional customization function for tag creation.</summary>
public Func<AbLegacyTagCreateParams, FakeAbLegacyTag>? Customise { get; set; }