Merge #573: AbLegacy fake tag factory is thread-safe (probe raced the test's tag create)

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-07 23:06:07 -04:00
@@ -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; }