Skip to content

Initial Commit#10

Merged
thomhurst merged 124 commits intomainfrom
feature/initial-commit
Feb 4, 2024
Merged

Initial Commit#10
thomhurst merged 124 commits intomainfrom
feature/initial-commit

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

No description provided.

@thomhurst thomhurst merged commit 7f0bedb into main Feb 4, 2024
@thomhurst thomhurst deleted the feature/initial-commit branch March 5, 2024 16:44
thomhurst added a commit that referenced this pull request Apr 17, 2026
Scaffolding commit for PR C. Will contain:

- #7 TestGroupingService: make sync, move trace logging behind guard

- #8 LINQ chains in discovery/init replaced with direct loops

- #9 TestSessionContext.HasFailures via atomic counter (O(1))

- #10 TestContext.Id lazy string from stored Guid or counter
thomhurst added a commit that referenced this pull request Apr 18, 2026
* perf: discovery/init path cleanup (#5528 items 7-10)

Scaffolding commit for PR C. Will contain:

- #7 TestGroupingService: make sync, move trace logging behind guard

- #8 LINQ chains in discovery/init replaced with direct loops

- #9 TestSessionContext.HasFailures via atomic counter (O(1))

- #10 TestContext.Id lazy string from stored Guid or counter

* perf: discovery/init path cleanup (#5528 C)

- TestGroupingService: hot path now fully synchronous; trace-message
  emission moved behind an IsTraceEnabled guard. Eliminates the async
  state machine when tracing is off (the normal case).
- LINQ chains replaced with direct loops in EventReceiverOrchestrator,
  HookDelegateBuilder, TestDiscoveryContext, TestDiscoveryService, and
  TestSessionCoordinator. Also switched InitializeTestCounts to accept
  IReadOnlyList<AbstractExecutableTest> directly, dropping the Select
  projection + ToList fallback.
- TestSessionContext: added HasFailures backed by a lock-free failure
  counter incremented from TestCoordinator on Failed/Timeout/Cancelled.
  Replaces an O(N) AllTests.Any() traversal in the after-session hook
  path.
- TestContext.Id: Guid is stored and the string form is materialized
  lazily. The registry is keyed by Guid internally; GetById(string)
  parses once. Removes the eager ToString allocation for tests that
  never access the string Id.

* perf: mark TestContext._idString volatile for weak-memory safety

Addresses review feedback on #5611: `_idString ??= _idGuid.ToString()`
is not safe under weak memory ordering (ARM/WASM/AOT). A reader could
observe a stale null even after another thread wrote the string. Mark
the field volatile — reference writes are atomic, so a benign double
ToString is possible but harmless; volatile fixes the staleness.

* test: sync PublicAPI snapshots for TestSessionContext.HasFailures

CI failed on net8.0/net9.0/net4_7 Core PublicAPI diff at line 1684 —
the HasFailures property added in the prior commit was only reflected
in the net10.0 snapshot. Add the same entry to the other framework
variants so the PublicAPI verification passes across all TFMs.

* refactor: make TestSessionContext.HasFailures internal

Only consumer is HookExecutor (engine-internal) — no user-facing need to
expose the failure-count gate. Dropping to `internal` shrinks the public
surface, removes the PublicAPI snapshot entries across all four TFMs,
and keeps the counter representation free to evolve.

* perf: publish TestContext._idString via Interlocked.CompareExchange

Replaces `volatile` field + `??=` with `Volatile.Read` + `CompareExchange`
so only one string is ever published even if the Id format becomes
non-deterministic in the future. ARM/WASM acquire semantics preserved
via `Volatile.Read` on the fast path.

* fix: address review feedback on engine discovery/init cleanup

- TestScheduler: call MarkFailure() on circular-dep failures so
  HasFailures reflects them (prior O(N) AllTests scan caught these;
  counter-based HasFailures missed them since circular-dep tests
  skip the TestCoordinator lifecycle switch)
- TestDiscoveryContext: BuildUniqueAssemblies/TestClasses use
  List+HashSet pair to guarantee first-occurrence insertion order
  (matches prior LINQ Distinct() contract; HashSet.CopyTo ordering
  is an implementation detail)
- TestContext: remove unused internal RemoveById; callers now use
  RemoveFromRegistry() directly

* docs: clarify why BuildUniqueAssemblies uses List+HashSet pair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant